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

Unified Diff: src/objects-inl.h

Issue 1402973002: Move some code from Runtime_GetPrototype into a new Object::GetPrototype. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 5 years, 2 months 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/objects.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 3bda179712b010834977212ceffa36772927a94a..11b40674b241ccd69b2a47bb6da8cf0f70db3d0e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -1199,15 +1199,22 @@ MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object,
}
-Handle<Object> Object::GetPrototypeSkipHiddenPrototypes(
- Isolate* isolate, Handle<Object> receiver) {
- PrototypeIterator iter(isolate, receiver);
- while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
+Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) {
+ // We don't expect access checks to be needed on JSProxy objects.
+ DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject());
+ Handle<Context> context(isolate->context());
+ if (obj->IsAccessCheckNeeded() &&
+ !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) {
+ return isolate->factory()->null_value();
+ }
+
+ PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER);
+ do {
+ iter.AdvanceIgnoringProxies();
if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) {
return PrototypeIterator::GetCurrent(iter);
}
- iter.Advance();
- }
+ } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN));
return PrototypeIterator::GetCurrent(iter);
}
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698