Refactor the code cache to handle large number of properties on the global ob... (issue652119)

0 views
Skip to first unread message

sgj...@chromium.org

unread,
Feb 25, 2010, 7:45:16 AM2/25/10
to ag...@chromium.org, v8-...@googlegroups.com
Reviewers: Mads Ager,

Description:
Refactor the code cache to handle large number of properties on the global
object.

A separate object type for the code cache have been added. This object has
two
different code caches. The first one (default_cache) is a fixed array
organized
in the same way as the as the code cache was before. The second cache
(global_access_cache) is for code stubs to access the global object. This
cache
is organized as a hash table taking the property name and code flags as the
key.

The reason for separating the global access stubs into a hash table
representation is that the number of these is not bounded in the same was
as the
other types.

BUG=613

Please review this at http://codereview.chromium.org/652119

SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/

Affected files:
M src/heap.h
M src/heap.cc
M src/objects-debug.cc
M src/objects-inl.h
M src/objects.h
M src/objects.cc


ag...@chromium.org

unread,
Feb 25, 2010, 8:26:24 AM2/25/10
to sgj...@chromium.org, v8-...@googlegroups.com
LGTM


http://codereview.chromium.org/652119/diff/2001/3002
File src/objects.cc (right):

http://codereview.chromium.org/652119/diff/2001/3002#newcode3078
src/objects.cc:3078: if (code->type() == NORMAL) {
It is not completely trivial that MONOMORPHIC & NORMAL implies that the
code is for accessing a global property. Could you add a comment just
stating that this is the case. It is clear however, that MONOMORPHIC &
NORMAL means that there can be an unbounded number of them and we
therefore need a hash table.

http://codereview.chromium.org/652119/diff/2001/3002#newcode3079
src/objects.cc:3079: // Make sure the a hash table is allocated got the
global access code cache.
the -> that
got -> for?

http://codereview.chromium.org/652119/diff/2001/3002#newcode3202
src/objects.cc:3202: // This is not used for global object IC's.
Should we just assert that code->type() != NORMAL in that case?

http://codereview.chromium.org/652119/diff/2001/3002#newcode3228
src/objects.cc:3228: // code object. The actual match is on the name and
the code flags. If this key
this -> a

http://codereview.chromium.org/652119/diff/2001/3002#newcode3229
src/objects.cc:3229: // is created using the flags in not a code object
it can only be used for
in -> and

http://codereview.chromium.org/652119/diff/2001/3003
File src/objects.h (right):

http://codereview.chromium.org/652119/diff/2001/3003#newcode3733
src/objects.h:3733: // Lookup Code object in the cache. Returns code
object if found.
Code -> code.

Document what it returns when not found?

http://codereview.chromium.org/652119/diff/2001/3003#newcode3737
src/objects.h:3737: // code object is not in that cache. This index can
be ised to later call
ised -> used

http://codereview.chromium.org/652119/diff/2001/3003#newcode3763
src/objects.h:3763: // Code cache layout. The code cache is a fixed
array where the first element
This comment looks wrong - left over from a previous version of this
change?

http://codereview.chromium.org/652119

sgj...@chromium.org

unread,
Feb 25, 2010, 9:00:07 AM2/25/10
to ag...@chromium.org, v8-...@googlegroups.com

http://codereview.chromium.org/652119/diff/2001/3002#newcode3078
src/objects.cc:3078: if (code->type() == NORMAL) {

On 2010/02/25 13:26:24, Mads Ager wrote:
> It is not completely trivial that MONOMORPHIC & NORMAL implies that
the code is
> for accessing a global property. Could you add a comment just stating
that this
> is the case. It is clear however, that MONOMORPHIC & NORMAL means
that there
> can be an unbounded number of them and we therefore need a hash table.

Renamed GlobalAccess -> NormalType global_access -< normal_type, and
added a comment indicating that this is property cell access.

http://codereview.chromium.org/652119/diff/2001/3002#newcode3079
src/objects.cc:3079: // Make sure the a hash table is allocated got the
global access code cache.

On 2010/02/25 13:26:24, Mads Ager wrote:
> the -> that
> got -> for?

Done.

http://codereview.chromium.org/652119/diff/2001/3002#newcode3202
src/objects.cc:3202: // This is not used for global object IC's.

On 2010/02/25 13:26:24, Mads Ager wrote:
> Should we just assert that code->type() != NORMAL in that case?

Done.

http://codereview.chromium.org/652119/diff/2001/3002#newcode3228
src/objects.cc:3228: // code object. The actual match is on the name and
the code flags. If this key

On 2010/02/25 13:26:24, Mads Ager wrote:
> this -> a

Done.

http://codereview.chromium.org/652119/diff/2001/3002#newcode3229
src/objects.cc:3229: // is created using the flags in not a code object
it can only be used for

On 2010/02/25 13:26:24, Mads Ager wrote:
> in -> and

Done.

http://codereview.chromium.org/652119/diff/2001/3003#newcode3733
src/objects.h:3733: // Lookup Code object in the cache. Returns code
object if found.

On 2010/02/25 13:26:24, Mads Ager wrote:
> Code -> code.

> Document what it returns when not found?

Done.

http://codereview.chromium.org/652119/diff/2001/3003#newcode3737
src/objects.h:3737: // code object is not in that cache. This index can
be ised to later call

On 2010/02/25 13:26:24, Mads Ager wrote:
> ised -> used

Done.

http://codereview.chromium.org/652119/diff/2001/3003#newcode3763
src/objects.h:3763: // Code cache layout. The code cache is a fixed
array where the first element

On 2010/02/25 13:26:24, Mads Ager wrote:
> This comment looks wrong - left over from a previous version of this
change?

Sorry about that, fixed.

http://codereview.chromium.org/652119

Reply all
Reply to author
Forward
0 new messages