WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
147925
[ES6] Implement Reflect.get
https://bugs.webkit.org/show_bug.cgi?id=147925
Summary
[ES6] Implement Reflect.get
Yusuke Suzuki
Reported
2015-08-11 23:32:05 PDT
[ES6] Implement Reflect.get
Attachments
Patch
(7.96 KB, patch)
2015-08-11 23:33 PDT
,
Yusuke Suzuki
ggaren
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Yusuke Suzuki
Comment 1
2015-08-11 23:33:22 PDT
Created
attachment 258809
[details]
Patch
Yusuke Suzuki
Comment 2
2015-08-11 23:34:28 PDT
Comment on
attachment 258809
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=258809&action=review
> Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp:-154 > -}
This is only the place that does not use the PropertySlot::thisValue() as the |this| value. But this code is not used anymore, so just drop it.
Geoffrey Garen
Comment 3
2015-08-17 11:16:42 PDT
Comment on
attachment 258809
[details]
Patch Should we be implementing these in JavaScript? Seems like it might be faster that way.
Yusuke Suzuki
Comment 4
2015-08-17 11:22:05 PDT
(In reply to
comment #3
)
> Comment on
attachment 258809
[details]
> Patch > > Should we be implementing these in JavaScript? Seems like it might be faster > that way.
Reflect.get can take the receiver as its optional argument. `Reflect.get ( target, propertyKey [ , receiver ])` When the receiver is specified, we need to call the getter with the receiver as the |this|. So, how about the mixed implementation? in JS: if (receiver === target) return target[propertyName]; return @getSlowCase(target, propertyKey, receiver); in C++ the above code.
http://www.ecma-international.org/ecma-262/6.0/#sec-reflect.get
Geoffrey Garen
Comment 5
2015-08-17 11:28:34 PDT
> When the receiver is specified, we need to call the getter with the receiver > as the |this|. > So, how about the mixed implementation? > > in JS: > > if (receiver === target) > return target[propertyName]; > return @getSlowCase(target, propertyKey, receiver);
Interesting. Ryosuke is working on a similar problem, where the same behavior is required by super.getter. I can see that it would be awkward to override the receiver in JS. Perhaps we should just go with your current patch for now.
Yusuke Suzuki
Comment 6
2015-08-17 11:46:34 PDT
(In reply to
comment #5
)
> > When the receiver is specified, we need to call the getter with the receiver > > as the |this|. > > So, how about the mixed implementation? > > > > in JS: > > > > if (receiver === target) > > return target[propertyName]; > > return @getSlowCase(target, propertyKey, receiver); > > Interesting. > > Ryosuke is working on a similar problem, where the same behavior is required > by super.getter. > > I can see that it would be awkward to override the receiver in JS. Perhaps > we should just go with your current patch for now.
Oh, that's very nice! Maybe, super.setter = value; also has the same problem. Reflect.set has the receiver argument optionally. Anyway, if Ryosuke is working on this "taking receiver optionally" by adding the byte code, when landing this change, we can easily use it for Reflect.get by adding the byte code intrinsics (maybe @get()?). This makes the Reflect.get written in JS (in the future) and seems cleanest way. So agree with you. In the meantime, I'll land this current C++ implementation patch. When the new byte code is introduced, we'll replace Reflect.get with the JS implementation :)
Yusuke Suzuki
Comment 7
2015-08-17 11:56:56 PDT
Committed
r188532
: <
http://trac.webkit.org/changeset/188532
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug