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

Unified Diff: src/objects-inl.h

Issue 1417063011: [runtime] support new Proxy() instead of Proxy.create and install getPrototypeOf trap (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: using one friend less Created 5 years, 1 month 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
« src/objects.cc ('K') | « src/objects.cc ('k') | src/objects-printer.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 052fc5147288277ce83293579553ac02d784aac8..0b87e0815d4d385720a1e3ae405978b11587c037 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,12 @@ int JSFunction::NumberOfLiterals() {
ACCESSORS(JSProxy, handler, Object, kHandlerOffset)
ACCESSORS(JSProxy, hash, Object, kHashOffset)
+// TODO(@neis): transform this into a real object field.
+Object* JSProxy::target() const { return map()->prototype(); }
+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)
« src/objects.cc ('K') | « src/objects.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698