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

Issue 507036: Use one runtime call for creating object/array literals in... (Closed)

Created:
11 years ago by fschneider
Modified:
9 years, 6 months ago
CC:
v8-dev
Visibility:
Public.

Description

Use one runtime call for creating object/array literals in the code generator. The runtime function checks if it needs to create a boilerplate object or if it can clone from an existing boilerplate. This is already done in the top-level compiler. Committed: http://code.google.com/p/v8/source/detail?r=3516

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Patch Set 5 : '' #

Patch Set 6 : '' #

Patch Set 7 : '' #

Total comments: 12

Patch Set 8 : '' #

Patch Set 9 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+113 lines, -401 lines) Patch
M src/arm/codegen-arm.cc View 1 2 3 4 5 6 7 4 chunks +26 lines, -132 lines 0 comments Download
M src/arm/fast-codegen-arm.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/arm/virtual-frame-arm.h View 1 chunk +5 lines, -0 lines 0 comments Download
M src/arm/virtual-frame-arm.cc View 1 chunk +7 lines, -0 lines 0 comments Download
M src/ast.h View 1 chunk +4 lines, -4 lines 0 comments Download
M src/ia32/codegen-ia32.cc View 1 2 3 4 5 6 7 6 chunks +43 lines, -138 lines 0 comments Download
M src/ia32/fast-codegen-ia32.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/parser.cc View 1 chunk +1 line, -1 line 0 comments Download
M src/x64/codegen-x64.cc View 1 2 3 4 5 6 7 4 chunks +24 lines, -123 lines 0 comments Download
M src/x64/fast-codegen-x64.cc View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
fschneider
Ported this change from the fast compiler also to the normal compiler.
11 years ago (2009-12-17 13:03:27 UTC) #1
fschneider
Uploaded new version. Added Kasper to review. Changes: Merged with Kasper's fast array literal allocation ...
11 years ago (2009-12-17 19:18:44 UTC) #2
fschneider
I'm moving the check if the boilerplate exists into the fast clone stub. Still working ...
11 years ago (2009-12-21 13:14:04 UTC) #3
fschneider
Ready for review now. The FastCloneStub (only on IA-32) take now 3 arguments and the ...
11 years ago (2009-12-22 10:42:04 UTC) #4
Kevin Millikin (Chromium)
I have some suggestions for cleanup, but otherwise it LGTM. http://codereview.chromium.org/507036/diff/6/9 File src/arm/codegen-arm.cc (right): http://codereview.chromium.org/507036/diff/6/9#newcode2690 ...
11 years ago (2009-12-22 11:58:14 UTC) #5
fschneider
11 years ago (2009-12-22 12:40:09 UTC) #6
http://codereview.chromium.org/507036/diff/6/9
File src/arm/codegen-arm.cc (right):

http://codereview.chromium.org/507036/diff/6/9#newcode2690
src/arm/codegen-arm.cc:2690: __ stm(db_w, sp, r2.bit() | r1.bit() | r0.bit());
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> You might add a function to the ARM virtual frame to do this.  It seems safer
if
> we ever implement the virtual frame on ARM.
> 
> void VirtualFrame::EmitStoreMultiple(int count, RegList srcs) {
>   ASSERT(stack_pointer_ == element_count() - 1);
>   Adjust(count);
>   __ stm(db_w, sp, srcs);
> }
>   

Done. Good idea, otherwise too easy to forget calling frame_->Adjust together
with the __ stm instruction.

http://codereview.chromium.org/507036/diff/6/7
File src/ia32/codegen-ia32.cc (right):

http://codereview.chromium.org/507036/diff/6/7#newcode4371
src/ia32/codegen-ia32.cc:4371: if (node->depth() == 1 &&
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> It seems simpler to factor out all the shared code between these branches:
> 
> frame_->Push(&literals);
> frame_->Push(Smi::FromInt(node->literal_index());
> frame_->Push(node->literals());
> Result clone;
> if (node->depth() > 1) {
>   clone = frame_->CallRuntime(Runtime::kCreateArrayLiteral, 3);
> } else if (length > FastCloneShallowArrayStub::kMaximumLenght) {
>   clone = frame_->CallRuntime(Runtime::kCreateArrayLiteralShallow, 3);
> } else {
>   FastCloneShallowArrayStub stub(length);
>   clone = frame_->CallStub(&stub, 3);
> }
> frame_->Push(&clone);

Done.

http://codereview.chromium.org/507036/diff/6/7#newcode4378
src/ia32/codegen-ia32.cc:4378: frame_->Push(node->literals());
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> The name ArrayLiteral::literals() is unfortunate.  It's not the literals array
> of the function and the elements do not have type Literal*.  Maybe something
> like 'constant_elements' or 'compile_time_elements' is clearer.

Done.

http://codereview.chromium.org/507036/diff/6/7#newcode6641
src/ia32/codegen-ia32.cc:6641: __ shr(eax, kSmiTagSize);
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> You don't need to untag the index:
> 
> ASSERT(kPointerSize == 4);
> __ mov(ecx, FieldOperand(ecx, eax, times_2,
>                          FixedArray::kHeaderSize));
> __ cmp(ecx, Factor::undefined_value());
> ...

Done.

http://codereview.chromium.org/507036/diff/6/7#newcode6652
src/ia32/codegen-ia32.cc:6652: // allocation. This avoid multiple limit checks.
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> "avoid" ==> "avoids"

Done.

http://codereview.chromium.org/507036/diff/6/7#newcode6681
src/ia32/codegen-ia32.cc:6681: ExternalReference
runtime2(Runtime::kCreateArrayLiteralShallow);
On 2009/12/22 11:58:14, Kevin Millikin wrote:
> runtime2?

Oops. Done.

Powered by Google App Engine
This is Rietveld 408576698