Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(643)

Issue 9050001: Ensure newly allocated empty Arrays are transitioned to FAST_ELEMENT (Closed)

Created:
8 years, 12 months ago by danno
Modified:
8 years, 10 months ago
Reviewers:
Jakob Kummerow
CC:
v8-dev
Visibility:
Public.

Description

Ensure newly allocated empty Arrays are transitioned to FAST_ELEMENT BUG= TEST=

Patch Set 1 #

Patch Set 2 : use a new approach #

Patch Set 3 : remove incorrect code #

Patch Set 4 : tweaks #

Patch Set 5 : remove printfs #

Patch Set 6 : fix existing and add new tests #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+254 lines, -71 lines) Patch
M src/bootstrapper.cc View 1 4 chunks +13 lines, -11 lines 1 comment Download
M src/contexts.h View 1 4 chunks +4 lines, -2 lines 0 comments Download
M src/flag-definitions.h View 2 3 4 5 1 chunk +1 line, -1 line 1 comment Download
M src/heap.cc View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M src/ia32/builtins-ia32.cc View 1 3 chunks +4 lines, -4 lines 0 comments Download
M src/objects.h View 1 2 3 4 5 1 chunk +4 lines, -0 lines 0 comments Download
M src/objects.cc View 1 2 3 4 5 8 chunks +97 lines, -45 lines 2 comments Download
M src/objects-inl.h View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M test/mjsunit/array-literal-transitions.js View 1 2 3 4 5 2 chunks +6 lines, -6 lines 0 comments Download
M test/mjsunit/elements-kind.js View 1 2 3 4 5 2 chunks +12 lines, -2 lines 2 comments Download
A test/mjsunit/elements-kind-fast-element-bias.js View 1 2 3 4 5 1 chunk +56 lines, -0 lines 1 comment Download
A test/mjsunit/elements-kind-smi-only-bias.js View 1 2 3 4 5 1 chunk +50 lines, -0 lines 1 comment Download

Messages

Total messages: 2 (0 generated)
danno
PTAL.
8 years, 12 months ago (2011-12-29 15:08:01 UTC) #1
Jakob Kummerow
8 years, 11 months ago (2012-01-04 20:55:16 UTC) #2
LGTM with comments.

Dynamic decision of the default elements kind is nifty, I like it :-)

Now that it's January, please change the year to 2012 in all files in this CL.

http://codereview.chromium.org/9050001/diff/6002/src/bootstrapper.cc
File src/bootstrapper.cc (right):

http://codereview.chromium.org/9050001/diff/6002/src/bootstrapper.cc#newcode2327
src/bootstrapper.cc:2327: context->set_fast_array_element_bias(0);
I have a weak preference to use "Smi::FromInt(0)" here, just to make it clear
what the "0" is.

http://codereview.chromium.org/9050001/diff/6002/src/flag-definitions.h
File src/flag-definitions.h (right):

http://codereview.chromium.org/9050001/diff/6002/src/flag-definitions.h#newco...
src/flag-definitions.h:123: DEFINE_bool(smi_only_arrays, true, "tracks arrays
with only smi values")
Is this change intentional?

http://codereview.chromium.org/9050001/diff/6002/src/objects.cc
File src/objects.cc (right):

http://codereview.chromium.org/9050001/diff/6002/src/objects.cc#newcode1224
src/objects.cc:1224: if (global_context->untransitioned_js_array_map() != NULL
&&
Don't you mean s/NULL/GetHeap()->undefined_value()/? (cf. changes to heap.cc)

http://codereview.chromium.org/9050001/diff/6002/src/objects.cc#newcode1245
src/objects.cc:1245: &dummy);
nit: indentation

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind-f...
File test/mjsunit/elements-kind-fast-element-bias.js (right):

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind-f...
test/mjsunit/elements-kind-fast-element-bias.js:38: // Ensure that there is a
global bais for not aggressively transitioning Arrays
s/bais/bias/

Even better, re-word the comment. Maybe "Test that repeated SMI->FAST
transitions are avoided by initializing Arrays with FAST_ELEMENTS right away"?
And then I'd add the inverse of the check at the end before messing with the
bias:

if (support_smi_only_arrays) {
  assertTrue(%HasFastSmiOnlyElements(new Array()));
}

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind-s...
File test/mjsunit/elements-kind-smi-only-bias.js (right):

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind-s...
test/mjsunit/elements-kind-smi-only-bias.js:38: // Ensure that there is a global
bais for not aggressively transitioning Arrays
s/bais/bias/

Or re-word: "Test that Arrays are initialized with SMI_ONLY elements when the
code benefits from transitioning to FAST_DOUBLE elements".

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind.js
File test/mjsunit/elements-kind.js (left):

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind.j...
test/mjsunit/elements-kind.js:42: print("Tests do NOT include smi-only
arrays.");
intentional removal?

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind.js
File test/mjsunit/elements-kind.js (right):

http://codereview.chromium.org/9050001/diff/6002/test/mjsunit/elements-kind.j...
test/mjsunit/elements-kind.js:45: // Ensure that there is a global bais for not
aggressively transitioning Arrays
suggestion: "Ensure that Arrays default to SMI_ONLY elements."

Powered by Google App Engine
This is Rietveld 408576698