Index: src/ia32/stub-cache-ia32.cc |
diff --git a/src/ia32/stub-cache-ia32.cc b/src/ia32/stub-cache-ia32.cc |
index 6d353c26701399381108a054d889c2db1129c9ad..f8e9d72aa2aeb94e8266ada6b9606f6b013ceaa0 100644 |
--- a/src/ia32/stub-cache-ia32.cc |
+++ b/src/ia32/stub-cache-ia32.cc |
@@ -327,28 +327,32 @@ void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, |
Register receiver, |
Register scratch1, |
Register scratch2, |
- Label* miss) { |
+ Label* miss, |
+ bool support_wrappers) { |
Label check_wrapper; |
// Check if the object is a string leaving the instance type in the |
// scratch register. |
- GenerateStringCheck(masm, receiver, scratch1, miss, &check_wrapper); |
+ GenerateStringCheck(masm, receiver, scratch1, miss, |
+ support_wrappers ? &check_wrapper : miss); |
// Load length from the string and convert to a smi. |
__ mov(eax, FieldOperand(receiver, String::kLengthOffset)); |
__ ret(0); |
- // Check if the object is a JSValue wrapper. |
- __ bind(&check_wrapper); |
- __ cmp(scratch1, JS_VALUE_TYPE); |
- __ j(not_equal, miss, not_taken); |
+ if (support_wrappers) { |
+ // Check if the object is a JSValue wrapper. |
+ __ bind(&check_wrapper); |
+ __ 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(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
- GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
- __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
- __ ret(0); |
+ // Check if the wrapped value is a string and load the length |
+ // directly if it is. |
+ __ mov(scratch2, FieldOperand(receiver, JSValue::kValueOffset)); |
+ GenerateStringCheck(masm, scratch2, scratch1, miss, miss); |
+ __ mov(eax, FieldOperand(scratch2, String::kLengthOffset)); |
+ __ ret(0); |
+ } |
} |
@@ -3089,7 +3093,7 @@ MaybeObject* KeyedLoadStubCompiler::CompileLoadStringLength(String* name) { |
__ cmp(Operand(eax), Immediate(Handle<String>(name))); |
__ j(not_equal, &miss, not_taken); |
- GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss); |
+ GenerateLoadStringLength(masm(), edx, ecx, ebx, &miss, true); |
__ bind(&miss); |
__ DecrementCounter(&Counters::keyed_load_string_length, 1); |
GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); |