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

Unified Diff: src/ia32/code-stubs-ia32.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/arm64/macro-assembler-arm64.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index cf9ee30c817880f708f1c0c994366d1d744fe871..d4ec23c7c0a49ff0f6547bf36175d695231281d1 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -2588,27 +2588,39 @@ 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;
- Label done, loop;
+ Label done, loop, proxy_case;
__ mov(eax, isolate()->factory()->true_value());
__ bind(&loop);
- __ mov(object_prototype, FieldOperand(object_map, Map::kPrototypeOffset));
- __ cmp(object_prototype, function_prototype);
+ __ CmpInstanceType(object_map, JS_PROXY_TYPE);
+ __ j(equal, &proxy_case, Label::kNear);
+ __ mov(object, FieldOperand(object_map, Map::kPrototypeOffset));
+ __ cmp(object, function_prototype);
__ j(equal, &done, Label::kNear);
- __ cmp(object_prototype, isolate()->factory()->null_value());
- __ mov(object_map, FieldOperand(object_prototype, HeapObject::kMapOffset));
+ __ cmp(object, isolate()->factory()->null_value());
+ __ mov(object_map, FieldOperand(object, HeapObject::kMapOffset));
__ j(not_equal, &loop);
__ mov(eax, isolate()->factory()->false_value());
__ bind(&done);
__ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex);
__ ret(0);
- // Slow-case: Call the runtime function.
+ // Proxy-case: Call the %HasInPrototypeChain runtime function.
+ __ bind(&proxy_case);
+ __ PopReturnAddressTo(scratch);
+ __ Push(object);
+ __ Push(function_prototype);
+ __ PushReturnAddressFrom(scratch);
+ // Invalidate the instanceof cache.
+ __ Move(eax, Immediate(Smi::FromInt(0)));
+ __ StoreRoot(eax, scratch, Heap::kInstanceofCacheFunctionRootIndex);
+ __ TailCallRuntime(Runtime::kHasInPrototypeChain, 2, 1);
+
+ // Slow-case: Call the %InstanceOf runtime function.
__ bind(&slow_case);
- __ pop(scratch); // Pop return address.
- __ push(object); // Push {object}.
- __ push(function); // Push {function}.
- __ push(scratch); // Push return address.
+ __ PopReturnAddressTo(scratch);
+ __ Push(object);
+ __ Push(function);
+ __ PushReturnAddressFrom(scratch);
__ TailCallRuntime(Runtime::kInstanceOf, 2, 1);
}
« no previous file with comments | « src/arm64/macro-assembler-arm64.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698