Chromium Code Reviews| Index: src/arm/code-stubs-arm.cc |
| =================================================================== |
| --- src/arm/code-stubs-arm.cc (revision 6115) |
| +++ src/arm/code-stubs-arm.cc (working copy) |
| @@ -2894,45 +2894,45 @@ |
| // Uses registers r0 to r4. Expected input is |
| -// function in r0 (or at sp+1*ptrsz) and object in |
| +// object in r0 (or at sp+1*ptrsz) and function in |
|
Vyacheslav Egorov (Chromium)
2010/12/23 15:49:09
ptrsz => kPointerSize ?
Karl Klose
2010/12/23 16:15:46
Done.
|
| // r1 (or at sp), depending on whether or not |
| // args_in_registers() is true. |
| void InstanceofStub::Generate(MacroAssembler* masm) { |
| // Fixed register usage throughout the stub: |
| - const Register object = r1; // Object (lhs). |
| + const Register object = r0; // Object (lhs). |
| const Register map = r3; // Map of the object. |
| - const Register function = r0; // Function (rhs). |
| + const Register function = r1; // Function (rhs). |
| const Register prototype = r4; // Prototype of the function. |
| const Register scratch = r2; |
| Label slow, loop, is_instance, is_not_instance, not_js_object; |
| if (!args_in_registers()) { |
| - __ ldr(function, MemOperand(sp, 1 * kPointerSize)); |
| - __ ldr(object, MemOperand(sp, 0)); |
| + __ ldr(object, MemOperand(sp, 1 * kPointerSize)); |
| + __ ldr(function, MemOperand(sp, 0)); |
| } |
| // Check that the left hand is a JS object and load map. |
| - __ BranchOnSmi(object, &slow); |
| - __ IsObjectJSObjectType(object, map, scratch, &slow); |
| + __ BranchOnSmi(object, ¬_js_object); |
| + __ IsObjectJSObjectType(object, map, scratch, ¬_js_object); |
| // Look up the function and the map in the instanceof cache. |
| Label miss; |
| __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex); |
| - __ cmp(object, ip); |
| + __ cmp(function, ip); |
| __ b(ne, &miss); |
| __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex); |
| __ cmp(map, ip); |
| __ b(ne, &miss); |
| - __ LoadRoot(function, Heap::kInstanceofCacheAnswerRootIndex); |
| + __ LoadRoot(object, Heap::kInstanceofCacheAnswerRootIndex); |
|
Vyacheslav Egorov (Chromium)
2010/12/23 15:49:09
r0 instead of object to reduce confusion
Karl Klose
2010/12/23 16:15:46
Done.
|
| __ Ret(args_in_registers() ? 0 : 2); |
| __ bind(&miss); |
| - __ TryGetFunctionPrototype(object, prototype, scratch, &slow); |
| + __ TryGetFunctionPrototype(function, prototype, scratch, &slow); |
| // Check that the function prototype is a JS object. |
| __ BranchOnSmi(prototype, &slow); |
| __ IsObjectJSObjectType(prototype, scratch, scratch, &slow); |
| - __ StoreRoot(object, Heap::kInstanceofCacheFunctionRootIndex); |
| + __ StoreRoot(function, Heap::kInstanceofCacheFunctionRootIndex); |
| __ StoreRoot(map, Heap::kInstanceofCacheMapRootIndex); |
| // Register mapping: r3 is object map and r4 is function prototype. |
| @@ -2957,6 +2957,7 @@ |
| __ bind(&is_not_instance); |
| __ mov(r0, Operand(Smi::FromInt(1))); |
| + __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
| __ Ret(args_in_registers() ? 0 : 2); |
| Label object_not_null, object_not_null_or_smi; |
| @@ -2986,6 +2987,10 @@ |
| __ Ret(args_in_registers() ? 0 : 2); |
| // Slow-case. Tail call builtin. |
| + if (args_in_registers()) { |
| + __ push(r0); |
|
Vyacheslav Egorov (Chromium)
2010/12/23 15:49:09
__ Push(r0, r1);
?
Karl Klose
2010/12/23 16:15:46
Done.
|
| + __ push(r1); |
| + } |
| __ bind(&slow); |
| __ InvokeBuiltin(Builtins::INSTANCE_OF, JUMP_JS); |
| } |