Index: src/ia32/ic-ia32.cc |
=================================================================== |
--- src/ia32/ic-ia32.cc (revision 4703) |
+++ src/ia32/ic-ia32.cc (working copy) |
@@ -304,7 +304,7 @@ |
// -- edx : receiver |
// -- esp[0] : return address |
// ----------------------------------- |
- Label slow, check_string, index_smi, index_string; |
+ Label slow, check_string, index_int, index_string; |
Label check_pixel_array, probe_dictionary; |
Label check_number_dictionary; |
@@ -329,17 +329,18 @@ |
// Check that the key is a smi. |
__ test(eax, Immediate(kSmiTagMask)); |
__ j(not_zero, &check_string, not_taken); |
+ __ mov(ebx, eax); |
+ __ SmiUntag(ebx); |
// Get the elements array of the object. |
- __ bind(&index_smi); |
+ __ bind(&index_int); |
__ mov(ecx, FieldOperand(edx, JSObject::kElementsOffset)); |
// Check that the object is in fast mode (not dictionary). |
__ CheckMap(ecx, Factory::fixed_array_map(), &check_pixel_array, true); |
// Check that the key (index) is within bounds. |
- __ cmp(eax, FieldOperand(ecx, FixedArray::kLengthOffset)); |
+ __ cmp(ebx, FieldOperand(ecx, FixedArray::kLengthOffset)); |
__ j(above_equal, &slow); |
// Fast case: Do the load. |
- ASSERT((kPointerSize == 4) && (kSmiTagSize == 1) && (kSmiTag == 0)); |
- __ mov(ecx, FieldOperand(ecx, eax, times_2, FixedArray::kHeaderSize)); |
+ __ mov(ecx, FieldOperand(ecx, ebx, times_4, FixedArray::kHeaderSize)); |
__ cmp(Operand(ecx), Immediate(Factory::the_hole_value())); |
// In case the loaded value is the_hole we have to consult GetProperty |
// to ensure the prototype chain is searched. |
@@ -351,10 +352,9 @@ |
__ bind(&check_pixel_array); |
// Check whether the elements is a pixel array. |
// edx: receiver |
+ // ebx: untagged index |
// eax: key |
// ecx: elements |
- __ mov(ebx, eax); |
- __ SmiUntag(ebx); |
__ CheckMap(ecx, Factory::pixel_array_map(), &check_number_dictionary, true); |
__ cmp(ebx, FieldOperand(ecx, PixelArray::kLengthOffset)); |
__ j(above_equal, &slow); |
@@ -485,13 +485,9 @@ |
ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
(1 << String::kArrayIndexValueBits)); |
__ bind(&index_string); |
- // We want the smi-tagged index in eax. kArrayIndexValueMask has zeros in |
- // the low kHashShift bits. |
- ASSERT(String::kHashShift >= kSmiTagSize); |
- __ and_(ebx, String::kArrayIndexValueMask); |
- __ shr(ebx, String::kHashShift - kSmiTagSize); |
- __ mov(eax, ebx); |
- __ jmp(&index_smi); |
+ __ and_(ebx, String::kArrayIndexHashMask); |
+ __ shr(ebx, String::kHashShift); |
+ __ jmp(&index_int); |
} |
@@ -796,7 +792,9 @@ |
__ mov(edi, FieldOperand(edx, JSObject::kElementsOffset)); |
// Check that the object is in fast mode (not dictionary). |
__ CheckMap(edi, Factory::fixed_array_map(), &check_pixel_array, true); |
- __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); |
+ __ mov(ebx, Operand(ecx)); |
+ __ SmiUntag(ebx); |
+ __ cmp(ebx, FieldOperand(edi, Array::kLengthOffset)); |
__ j(below, &fast, taken); |
// Slow case: call runtime. |
@@ -806,7 +804,7 @@ |
// Check whether the elements is a pixel array. |
__ bind(&check_pixel_array); |
// eax: value |
- // ecx: key (a smi) |
+ // ecx: key |
// edx: receiver |
// edi: elements array |
__ CheckMap(edi, Factory::pixel_array_map(), &slow, true); |
@@ -842,11 +840,13 @@ |
// edi: receiver->elements, a FixedArray |
// flags: compare (ecx, edx.length()) |
__ j(not_equal, &slow, not_taken); // do not leave holes in the array |
- __ cmp(ecx, FieldOperand(edi, FixedArray::kLengthOffset)); |
+ __ mov(ebx, ecx); |
+ __ SmiUntag(ebx); // untag |
+ __ cmp(ebx, FieldOperand(edi, Array::kLengthOffset)); |
__ j(above_equal, &slow, not_taken); |
// Add 1 to receiver->length, and go to fast array write. |
__ add(FieldOperand(edx, JSArray::kLengthOffset), |
- Immediate(Smi::FromInt(1))); |
+ Immediate(1 << kSmiTagSize)); |
__ jmp(&fast); |
// Array case: Get the length and the elements array from the JS |