| Index: src/arm/code-stubs-arm.cc
|
| ===================================================================
|
| --- src/arm/code-stubs-arm.cc (revision 9686)
|
| +++ src/arm/code-stubs-arm.cc (working copy)
|
| @@ -1434,11 +1434,16 @@
|
| __ LoadRoot(number_string_cache, Heap::kNumberStringCacheRootIndex);
|
|
|
| // Make the hash mask from the length of the number string cache. It
|
| - // contains two elements (number and string) for each cache entry.
|
| + // contains three elements (number, string and age) for each cache entry.
|
| __ ldr(mask, FieldMemOperand(number_string_cache, FixedArray::kLengthOffset));
|
| - // Divide length by two (length is a smi).
|
| - __ mov(mask, Operand(mask, ASR, kSmiTagSize + 1));
|
| - __ sub(mask, mask, Operand(1)); // Make mask.
|
| + STATIC_ASSERT(Heap::kNSCSlotsPerEntry == 3);
|
| + // Multiply mask by 2/3, making it a power of 2.
|
| + __ and_(mask, mask, Operand(mask, LSL, 1));
|
| + // Make mask. It is 4 times the number of entries (2 times for Smi tag,
|
| + // 2 times for the size of the array * 2/3).
|
| + STATIC_ASSERT(kSmiTagSize == 1);
|
| + STATIC_ASSERT(kPointerSize == 4);
|
| + __ sub(mask, mask, Operand(kPointerSize - 1));
|
|
|
| // Calculate the entry in the number string cache. The hash value in the
|
| // number string cache for smis is just the smi value, and the hash for
|
| @@ -1447,6 +1452,12 @@
|
| Isolate* isolate = masm->isolate();
|
| Label is_smi;
|
| Label load_result_from_cache;
|
| + const int kNumberOffset =
|
| + FixedArray::kHeaderSize + kPointerSize * Heap::kNSCNumberOffset;
|
| + const int kStringOffset =
|
| + FixedArray::kHeaderSize + kPointerSize * Heap::kNSCStringOffset;
|
| + const int kAgeOffset =
|
| + FixedArray::kHeaderSize + kPointerSize * Heap::kNSCAgeOffset;
|
| if (!object_is_smi) {
|
| __ JumpIfSmi(object, &is_smi);
|
| if (CpuFeatures::IsSupported(VFP3)) {
|
| @@ -1463,17 +1474,15 @@
|
| Operand(HeapNumber::kValueOffset - kHeapObjectTag));
|
| __ ldm(ia, scratch1, scratch1.bit() | scratch2.bit());
|
| __ eor(scratch1, scratch1, Operand(scratch2));
|
| - __ and_(scratch1, scratch1, Operand(mask));
|
| + __ and_(scratch1, mask, Operand(scratch1, LSL, kPointerSizeLog2));
|
|
|
| // Calculate address of entry in string cache: each entry consists
|
| - // of two pointer sized fields.
|
| - __ add(scratch1,
|
| - number_string_cache,
|
| - Operand(scratch1, LSL, kPointerSizeLog2 + 1));
|
| + // of three pointer sized fields, so we multiply by 3.
|
| + __ add(scratch1, scratch1, Operand(scratch1, LSL, 1));
|
| + __ add(scratch1, scratch1, number_string_cache);
|
|
|
| Register probe = mask;
|
| - __ ldr(probe,
|
| - FieldMemOperand(scratch1, FixedArray::kHeaderSize));
|
| + __ ldr(probe, FieldMemOperand(scratch1, kNumberOffset));
|
| __ JumpIfSmi(probe, not_found);
|
| __ sub(scratch2, object, Operand(kHeapObjectTag));
|
| __ vldr(d0, scratch2, HeapNumber::kValueOffset);
|
| @@ -1488,24 +1497,24 @@
|
| }
|
|
|
| __ bind(&is_smi);
|
| - Register scratch = scratch1;
|
| - __ and_(scratch, mask, Operand(object, ASR, 1));
|
| + STATIC_ASSERT(kSmiTag == 0);
|
| + __ and_(scratch1, mask, Operand(object, LSL, kPointerSizeLog2 - kSmiTagSize));
|
| // Calculate address of entry in string cache: each entry consists
|
| - // of two pointer sized fields.
|
| - __ add(scratch,
|
| - number_string_cache,
|
| - Operand(scratch, LSL, kPointerSizeLog2 + 1));
|
| + // of three pointer sized fields, so we multiply by 3.
|
| + __ add(scratch1, scratch1, Operand(scratch1, LSL, 1));
|
| + __ add(scratch1, scratch1, number_string_cache);
|
|
|
| // Check if the entry is the smi we are looking for.
|
| Register probe = mask;
|
| - __ ldr(probe, FieldMemOperand(scratch, FixedArray::kHeaderSize));
|
| + __ ldr(probe, FieldMemOperand(scratch1, kNumberOffset));
|
| __ cmp(object, probe);
|
| __ b(ne, not_found);
|
|
|
| // Get the result from the cache.
|
| __ bind(&load_result_from_cache);
|
| - __ ldr(result,
|
| - FieldMemOperand(scratch, FixedArray::kHeaderSize + kPointerSize));
|
| + __ mov(ip, Operand(Smi::FromInt(Heap::kNSCMinAge)));
|
| + __ str(ip, FieldMemOperand(scratch1, kAgeOffset));
|
| + __ ldr(result, FieldMemOperand(scratch1, kStringOffset));
|
| __ IncrementCounter(isolate->counters()->number_to_string_native(),
|
| 1,
|
| scratch1,
|
|
|