Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index a2016242687e9aab5fe2a67408d1db13f2804a55..6338d74f381c004bc041c7467ee9e6f652dd9d46 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -2909,96 +2909,6 @@ void RegExpConstructResultStub::Generate(MacroAssembler* masm) { |
} |
-void NumberToStringStub::GenerateLookupNumberStringCache(MacroAssembler* masm, |
- Register object, |
- Register result, |
- Register scratch1, |
- Register scratch2, |
- Label* not_found) { |
- // Use of registers. Register result is used as a temporary. |
- Register number_string_cache = result; |
- Register mask = scratch1; |
- Register scratch = scratch2; |
- |
- // Load the number string cache. |
- __ 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. |
- __ SmiToInteger32( |
- mask, FieldOperand(number_string_cache, FixedArray::kLengthOffset)); |
- __ shrl(mask, Immediate(1)); |
- __ subq(mask, Immediate(1)); // Make mask. |
- |
- // 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 |
- // doubles is the xor of the upper and lower words. See |
- // Heap::GetNumberStringCache. |
- Label is_smi; |
- Label load_result_from_cache; |
- Factory* factory = masm->isolate()->factory(); |
- __ JumpIfSmi(object, &is_smi); |
- __ CheckMap(object, |
- factory->heap_number_map(), |
- not_found, |
- DONT_DO_SMI_CHECK); |
- |
- STATIC_ASSERT(8 == kDoubleSize); |
- __ movl(scratch, FieldOperand(object, HeapNumber::kValueOffset + 4)); |
- __ xor_(scratch, FieldOperand(object, HeapNumber::kValueOffset)); |
- GenerateConvertHashCodeToIndex(masm, scratch, mask); |
- |
- Register index = scratch; |
- Register probe = mask; |
- __ movq(probe, |
- FieldOperand(number_string_cache, |
- index, |
- times_1, |
- FixedArray::kHeaderSize)); |
- __ JumpIfSmi(probe, not_found); |
- __ movsd(xmm0, FieldOperand(object, HeapNumber::kValueOffset)); |
- __ movsd(xmm1, FieldOperand(probe, HeapNumber::kValueOffset)); |
- __ ucomisd(xmm0, xmm1); |
- __ j(parity_even, not_found); // Bail out if NaN is involved. |
- __ j(not_equal, not_found); // The cache did not contain this value. |
- __ jmp(&load_result_from_cache); |
- |
- __ bind(&is_smi); |
- __ SmiToInteger32(scratch, object); |
- GenerateConvertHashCodeToIndex(masm, scratch, mask); |
- |
- // Check if the entry is the smi we are looking for. |
- __ cmpq(object, |
- FieldOperand(number_string_cache, |
- index, |
- times_1, |
- FixedArray::kHeaderSize)); |
- __ j(not_equal, not_found); |
- |
- // Get the result from the cache. |
- __ bind(&load_result_from_cache); |
- __ movq(result, |
- FieldOperand(number_string_cache, |
- index, |
- times_1, |
- FixedArray::kHeaderSize + kPointerSize)); |
- Counters* counters = masm->isolate()->counters(); |
- __ IncrementCounter(counters->number_to_string_native(), 1); |
-} |
- |
- |
-void NumberToStringStub::GenerateConvertHashCodeToIndex(MacroAssembler* masm, |
- Register hash, |
- Register mask) { |
- __ and_(hash, mask); |
- // Each entry in string cache consists of two pointer sized fields, |
- // but times_twice_pointer_size (multiplication by 16) scale factor |
- // is not supported by addrmode on x64 platform. |
- // So we have to premultiply entry index before lookup. |
- __ shl(hash, Immediate(kPointerSizeLog2 + 1)); |
-} |
- |
- |
void NumberToStringStub::Generate(MacroAssembler* masm) { |
Label runtime; |
@@ -3006,7 +2916,7 @@ void NumberToStringStub::Generate(MacroAssembler* masm) { |
__ movq(rbx, args.GetArgumentOperand(0)); |
// Generate code to lookup number in the number string cache. |
- GenerateLookupNumberStringCache(masm, rbx, rax, r8, r9, &runtime); |
+ __ LookupNumberStringCache(rbx, rax, r8, r9, &runtime); |
__ ret(1 * kPointerSize); |
__ bind(&runtime); |
@@ -4646,12 +4556,7 @@ void StringAddStub::GenerateConvertArgument(MacroAssembler* masm, |
// Check the number to string cache. |
__ bind(¬_string); |
// Puts the cached result into scratch1. |
- NumberToStringStub::GenerateLookupNumberStringCache(masm, |
- arg, |
- scratch1, |
- scratch2, |
- scratch3, |
- slow); |
+ __ LookupNumberStringCache(arg, scratch1, scratch2, scratch3, slow); |
__ movq(arg, scratch1); |
__ movq(Operand(rsp, stack_offset), arg); |
__ bind(&done); |