diff --git a/src/arm/ic-arm.cc b/src/arm/ic-arm.cc index 49aa340c45..79263090db 100644 --- a/src/arm/ic-arm.cc +++ b/src/arm/ic-arm.cc @@ -190,7 +190,7 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { __ ldr(r0, MemOperand(sp, 0)); - StubCompiler::GenerateLoadStringLength2(masm, r0, r1, r3, &miss); + StubCompiler::GenerateLoadStringLength(masm, r0, r1, r3, &miss); // Cache miss: Jump to runtime. __ bind(&miss); StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); diff --git a/src/arm/stub-cache-arm.cc b/src/arm/stub-cache-arm.cc index d19a683dc8..4e4a8a939c 100644 --- a/src/arm/stub-cache-arm.cc +++ b/src/arm/stub-cache-arm.cc @@ -215,11 +215,11 @@ static void GenerateStringCheck(MacroAssembler* masm, // If the receiver object is not a string or a wrapped string object the // execution continues at the miss label. The register containing the // receiver is potentially clobbered. -void StubCompiler::GenerateLoadStringLength2(MacroAssembler* masm, - Register receiver, - Register scratch1, - Register scratch2, - Label* miss) { +void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, + Register receiver, + Register scratch1, + Register scratch2, + Label* miss) { Label check_string, check_wrapper; __ bind(&check_string); @@ -1672,7 +1672,7 @@ Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { __ cmp(r2, Operand(Handle(name))); __ b(ne, &miss); - GenerateLoadStringLength2(masm(), r0, r1, r3, &miss); + GenerateLoadStringLength(masm(), r0, r1, r3, &miss); __ bind(&miss); __ DecrementCounter(&Counters::keyed_load_string_length, 1, r1, r3); diff --git a/src/ia32/ic-ia32.cc b/src/ia32/ic-ia32.cc index 06752a8aa8..db83ddea15 100644 --- a/src/ia32/ic-ia32.cc +++ b/src/ia32/ic-ia32.cc @@ -200,7 +200,7 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { __ mov(eax, Operand(esp, kPointerSize)); - StubCompiler::GenerateLoadStringLength(masm, eax, edx, &miss); + StubCompiler::GenerateLoadStringLength(masm, eax, edx, ebx, &miss); __ bind(&miss); StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); } diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc index 7acf81c949..d80baf5c3e 100644 --- a/src/ia32/stub-cache-ia32.cc +++ b/src/ia32/stub-cache-ia32.cc @@ -226,13 +226,14 @@ static void GenerateStringCheck(MacroAssembler* masm, void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, Register receiver, - Register scratch, + Register scratch1, + Register scratch2, Label* miss) { Label load_length, check_wrapper; // Check if the object is a string leaving the instance type in the // scratch register. - GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); + GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); // Load length from the string and convert to a smi. __ bind(&load_length); @@ -242,13 +243,13 @@ void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, // Check if the object is a JSValue wrapper. __ bind(&check_wrapper); - __ cmp(scratch, JS_VALUE_TYPE); + __ cmp(scratch1, JS_VALUE_TYPE); __ j(not_equal, miss, not_taken); // Check if the wrapped value is a string and load the length // directly if it is. - __ mov(receiver, FieldOperand(receiver, JSValue::kValueOffset)); - GenerateStringCheck(masm, receiver, scratch, miss, miss); + __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); + GenerateStringCheck(masm, scratch2, scratch1, miss, miss); __ jmp(&load_length); } @@ -1773,7 +1774,7 @@ Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { __ cmp(Operand(eax), Immediate(Handle(name))); __ j(not_equal, &miss, not_taken); - GenerateLoadStringLength(masm(), ecx, edx, &miss); + GenerateLoadStringLength(masm(), ecx, edx, ebx, &miss); __ bind(&miss); __ DecrementCounter(&Counters::keyed_load_string_length, 1); GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); diff --git a/src/stub-cache.h b/src/stub-cache.h index d97fe7732c..27d94d1c47 100644 --- a/src/stub-cache.h +++ b/src/stub-cache.h @@ -355,10 +355,6 @@ class StubCompiler BASE_EMBEDDED { Register scratch, Label* miss_label); static void GenerateLoadStringLength(MacroAssembler* masm, - Register receiver, - Register scratch, - Label* miss_label); - static void GenerateLoadStringLength2(MacroAssembler* masm, Register receiver, Register scratch1, Register scratch2, diff --git a/src/x64/ic-x64.cc b/src/x64/ic-x64.cc index 3ae7f90684..115d70dfa1 100644 --- a/src/x64/ic-x64.cc +++ b/src/x64/ic-x64.cc @@ -1302,7 +1302,7 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { __ movq(rax, Operand(rsp, kPointerSize)); - StubCompiler::GenerateLoadStringLength(masm, rax, rdx, &miss); + StubCompiler::GenerateLoadStringLength(masm, rax, rdx, rbx, &miss); __ bind(&miss); StubCompiler::GenerateLoadMiss(masm, Code::LOAD_IC); } diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc index 693447b5c2..0455ff44b7 100644 --- a/src/x64/stub-cache-x64.cc +++ b/src/x64/stub-cache-x64.cc @@ -314,13 +314,14 @@ static void GenerateStringCheck(MacroAssembler* masm, void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, Register receiver, - Register scratch, + Register scratch1, + Register scratch2, Label* miss) { Label load_length, check_wrapper; // Check if the object is a string leaving the instance type in the // scratch register. - GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); + GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); // Load length directly from the string. __ bind(&load_length); @@ -330,13 +331,14 @@ void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, // Check if the object is a JSValue wrapper. __ bind(&check_wrapper); - __ cmpl(scratch, Immediate(JS_VALUE_TYPE)); + __ cmpl(scratch1, Immediate(JS_VALUE_TYPE)); __ j(not_equal, miss); // Check if the wrapped value is a string and load the length // directly if it is. - __ movq(receiver, FieldOperand(receiver, JSValue::kValueOffset)); - GenerateStringCheck(masm, receiver, scratch, miss, miss); + __ movq(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); + GenerateStringCheck(masm, scratch2, scratch1, miss, miss); + __ movq(receiver, scratch2); __ jmp(&load_length); } @@ -1325,7 +1327,7 @@ Object* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { __ Cmp(rax, Handle(name)); __ j(not_equal, &miss); - GenerateLoadStringLength(masm(), rcx, rdx, &miss); + GenerateLoadStringLength(masm(), rcx, rdx, rbx, &miss); __ bind(&miss); __ DecrementCounter(&Counters::keyed_load_string_length, 1); GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);