Chromium Code Reviews| Index: src/objects-inl.h |
| diff --git a/src/objects-inl.h b/src/objects-inl.h |
| index 8d6737b2eeb00e4919bf2ba50f9531beb4f340aa..451fcbfe3f9e1e923929e5fc689d25b10a204cf9 100644 |
| --- a/src/objects-inl.h |
| +++ b/src/objects-inl.h |
| @@ -1194,16 +1194,20 @@ MaybeHandle<Object> Object::SetElement(Isolate* isolate, Handle<Object> object, |
| } |
| -Handle<Object> Object::GetPrototype(Isolate* isolate, Handle<Object> obj) { |
| +MaybeHandle<Object> Object::GetPrototype(Isolate* isolate, |
| + Handle<Object> receiver) { |
| // We don't expect access checks to be needed on JSProxy objects. |
| - DCHECK(!obj->IsAccessCheckNeeded() || obj->IsJSObject()); |
| + DCHECK(!receiver->IsAccessCheckNeeded() || receiver->IsJSObject()); |
| Handle<Context> context(isolate->context()); |
| - if (obj->IsAccessCheckNeeded() && |
| - !isolate->MayAccess(context, Handle<JSObject>::cast(obj))) { |
| + if (receiver->IsAccessCheckNeeded() && |
| + !isolate->MayAccess(context, Handle<JSObject>::cast(receiver))) { |
| return isolate->factory()->null_value(); |
| } |
| - |
| - PrototypeIterator iter(isolate, obj, PrototypeIterator::START_AT_RECEIVER); |
| + if (receiver->IsJSProxy()) { |
| + return JSProxy::GetPrototype(Handle<JSProxy>::cast(receiver)); |
| + } |
| + PrototypeIterator iter(isolate, receiver, |
| + PrototypeIterator::START_AT_RECEIVER); |
| do { |
| iter.AdvanceIgnoringProxies(); |
| if (PrototypeIterator::GetCurrent(iter)->IsJSProxy()) { |
| @@ -6404,6 +6408,11 @@ int JSFunction::NumberOfLiterals() { |
| ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| ACCESSORS(JSProxy, hash, Object, kHashOffset) |
| +Object* JSProxy::target() const { return map()->prototype(); } |
|
Jakob Kummerow
2015/11/12 12:04:24
As discussed, we probably prefer an explicit |targ
Camillo Bruni
2015/11/12 20:20:55
added todo.
|
| +void JSProxy::set_target(Object* value, WriteBarrierMode mode) { |
| + map()->set_prototype(value, mode); |
| +} |
| + |
| ACCESSORS(JSFunctionProxy, call_trap, JSReceiver, kCallTrapOffset) |
| ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) |