Index: src/arm/codegen-arm.cc |
=================================================================== |
--- src/arm/codegen-arm.cc (revision 4568) |
+++ src/arm/codegen-arm.cc (working copy) |
@@ -7926,6 +7926,22 @@ |
// Get the prototype of the function (r4 is result, r2 is scratch). |
__ ldr(r1, MemOperand(sp, 0)); |
+ // r1 is function, r3 is map. |
+ |
+ // Look up the function and the map in the instanceof cache. |
+ Label miss; |
+ __ LoadRoot(ip, Heap::kInstanceofCacheFunctionRootIndex); |
+ __ cmp(r1, ip); |
+ __ b(ne, &miss); |
+ __ LoadRoot(ip, Heap::kInstanceofCacheMapRootIndex); |
+ __ cmp(r3, ip); |
+ __ b(ne, &miss); |
+ __ LoadRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
+ __ pop(); |
+ __ pop(); |
+ __ mov(pc, Operand(lr)); |
+ |
+ __ bind(&miss); |
__ TryGetFunctionPrototype(r1, r4, r2, &slow); |
// Check that the function prototype is a JS object. |
@@ -7935,6 +7951,9 @@ |
__ cmp(r5, Operand(LAST_JS_OBJECT_TYPE)); |
__ b(gt, &slow); |
+ __ StoreRoot(r1, Heap::kInstanceofCacheFunctionRootIndex); |
+ __ StoreRoot(r3, Heap::kInstanceofCacheMapRootIndex); |
+ |
// Register mapping: r3 is object map and r4 is function prototype. |
// Get prototype of object into r2. |
__ ldr(r2, FieldMemOperand(r3, Map::kPrototypeOffset)); |
@@ -7952,12 +7971,14 @@ |
__ bind(&is_instance); |
__ mov(r0, Operand(Smi::FromInt(0))); |
+ __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
__ pop(); |
__ pop(); |
__ mov(pc, Operand(lr)); // Return. |
__ bind(&is_not_instance); |
__ mov(r0, Operand(Smi::FromInt(1))); |
+ __ StoreRoot(r0, Heap::kInstanceofCacheAnswerRootIndex); |
__ pop(); |
__ pop(); |
__ mov(pc, Operand(lr)); // Return. |