From: ager@chromium.org Date: Tue, 28 Oct 2008 10:25:35 +0000 (+0000) Subject: In my final round of refactoring, I accidentally broke my string X-Git-Tag: upstream/4.7.83~25097 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b595d914a84fe821f6c9fcacc9d55350eda6727f;p=platform%2Fupstream%2Fv8.git In my final round of refactoring, I accidentally broke my string lenght optimization. Here is the fix: check that the instance type not the receiver is JS_VALUE_TYPE. Review URL: http://codereview.chromium.org/8656 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@622 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/ic-arm.cc b/src/ic-arm.cc index bdb3b76..ccaf277 100644 --- a/src/ic-arm.cc +++ b/src/ic-arm.cc @@ -190,7 +190,8 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { __ ldr(r0, MemOperand(sp, 0)); - // Check if the object is a string. + // Check if the object is a string leaving the instance type in the + // r1 register. GenerateStringCheck(masm, r0, r1, r3, &miss, &check_wrapper); // Load length directly from the string. @@ -204,7 +205,7 @@ void LoadIC::GenerateStringLength(MacroAssembler* masm) { // Check if the object is a JSValue wrapper. __ bind(&check_wrapper); - __ cmp(r0, Operand(JS_VALUE_TYPE)); + __ cmp(r1, Operand(JS_VALUE_TYPE)); __ b(ne, &miss); // Check if the wrapped value is a string and load the length diff --git a/src/stub-cache-ia32.cc b/src/stub-cache-ia32.cc index f59ed57..66e12d4 100644 --- a/src/stub-cache-ia32.cc +++ b/src/stub-cache-ia32.cc @@ -185,7 +185,8 @@ void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, Label* miss) { Label load_length, check_wrapper; - // Check if the object is a string. + // Check if the object is a string leaving the instance type in the + // scratch register. GenerateStringCheck(masm, receiver, scratch, miss, &check_wrapper); // Load length directly from the string. @@ -200,7 +201,7 @@ void StubCompiler::GenerateLoadStringLength(MacroAssembler* masm, // Check if the object is a JSValue wrapper. __ bind(&check_wrapper); - __ cmp(receiver, JS_VALUE_TYPE); + __ cmp(scratch, JS_VALUE_TYPE); __ j(not_equal, miss, not_taken); // Check if the wrapped value is a string and load the length