| Index: src/mips64/code-stubs-mips64.cc
|
| diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc
|
| index 708c974cdfc08bc7b4b5c6e74ba85d7b1bc7c88c..80c3c9d1bb723a8b44b528f9ffd957e67a1e3923 100644
|
| --- a/src/mips64/code-stubs-mips64.cc
|
| +++ b/src/mips64/code-stubs-mips64.cc
|
| @@ -1507,22 +1507,33 @@ void InstanceOfStub::Generate(MacroAssembler* masm) {
|
|
|
| // Loop through the prototype chain looking for the {function} prototype.
|
| // Assume true, and change to false if not found.
|
| - Register const object_prototype = object_map;
|
| + Register const object_instance_type = function_map;
|
| Register const null = scratch;
|
| - Label done, loop;
|
| - __ LoadRoot(v0, Heap::kTrueValueRootIndex);
|
| + Register const result = v0;
|
| + Label done, loop, proxy_case;
|
| + __ LoadRoot(result, Heap::kTrueValueRootIndex);
|
| __ LoadRoot(null, Heap::kNullValueRootIndex);
|
| __ bind(&loop);
|
| - __ ld(object_prototype, FieldMemOperand(object_map, Map::kPrototypeOffset));
|
| - __ Branch(&done, eq, object_prototype, Operand(function_prototype));
|
| - __ Branch(USE_DELAY_SLOT, &loop, ne, object_prototype, Operand(null));
|
| - __ ld(object_map, FieldMemOperand(object_prototype, HeapObject::kMapOffset));
|
| - __ LoadRoot(v0, Heap::kFalseValueRootIndex);
|
| + __ lbu(object_instance_type,
|
| + FieldMemOperand(object_map, Map::kInstanceTypeOffset));
|
| + __ Branch(&proxy_case, eq, object_instance_type, Operand(JS_PROXY_TYPE));
|
| + __ ld(object, FieldMemOperand(object_map, Map::kPrototypeOffset));
|
| + __ Branch(&done, eq, object, Operand(function_prototype));
|
| + __ Branch(USE_DELAY_SLOT, &loop, ne, object, Operand(null));
|
| + __ ld(object_map,
|
| + FieldMemOperand(object, HeapObject::kMapOffset)); // In delay slot.
|
| + __ LoadRoot(result, Heap::kFalseValueRootIndex);
|
| __ bind(&done);
|
| __ Ret(USE_DELAY_SLOT);
|
| - __ StoreRoot(v0, Heap::kInstanceofCacheAnswerRootIndex); // In delay slot.
|
| + __ StoreRoot(result,
|
| + Heap::kInstanceofCacheAnswerRootIndex); // In delay slot.
|
|
|
| - // Slow-case: Call the runtime function.
|
| + // Proxy-case: Call the %HasInPrototypeChain runtime function.
|
| + __ bind(&proxy_case);
|
| + __ Push(object, function_prototype);
|
| + __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
|
| +
|
| + // Slow-case: Call the %InstanceOf runtime function.
|
| __ bind(&slow_case);
|
| __ Push(object, function);
|
| __ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
|
|
|