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

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

Issue 1521953002: [proxies] fix access issue when having proxies on the prototype-chain of global objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: ppc code mess 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/deoptimizer.h ('k') | src/isolate.cc » ('j') | src/prototype.h » ('J')
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 6c7420e84f0c5635266a052ad3c5a6c83e83be3a..527800b80ede2bafb2efdc232c5b302cdc74df3d 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -2564,24 +2564,32 @@ void InstanceOfStub::Generate(MacroAssembler* masm) {
// Loop through the prototype chain looking for the {function} prototype.
// Assume true, and change to false if not found.
- Label done, loop, proxy_case;
+ Label done, loop, fast_runtime_fallback;
__ mov(eax, isolate()->factory()->true_value());
__ bind(&loop);
+
+ // Check if the object needs to be access checked.
+ __ test_b(FieldOperand(object_map, Map::kBitFieldOffset),
+ 1 << Map::kIsAccessCheckNeeded);
+ __ j(not_zero, &fast_runtime_fallback, Label::kNear);
+ // Check if the current object is a Proxy.
__ CmpInstanceType(object_map, JS_PROXY_TYPE);
- __ j(equal, &proxy_case, Label::kNear);
+ __ j(equal, &fast_runtime_fallback, Label::kNear);
+
__ mov(object, FieldOperand(object_map, Map::kPrototypeOffset));
__ cmp(object, function_prototype);
__ j(equal, &done, Label::kNear);
- __ cmp(object, isolate()->factory()->null_value());
__ mov(object_map, FieldOperand(object, HeapObject::kMapOffset));
+ __ cmp(object, isolate()->factory()->null_value());
__ j(not_equal, &loop);
__ mov(eax, isolate()->factory()->false_value());
+
__ bind(&done);
__ StoreRoot(eax, scratch, Heap::kInstanceofCacheAnswerRootIndex);
__ ret(0);
- // Proxy-case: Call the %HasInPrototypeChain runtime function.
- __ bind(&proxy_case);
+ // Found Proxy or access check needed: Call the runtime.
+ __ bind(&fast_runtime_fallback);
__ PopReturnAddressTo(scratch);
__ Push(object);
__ Push(function_prototype);
« no previous file with comments | « src/deoptimizer.h ('k') | src/isolate.cc » ('j') | src/prototype.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698