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

Issue 8381014: Fixing dead code in empty array init. (Closed)

Created:
9 years, 2 months ago by Yang
Modified:
9 years, 1 month ago
CC:
v8-dev
Visibility:
Public.

Description

Fixing dead code in empty array init. TEST=set JSArray::kPreallocatedArrayElements to larger than 4. Committed: http://code.google.com/p/v8/source/detail?r=9816

Patch Set 1 #

Patch Set 2 : Ported change to MIPS. #

Total comments: 9
Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -4 lines) Patch
M src/arm/builtins-arm.cc View 3 chunks +9 lines, -2 lines 4 comments Download
M src/ia32/builtins-ia32.cc View 1 chunk +1 line, -0 lines 1 comment Download
M src/mips/builtins-mips.cc View 1 3 chunks +9 lines, -2 lines 3 comments Download
M src/x64/builtins-x64.cc View 1 chunk +1 line, -0 lines 1 comment Download

Messages

Total messages: 3 (0 generated)
Yang
Please take a look. This also changes the behavior in arm code when the constant ...
9 years, 2 months ago (2011-10-24 16:03:57 UTC) #1
Yang
Added port to MIPS. Also, *gentle nudge*.
9 years, 1 month ago (2011-10-27 09:43:45 UTC) #2
Kevin Millikin (Chromium)
9 years, 1 month ago (2011-10-27 10:35:54 UTC) #3
LGTM, but if you keep asking me to look at this code, I'll keep finding things
to change about the surrounding code.

http://codereview.chromium.org/8381014/diff/3001/src/arm/builtins-arm.cc
File src/arm/builtins-arm.cc (right):

http://codereview.chromium.org/8381014/diff/3001/src/arm/builtins-arm.cc#newc...
src/arm/builtins-arm.cc:143: STATIC_ASSERT(kSmiTag == 0);
I can't figure out why the following code depends on this assert.  Can you?  If
not, let's just get rid of it.

http://codereview.chromium.org/8381014/diff/3001/src/arm/builtins-arm.cc#newc...
src/arm/builtins-arm.cc:152: ASSERT_EQ(0 * kPointerSize,
FixedArray::kMapOffset);
This can be a static assert.

http://codereview.chromium.org/8381014/diff/3001/src/arm/builtins-arm.cc#newc...
src/arm/builtins-arm.cc:155: ASSERT_EQ(1 * kPointerSize,
FixedArray::kLengthOffset);
This can be a static assert.

http://codereview.chromium.org/8381014/diff/3001/src/arm/builtins-arm.cc#newc...
src/arm/builtins-arm.cc:159: ASSERT_EQ(2 * kPointerSize,
FixedArray::kHeaderSize);
This can be a static assert.

http://codereview.chromium.org/8381014/diff/3001/src/ia32/builtins-ia32.cc
File src/ia32/builtins-ia32.cc (right):

http://codereview.chromium.org/8381014/diff/3001/src/ia32/builtins-ia32.cc#ne...
src/ia32/builtins-ia32.cc:999: __ add(scratch1,
Immediate(FixedArray::kHeaderSize - kHeapObjectTag));
On ia32, there's usually no need to untag like this because we can build
untagging into the operand's offset.  (See FieldOperand.)

In this case, we can get slightly tighter loop by using a counted loop,
something like:

    mov scratch2, initial_capacity
    jmp entry
loop:
    mov FieldOperand(scratch1, scratch2, kPointerSize, 0), the_hole_value
entry:
    dec scratch2
    j not_sign, loop

http://codereview.chromium.org/8381014/diff/3001/src/mips/builtins-mips.cc
File src/mips/builtins-mips.cc (right):

http://codereview.chromium.org/8381014/diff/3001/src/mips/builtins-mips.cc#ne...
src/mips/builtins-mips.cc:152: ASSERT_EQ(0 * kPointerSize,
FixedArray::kMapOffset);
Can be a static assert.

http://codereview.chromium.org/8381014/diff/3001/src/mips/builtins-mips.cc#ne...
src/mips/builtins-mips.cc:156: ASSERT_EQ(1 * kPointerSize,
FixedArray::kLengthOffset);
Also here.

http://codereview.chromium.org/8381014/diff/3001/src/mips/builtins-mips.cc#ne...
src/mips/builtins-mips.cc:161: ASSERT_EQ(2 * kPointerSize,
FixedArray::kHeaderSize);
Also here.

http://codereview.chromium.org/8381014/diff/3001/src/x64/builtins-x64.cc
File src/x64/builtins-x64.cc (right):

http://codereview.chromium.org/8381014/diff/3001/src/x64/builtins-x64.cc#newc...
src/x64/builtins-x64.cc:1078: __ addq(scratch1,
Immediate(FixedArray::kHeaderSize - kHeapObjectTag));
No need to untag here.  Could use a counted loop so that the update sets the
flags (no need for explicit cmp), see my comment on ia32.

Powered by Google App Engine
This is Rietveld 408576698