Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 4f2bd7a29ce27cd6cb8c16e41c1ecdbc120c0024..ed5be90cf1d97f0d084fa48f66424d8e497de8c7 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1181,15 +1181,27 @@ 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(); |
| + } |
| + return GetPrototypeWithAccess(isolate, obj); |
| +} |
| + |
| + |
| +Handle<Object> Object::GetPrototypeWithAccess(Isolate* isolate, |
| + Handle<Object> obj) { |
|
Toon Verwaest
2015/10/14 10:56:18
If you want to have such a function, make sure it
|
| + 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); |
| } |