Index: src/x64/builtins-x64.cc |
=================================================================== |
--- src/x64/builtins-x64.cc (revision 4686) |
+++ src/x64/builtins-x64.cc (working copy) |
@@ -308,8 +308,7 @@ |
// (tail-call) to the code in register edx without checking arguments. |
__ movq(rdx, FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
__ movsxlq(rbx, |
- FieldOperand(rdx, |
- SharedFunctionInfo::kFormalParameterCountOffset)); |
+ FieldOperand(rdx, SharedFunctionInfo::kFormalParameterCountOffset)); |
__ movq(rdx, FieldOperand(rdx, SharedFunctionInfo::kCodeOffset)); |
__ lea(rdx, FieldOperand(rdx, Code::kHeaderSize)); |
__ cmpq(rax, rbx); |
@@ -526,15 +525,15 @@ |
__ lea(scratch1, Operand(result, JSArray::kSize)); |
__ movq(FieldOperand(result, JSArray::kElementsOffset), scratch1); |
- // Initialize the FixedArray and fill it with holes. FixedArray length is |
+ // Initialize the FixedArray and fill it with holes. FixedArray length is not |
// stored as a smi. |
// result: JSObject |
// scratch1: elements array |
// scratch2: start of next object |
- __ Move(FieldOperand(scratch1, HeapObject::kMapOffset), |
+ __ Move(FieldOperand(scratch1, JSObject::kMapOffset), |
Factory::fixed_array_map()); |
- __ Move(FieldOperand(scratch1, FixedArray::kLengthOffset), |
- Smi::FromInt(initial_capacity)); |
+ __ movq(FieldOperand(scratch1, Array::kLengthOffset), |
+ Immediate(initial_capacity)); |
// Fill the FixedArray with the hole value. Inline the code if short. |
// Reconsider loop unfolding if kPreallocatedArrayElements gets changed. |
@@ -588,6 +587,7 @@ |
JSFunction::kPrototypeOrInitialMapOffset)); |
// Check whether an empty sized array is requested. |
+ __ SmiToInteger64(array_size, array_size); |
__ testq(array_size, array_size); |
__ j(not_zero, ¬_empty); |
@@ -605,11 +605,10 @@ |
// Allocate the JSArray object together with space for a FixedArray with the |
// requested elements. |
__ bind(¬_empty); |
- SmiIndex index = |
- masm->SmiToIndex(kScratchRegister, array_size, kPointerSizeLog2); |
+ ASSERT(kSmiTagSize == 1 && kSmiTag == 0); |
__ AllocateInNewSpace(JSArray::kSize + FixedArray::kHeaderSize, |
- index.scale, |
- index.reg, |
+ times_pointer_size, |
+ array_size, |
result, |
elements_array_end, |
scratch, |
@@ -621,41 +620,43 @@ |
// result: JSObject |
// elements_array: initial map |
// elements_array_end: start of next object |
- // array_size: size of array (smi) |
+ // array_size: size of array |
__ bind(&allocated); |
__ movq(FieldOperand(result, JSObject::kMapOffset), elements_array); |
__ Move(elements_array, Factory::empty_fixed_array()); |
__ movq(FieldOperand(result, JSArray::kPropertiesOffset), elements_array); |
// Field JSArray::kElementsOffset is initialized later. |
- __ movq(FieldOperand(result, JSArray::kLengthOffset), array_size); |
+ __ Integer32ToSmi(scratch, array_size); |
+ __ movq(FieldOperand(result, JSArray::kLengthOffset), scratch); |
// Calculate the location of the elements array and set elements array member |
// of the JSArray. |
// result: JSObject |
// elements_array_end: start of next object |
- // array_size: size of array (smi) |
+ // array_size: size of array |
__ lea(elements_array, Operand(result, JSArray::kSize)); |
__ movq(FieldOperand(result, JSArray::kElementsOffset), elements_array); |
- // Initialize the fixed array. FixedArray length is stored as a smi. |
+ // Initialize the fixed array. FixedArray length is not stored as a smi. |
// result: JSObject |
// elements_array: elements array |
// elements_array_end: start of next object |
- // array_size: size of array (smi) |
+ // array_size: size of array |
+ ASSERT(kSmiTag == 0); |
__ Move(FieldOperand(elements_array, JSObject::kMapOffset), |
Factory::fixed_array_map()); |
Label not_empty_2, fill_array; |
- __ SmiTest(array_size); |
+ __ testq(array_size, array_size); |
__ j(not_zero, ¬_empty_2); |
// Length of the FixedArray is the number of pre-allocated elements even |
// though the actual JSArray has length 0. |
- __ Move(FieldOperand(elements_array, FixedArray::kLengthOffset), |
- Smi::FromInt(kPreallocatedArrayElements)); |
+ __ movq(FieldOperand(elements_array, Array::kLengthOffset), |
+ Immediate(kPreallocatedArrayElements)); |
__ jmp(&fill_array); |
__ bind(¬_empty_2); |
// For non-empty JSArrays the length of the FixedArray and the JSArray is the |
// same. |
- __ movq(FieldOperand(elements_array, FixedArray::kLengthOffset), array_size); |
+ __ movq(FieldOperand(elements_array, Array::kLengthOffset), array_size); |
// Fill the allocated FixedArray with the hole value if requested. |
// result: JSObject |
@@ -1038,9 +1039,8 @@ |
// rdx: number of elements |
// rax: start of next object |
__ LoadRoot(rcx, Heap::kFixedArrayMapRootIndex); |
- __ movq(Operand(rdi, HeapObject::kMapOffset), rcx); // setup the map |
- __ Integer32ToSmi(rdx, rdx); |
- __ movq(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length |
+ __ movq(Operand(rdi, JSObject::kMapOffset), rcx); // setup the map |
+ __ movl(Operand(rdi, FixedArray::kLengthOffset), rdx); // and length |
// Initialize the fields to undefined. |
// rbx: JSObject |