Bug 177070

Summary: [JSC] Consider dropping JSObjectSetPrototype feature for JSGlobalObject
Product: WebKit Reporter: Yusuke Suzuki <ysuzuki>
Component: JavaScriptCoreAssignee: Yusuke Suzuki <ysuzuki>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fpizlo, ggaren, jfbastien, keith_miller, mark.lam, msaboff, rmorisset, saam, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Yusuke Suzuki
Reported 2017-09-18 07:24:57 PDT
Now, JSGlobalObject is an immutable prototype exotic object. It means that we cannot change the [[Prototype]] of JSGlobalObject. However, our JSC API allows us to change it specially. What do you think of dropping this feature?
Attachments
Patch (4.05 KB, patch)
2017-09-18 11:53 PDT, Yusuke Suzuki
no flags
Geoffrey Garen
Comment 1 2017-09-18 10:57:59 PDT
Seems OK to me, to match the spec.
Yusuke Suzuki
Comment 2 2017-09-18 11:53:52 PDT
Yusuke Suzuki
Comment 3 2017-09-18 11:59:01 PDT
Comment on attachment 321118 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=321118&action=review > Source/JavaScriptCore/ChangeLog:15 > + edge cases. While we do not allow users to change [[Prototype]] of the global object, our JS API has the way to set custom [[Prototype]] of global object by setting "prototype" of JSClassRef. So I think it's ok even in terms of the ability of JSC APIs.
Saam Barati
Comment 4 2017-09-18 12:26:22 PDT
Comment on attachment 321118 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=321118&action=review >> Source/JavaScriptCore/ChangeLog:15 >> + edge cases. > > While we do not allow users to change [[Prototype]] of the global object, our JS API has the way to set custom [[Prototype]] of global object by setting "prototype" of JSClassRef. > So I think it's ok even in terms of the ability of JSC APIs. Can we now constant fold toThis on global object? Why doesn't this patch remove the JSGlobalObject::resetPrototype API?
Yusuke Suzuki
Comment 5 2017-09-18 12:29:21 PDT
Comment on attachment 321118 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=321118&action=review >>> Source/JavaScriptCore/ChangeLog:15 >>> + edge cases. >> >> While we do not allow users to change [[Prototype]] of the global object, our JS API has the way to set custom [[Prototype]] of global object by setting "prototype" of JSClassRef. >> So I think it's ok even in terms of the ability of JSC APIs. > > Can we now constant fold toThis on global object? Why doesn't this patch remove the JSGlobalObject::resetPrototype API? Not yet. I'm now removing resetPrototype things to perform constant folding GlobalThis by ensuring that prototype is not changed after instantiation. But resetPrototype still exists in the other places. This patch is a first step to remove it.
Yusuke Suzuki
Comment 6 2017-09-18 12:37:23 PDT
Comment on attachment 321118 [details] Patch Thank you for your reviews!
WebKit Commit Bot
Comment 7 2017-09-18 13:06:37 PDT
Comment on attachment 321118 [details] Patch Clearing flags on attachment: 321118 Committed r222175: <http://trac.webkit.org/changeset/222175>
WebKit Commit Bot
Comment 8 2017-09-18 13:06:39 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 9 2017-09-27 12:24:57 PDT
Note You need to log in before you can comment on or make changes to this bug.