RESOLVED FIXED Bug 163001
[WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics
https://bugs.webkit.org/show_bug.cgi?id=163001
Summary [WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics
Yusuke Suzuki
Reported 2016-10-06 01:15:08 PDT
[WebCore][JSC] Use new @throwTypeError and @throwRangeError intrinsics
Attachments
Patch (27.48 KB, patch)
2016-10-06 01:23 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2016-10-06 01:23:23 PDT
Yusuke Suzuki
Comment 2 2016-10-06 10:30:42 PDT
Motivation: https://bugs.webkit.org/show_bug.cgi?id=162995#c1 > Some motivation: we would like to implement Object.defineProperty in builtin JS and allows it inlined. By doing so, property descriptor object { value: xxx } can get a chance to be allocation sinked in FTL. But it turns out that @TypeError etc. operations easily enlarge the size of byte code sequence and prevent us from inlining.
Yusuke Suzuki
Comment 3 2016-10-06 10:31:50 PDT
And more notes: In builtin JS, there are so many `throw @TypeError(".....");` things. But it spreads so large byte code sequence, effectively enlarges the size of bytecodes, and prevent us from inlining! [ 15] resolve_scope loc8, loc3, PrivateSymbol.TypeError(@id0), <GlobalVar>, 0, 0x110bdc0a0 [ 22] get_from_scope loc9, loc8, PrivateSymbol.TypeError(@id0), 2049<ThrowIfNotFound|GlobalVar|NotInitialization>, 238692432 predicting None [ 30] mov loc12, loc9 [ 33] mov loc11, String (atomic) (identifier): Properties can only be defined on Objects., ID: 4(const0) [ 36] construct loc9, loc9, 2, 18 (this at loc12) status(Could Take Slow Path) predicting None [ 45] throw loc9 [ 47] ... Oh, it bloats 32 intructions! We already have great solution. Let's emit op_throw_static_error instead (size is only 3). [reply] [-] Comment 1
Keith Miller
Comment 4 2016-10-06 10:39:41 PDT
Comment on attachment 290793 [details] Patch nice! r=me.
WebKit Commit Bot
Comment 5 2016-10-06 11:02:04 PDT
Comment on attachment 290793 [details] Patch Clearing flags on attachment: 290793 Committed r206870: <http://trac.webkit.org/changeset/206870>
WebKit Commit Bot
Comment 6 2016-10-06 11:02:09 PDT
All reviewed patches have been landed. Closing bug.
Saam Barati
Comment 7 2016-10-06 11:45:33 PDT
Maybe we should also remove the TypeError private name to prevent its use?
Saam Barati
Comment 8 2016-10-06 11:45:53 PDT
(In reply to comment #7) > Maybe we should also remove the TypeError private name to prevent its use? And the other potential error types.
Yusuke Suzuki
Comment 9 2016-10-06 12:03:35 PDT
(In reply to comment #8) > (In reply to comment #7) > > Maybe we should also remove the TypeError private name to prevent its use? > > And the other potential error types. Nice catch. @throwTypeError can throw any messages. We can drop it now!
Yusuke Suzuki
Comment 10 2016-10-06 12:44:44 PDT
(In reply to comment #9) > (In reply to comment #8) > > (In reply to comment #7) > > > Maybe we should also remove the TypeError private name to prevent its use? > > > > And the other potential error types. > > Nice catch. @throwTypeError can throw any messages. > We can drop it now! Ah, after investigating it, we figured out @TypeError etc. is still useful when we rejects Promise. Like, promise.@reject(new @TypeError(""));
Note You need to log in before you can comment on or make changes to this bug.