Chromium Code Reviews| Index: src/ia32/lithium-codegen-ia32.cc |
| diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
| index e9d750958e31773a0c0719ed37265c3f760e0bc3..2e9bd6ccee629411d709c71fbcd7f0c211075a5a 100644 |
| --- a/src/ia32/lithium-codegen-ia32.cc |
| +++ b/src/ia32/lithium-codegen-ia32.cc |
| @@ -5300,6 +5300,8 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
| ElementsKind boilerplate_elements_kind = |
| instr->hydrogen()->boilerplate_elements_kind(); |
| + AllocationSiteInfoMode allocation_site_info_mode = instr->hydrogen()-> |
| + allocation_site_info_mode(); |
| // Deopt if the array literal boilerplate ElementsKind is of a type different |
| // than the expected one. The check isn't necessary if the boilerplate has |
| @@ -5330,7 +5332,8 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| ASSERT(instr->hydrogen()->depth() == 1); |
| FastCloneShallowArrayStub::Mode mode = |
| FastCloneShallowArrayStub::COPY_ON_WRITE_ELEMENTS; |
| - FastCloneShallowArrayStub stub(mode, length); |
| + FastCloneShallowArrayStub stub(mode, DONT_TRACK_ALLOCATION_SITE_INFO, |
|
Toon Verwaest
2013/01/16 10:53:42
Without _INFO it probably fits on one line; but th
mvstanton
2013/01/16 13:01:56
thx, now it does fit on one line.
|
| + length); |
| CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } else if (instr->hydrogen()->depth() > 1) { |
| CallRuntime(Runtime::kCreateArrayLiteral, 3, instr); |
| @@ -5339,9 +5342,9 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| } else { |
| FastCloneShallowArrayStub::Mode mode = |
| boilerplate_elements_kind == FAST_DOUBLE_ELEMENTS |
| - ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| - : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| - FastCloneShallowArrayStub stub(mode, length); |
| + ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS |
| + : FastCloneShallowArrayStub::CLONE_ELEMENTS; |
| + FastCloneShallowArrayStub stub(mode, allocation_site_info_mode, length); |
| CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); |
| } |
| } |
| @@ -5350,10 +5353,14 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
| void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| Register result, |
| Register source, |
| - int* offset) { |
| + int* offset, |
| + AllocationSiteInfoMode mode) { |
| ASSERT(!source.is(ecx)); |
| ASSERT(!result.is(ecx)); |
| + bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE_INFO && |
| + object->map()->CanTrackAllocationSite(); |
| + |
| if (FLAG_debug_code) { |
| __ LoadHeapObject(ecx, object); |
| __ cmp(source, ecx); |
| @@ -5377,8 +5384,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) { |
|
Toon Verwaest
2013/01/16 10:53:42
I think it's cleaner to just merge both if branche
mvstanton
2013/01/16 13:01:56
big time, thx.
|
| + *offset += AllocationSiteInfo::kSize; |
| + } |
| // Copy object header. |
| ASSERT(object->properties()->length() == 0); |
| @@ -5402,7 +5415,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| __ lea(ecx, Operand(result, *offset)); |
| __ mov(FieldOperand(result, total_offset), ecx); |
| __ LoadHeapObject(source, value_object); |
| - EmitDeepCopy(value_object, result, source, offset); |
| + EmitDeepCopy(value_object, result, source, offset, |
| + DONT_TRACK_ALLOCATION_SITE_INFO); |
| } else if (value->IsHeapObject()) { |
| __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
| __ mov(FieldOperand(result, total_offset), ecx); |
| @@ -5411,6 +5425,14 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| } |
| } |
| + // Build Allocation Site Info if desired |
| + if (create_allocation_site_info) { |
| + __ mov(FieldOperand(result, object_size), |
| + Immediate(Handle<Map>(isolate()->heap()-> |
| + allocation_site_info_map()))); |
| + __ mov(FieldOperand(result, object_size + kPointerSize), source); |
| + } |
| + |
| if (has_elements) { |
| // Copy elements backing store header. |
| __ LoadHeapObject(source, elements); |
| @@ -5443,7 +5465,8 @@ void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
| __ lea(ecx, Operand(result, *offset)); |
| __ mov(FieldOperand(result, total_offset), ecx); |
| __ LoadHeapObject(source, value_object); |
| - EmitDeepCopy(value_object, result, source, offset); |
| + EmitDeepCopy(value_object, result, source, offset, |
| + DONT_TRACK_ALLOCATION_SITE_INFO); |
| } else if (value->IsHeapObject()) { |
| __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
| __ mov(FieldOperand(result, total_offset), ecx); |
| @@ -5493,7 +5516,8 @@ void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
| __ bind(&allocated); |
| int offset = 0; |
| __ LoadHeapObject(ebx, instr->hydrogen()->boilerplate()); |
| - EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset); |
| + EmitDeepCopy(instr->hydrogen()->boilerplate(), eax, ebx, &offset, |
| + instr->hydrogen()->allocation_site_info_mode()); |
| ASSERT_EQ(size, offset); |
| } |