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

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

Issue 1516843002: [proxy] fixing harmony/proxy.js tests and improving error messages + some drive-by fixes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP fix protoype walks with access checks 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
Index: src/ia32/code-stubs-ia32.cc
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc
index 817b71dc60d9c4bb72bd807f755bf8df2ae69331..3e12f6c63b6c31639a68f08b34b0e79f271e0ef0 100644
--- a/src/ia32/code-stubs-ia32.cc
+++ b/src/ia32/code-stubs-ia32.cc
@@ -2564,22 +2564,38 @@ 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, proxy_case, global_object_case;
__ mov(eax, isolate()->factory()->true_value());
__ bind(&loop);
+ __ CmpInstanceType(object_map, JS_GLOBAL_OBJECT_TYPE);
+ __ j(equal, &global_object_case);
+ __ CmpInstanceType(object_map, JS_GLOBAL_PROXY_TYPE);
+ __ j(equal, &global_object_case);
__ 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, 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);
+ // Global object needs access checks, jump to the runtime.
+ __ bind(&global_object_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);
+
// Proxy-case: Call the %HasInPrototypeChain runtime function.
__ bind(&proxy_case);
__ PopReturnAddressTo(scratch);

Powered by Google App Engine
This is Rietveld 408576698