Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index da8e2ae4576796285ee2fcbd769beeb3a3f05e39..3b24e3f5f0f0f8409c8480ab258011f0eb911cd4 100644 |
--- a/src/ia32/code-stubs-ia32.cc |
+++ b/src/ia32/code-stubs-ia32.cc |
@@ -311,6 +311,7 @@ static void GenerateFastCloneShallowArrayCommon( |
MacroAssembler* masm, |
int length, |
FastCloneShallowArrayStub::Mode mode, |
+ bool want_allocation_info, |
danno
2012/12/26 10:32:01
Instead of passing a bool, create a enum in the he
mvstanton
2013/01/03 14:40:43
Done...I made a separate enum. I'd like to coalesc
|
Label* fail) { |
// Registers on entry: |
// |
@@ -324,12 +325,25 @@ 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 (want_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. |
__ AllocateInNewSpace(size, eax, ebx, edx, fail, TAG_OBJECT); |
+ if (want_allocation_info) { |
+ __ mov(FieldOperand(eax, allocation_info_start), |
+ Immediate(Handle<Map>(masm->isolate()->heap()-> |
+ allocation_site_info_map()))); |
+ __ mov(FieldOperand(eax, allocation_info_start + kPointerSize), ecx); |
+ // type_info_cell); |
danno
2012/12/26 10:32:01
nit: delete comment
mvstanton
2013/01/03 14:40:43
Done.
|
+ } |
+ |
// Copy the JS array part. |
for (int i = 0; i < JSArray::kSize; i += kPointerSize) { |
if ((i != JSArray::kElementsOffset) || (length == 0)) { |
@@ -342,7 +356,11 @@ static void GenerateFastCloneShallowArrayCommon( |
// Get hold of the elements array of the boilerplate and setup the |
// elements pointer in the resulting object. |
__ mov(ecx, FieldOperand(ecx, JSArray::kElementsOffset)); |
- __ lea(edx, Operand(eax, JSArray::kSize)); |
+ if (want_allocation_info) { |
+ __ lea(edx, Operand(eax, JSArray::kSize + AllocationSiteInfo::kSize)); |
+ } else { |
+ __ lea(edx, Operand(eax, JSArray::kSize)); |
+ } |
__ mov(FieldOperand(eax, JSArray::kElementsOffset), edx); |
// Copy the elements array. |
@@ -392,20 +410,30 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
FastCloneShallowArrayStub::Mode mode = mode_; |
// ecx is boilerplate object. |
+ bool want_allocation_info = false; |
+ if (mode == CLONE_ANY_ELEMENTS_WITH_ALLOCATION_INFO) { |
+ mode = CLONE_ANY_ELEMENTS; |
+ want_allocation_info = true; |
+ } |
+ |
if (mode == CLONE_ANY_ELEMENTS) { |
Label double_elements, check_fast_elements; |
__ mov(ebx, FieldOperand(ecx, JSArray::kElementsOffset)); |
__ CheckMap(ebx, factory->fixed_cow_array_map(), |
&check_fast_elements, DONT_DO_SMI_CHECK); |
GenerateFastCloneShallowArrayCommon(masm, 0, |
- COPY_ON_WRITE_ELEMENTS, &slow_case); |
+ COPY_ON_WRITE_ELEMENTS, |
+ want_allocation_info, |
+ &slow_case); |
__ ret(3 * kPointerSize); |
__ bind(&check_fast_elements); |
__ CheckMap(ebx, factory->fixed_array_map(), |
&double_elements, DONT_DO_SMI_CHECK); |
GenerateFastCloneShallowArrayCommon(masm, length_, |
- CLONE_ELEMENTS, &slow_case); |
+ CLONE_ELEMENTS, |
+ want_allocation_info, |
+ &slow_case); |
__ ret(3 * kPointerSize); |
__ bind(&double_elements); |
@@ -434,7 +462,8 @@ void FastCloneShallowArrayStub::Generate(MacroAssembler* masm) { |
__ pop(ecx); |
} |
- GenerateFastCloneShallowArrayCommon(masm, length_, mode, &slow_case); |
+ GenerateFastCloneShallowArrayCommon(masm, length_, mode, |
+ want_allocation_info, &slow_case); |
// Return and remove the on-stack parameters. |
__ ret(3 * kPointerSize); |