Chromium Code Reviews| Index: src/x64/code-stubs-x64.cc |
| diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
| index 94f09aaaa19a7a8265a330037dd1619f19895d9b..306b63b93a1d3d66347a58fd7640be73fe7419d7 100644 |
| --- a/src/x64/code-stubs-x64.cc |
| +++ b/src/x64/code-stubs-x64.cc |
| @@ -316,6 +316,7 @@ static void GenerateFastCloneShallowArrayCommon( |
| MacroAssembler* masm, |
| int length, |
| FastCloneShallowArrayStub::Mode mode, |
| + FastCloneShallowArrayStub::AllocationInfoMode allocation_info_mode, |
| Label* fail) { |
| // Registers on entry: |
| // |
| @@ -329,7 +330,13 @@ static void GenerateFastCloneShallowArrayCommon( |
| ? FixedDoubleArray::SizeFor(length) |
| : FixedArray::SizeFor(length); |
| } |
| - int size = JSArray::kSize + elements_size; |
| + int size = JSArray::kSize; |
| + int allocation_info_start = size; |
| + if (allocation_info_mode == |
| + FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) { |
| + size += AllocationSiteInfo::kSize; |
| + } |
| + size += elements_size; |
| // Allocate both the JS array and the elements array in one big |
| // allocation. This avoids multiple limit checks. |
| @@ -339,6 +346,13 @@ static void GenerateFastCloneShallowArrayCommon( |
| } |
| __ AllocateInNewSpace(size, rax, rbx, rdx, fail, flags); |
| + if (allocation_info_mode == |
| + FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) { |
| + __ LoadRoot(kScratchRegister, Heap::kAllocationSiteInfoMapRootIndex); |
| + __ movq(FieldOperand(rax, allocation_info_start), kScratchRegister); |
| + __ movq(FieldOperand(rax, allocation_info_start + kPointerSize), rcx); |
| + } |
| + |
| // Copy the JS array part. |
| for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
| if ((i != JSArray::kElementsOffset) || (length == 0)) { |
| @@ -351,7 +365,12 @@ static void GenerateFastCloneShallowArrayCommon( |
| // Get hold of the elements array of the boilerplate and setup the |
| // elements pointer in the resulting object. |
| __ movq(rcx, FieldOperand(rcx, JSArray::kElementsOffset)); |
| - __ lea(rdx, Operand(rax, JSArray::kSize)); |
| + if (allocation_info_mode == |
| + FastCloneShallowArrayStub::TRACK_ALLOCATION_INFO) { |
| + __ lea(rdx, Operand(rax, JSArray::kSize + AllocationSiteInfo::kSize)); |
| + } else { |
| + __ lea(rdx, Operand(rax, JSArray::kSize)); |
| + } |
| __ movq(FieldOperand(rax, JSArray::kElementsOffset), rdx); |
| // Copy the elements array. |
| @@ -398,6 +417,12 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| FastCloneShallowArrayStub::Mode mode = mode_; |
| // rcx is boilerplate object. |
| Factory* factory = masm->isolate()->factory(); |
| + FastCloneShallowArrayStub::AllocationInfoMode allocation_info_mode = DONT_TRACK_ALLOCATION_INFO; |
|
danno
2013/01/04 08:50:55
80 col
mvstanton
2013/01/04 12:07:52
Done.
|
| + if (mode == CLONE_ANY_ELEMENTS_WITH_ALLOCATION_INFO) { |
| + mode = CLONE_ANY_ELEMENTS; |
| + allocation_info_mode = TRACK_ALLOCATION_INFO; |
| + } |
| + |
| if (mode == CLONE_ANY_ELEMENTS) { |
| Label double_elements, check_fast_elements; |
| __ movq(rbx, FieldOperand(rcx, JSArray::kElementsOffset)); |
| @@ -405,7 +430,9 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| factory->fixed_cow_array_map()); |
| __ j(not_equal, &check_fast_elements); |
| GenerateFastCloneShallowArrayCommon(masm, 0, |
| - COPY_ON_WRITE_ELEMENTS, &slow_case); |
| + COPY_ON_WRITE_ELEMENTS, |
| + allocation_info_mode, |
| + &slow_case); |
| __ ret(3 * kPointerSize); |
| __ bind(&check_fast_elements); |
| @@ -413,7 +440,9 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| factory->fixed_array_map()); |
| __ j(not_equal, &double_elements); |
| GenerateFastCloneShallowArrayCommon(masm, length_, |
| - CLONE_ELEMENTS, &slow_case); |
| + CLONE_ELEMENTS, |
| + allocation_info_mode, |
| + &slow_case); |
| __ ret(3 * kPointerSize); |
| __ bind(&double_elements); |
| @@ -443,7 +472,8 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
| __ pop(rcx); |
| } |
| - GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case); |
| + GenerateFastCloneShallowArrayCommon(masm, length_, mode, |
| + allocation_info_mode, &slow_case); |
| __ ret(3 * kPointerSize); |
| __ bind(&slow_case); |