Chromium Code Reviews| Index: src/arm/lithium-codegen-arm.cc |
| diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
| index 9a830733feaafb5307493e3943a6ec6d5d47f7a2..f3f663ab165517f2a30c70bc02a5b6304ec49304 100644 |
| --- a/src/arm/lithium-codegen-arm.cc |
| +++ b/src/arm/lithium-codegen-arm.cc |
| @@ -5469,10 +5469,18 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| } else if (length > FastCloneShallowArrayStub::kMaximumClonedLength) { |
| CallRuntime(Runtime::kCreateArrayLiteralShallow, 3, instr); |
| } else { |
| - FastCloneShallowArrayStub::Mode mode = |
| + // TODO(mvstanton): I'm doing more work than necessary here by running |
| + // CLONE_ANY_ELEMENTS instead of the more specific stub, but I'm doing it |
| + // just because I want to track allocation info. Alternative approach: quick |
| + // baking allocation tracking info into this field, instead just have it on |
| + // all the time? |
|
danno
2013/01/10 22:58:59
Be careful (here and on other platforms). Original
mvstanton
2013/01/11 13:43:01
Done.
|
| + FastCloneShallowArrayStub::Mode mode = FastCloneShallowArrayStub:: |
| + CLONE_ANY_ELEMENTS_WITH_ALLOCATION_SITE_INFO; |
| + /* |
| boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| + */ |
| FastCloneShallowArrayStub stub(mode, length); |
| CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| @@ -5482,7 +5490,8 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| Register result, |
| Register source, |
| - int* offset) { |
| + int* offset, |
| + bool create_allocation_site_info) { |
| ASSERT(!source.is(r2)); |
| ASSERT(!result.is(r2)); |
| @@ -5496,8 +5505,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| int object_offset = *offset; |
| int object_size = object->map()->instance_size(); |
| int elements_offset = *offset + object_size; |
| + if (create_allocation_site_info) { |
| + elements_offset += AllocationSiteInfo::kSize; |
| + } |
| int elements_size = has_elements ? elements->Size() : 0; |
| *offset += object_size + elements_size; |
| + if (create_allocation_site_info) { |
| + *offset += AllocationSiteInfo::kSize; |
| + } |
| // Copy object header. |
| ASSERT(object->properties()->length() == 0); |
| @@ -5531,6 +5546,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| } |
| } |
| + // Build Allocation Site Info if desired |
| + if (create_allocation_site_info) { |
| + __ mov(r2, Operand(Handle<Map>(isolate()->heap()-> |
| + allocation_site_info_map()))); |
| + __ str(r2, FieldMemOperand(result, object_size)); |
| + __ str(source, FieldMemOperand(result, object_size + kPointerSize)); |
| + } |
| + |
| if (has_elements) { |
| // Copy elements backing store header. |
| __ LoadHeapObject(source, elements); |
| @@ -5617,7 +5640,8 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
| __ bind(&allocated); |
| int offset = 0; |
| __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
| - EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset); |
| + EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset, |
| + instr->hydrogen()->create_allocation_site_info()); |
| ASSERT_EQ(size, offset); |
| } |