Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(765)

Unified Diff: src/mips64/code-stubs-mips64.cc

Issue 1492243003: [proxies] InstanceOfStub should bailout to %HasInPrototypeChain for proxies. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix mips/mips64. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698