RESOLVED FIXED 167454
[JSC] Optimize Number.prototype.toString on Int32 / Int52 / Double
https://bugs.webkit.org/show_bug.cgi?id=167454
Summary [JSC] Optimize Number.prototype.toString on Int32 / Int52 / Double
Yusuke Suzuki
Reported 2017-01-26 04:32:27 PST
[JSC] Optimize Number.prototype.toString on Int32 / Int52 / Double
Attachments
Patch (53.68 KB, patch)
2017-01-26 06:03 PST, Yusuke Suzuki
saam: review+
Patch (50.09 KB, patch)
2017-03-21 03:38 PDT, Yusuke Suzuki
no flags
Yusuke Suzuki
Comment 1 2017-01-26 06:03:03 PST
Saam Barati
Comment 2 2017-01-26 09:57:51 PST
Comment on attachment 299804 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299804&action=review > Source/JavaScriptCore/dfg/DFGOperations.h:162 > +char* JIT_OPERATION operationInt32ToString(ExecState*, int32_t, int32_t); Why not make these return JSCell*? > Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:407 > + result = String::numberToStringECMAScript(value.asNumber()); Why not always call this? > Source/JavaScriptCore/runtime/StringConstructor.cpp:47 > + fromCharCode stringFromCharCode DontEnum|Function 1 FromCharCodeIntrinsic I think this should be a separate patch.
Saam Barati
Comment 3 2017-01-26 09:58:43 PST
(In reply to comment #2) > Comment on attachment 299804 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299804&action=review > > > Source/JavaScriptCore/dfg/DFGOperations.h:162 > > +char* JIT_OPERATION operationInt32ToString(ExecState*, int32_t, int32_t); > > Why not make these return JSCell*? > > > Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:407 > > + result = String::numberToStringECMAScript(value.asNumber()); > > Why not always call this? > > > Source/JavaScriptCore/runtime/StringConstructor.cpp:47 > > + fromCharCode stringFromCharCode DontEnum|Function 1 FromCharCodeIntrinsic > > I think this should be a separate patch. Also please fix 32-bit and windows build issues.
Yusuke Suzuki
Comment 4 2017-01-27 08:51:32 PST
Comment on attachment 299804 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299804&action=review Thanks! >>> Source/JavaScriptCore/dfg/DFGOperations.h:162 >>> +char* JIT_OPERATION operationInt32ToString(ExecState*, int32_t, int32_t); >> >> Why not make these return JSCell*? > > Also please fix 32-bit and windows build issues. This is because the signatures of these functions are typedefed as P_ (returning pointer) to reuse the existing implementation of callOperation. I'll check Win32 build issue. >> Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:407 >> + result = String::numberToStringECMAScript(value.asNumber()); > > Why not always call this? I followed the style of the ValueAdd case. But maybe, calling numberToStringECMAScript is OK. I'll check that. >> Source/JavaScriptCore/runtime/StringConstructor.cpp:47 >> + fromCharCode stringFromCharCode DontEnum|Function 1 FromCharCodeIntrinsic > > I think this should be a separate patch. I've just uploaded this part in the separate patch :) https://bugs.webkit.org/show_bug.cgi?id=167505
Saam Barati
Comment 5 2017-01-27 09:59:31 PST
(In reply to comment #4) > Comment on attachment 299804 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=299804&action=review > > Thanks! > > >>> Source/JavaScriptCore/dfg/DFGOperations.h:162 > >>> +char* JIT_OPERATION operationInt32ToString(ExecState*, int32_t, int32_t); > >> > >> Why not make these return JSCell*? > > > > Also please fix 32-bit and windows build issues. > > This is because the signatures of these functions are typedefed as P_ > (returning pointer) to reuse the existing implementation of callOperation. > I'll check Win32 build issue. > > >> Source/JavaScriptCore/dfg/DFGStrengthReductionPhase.cpp:407 > >> + result = String::numberToStringECMAScript(value.asNumber()); > > > > Why not always call this? > > I followed the style of the ValueAdd case. But maybe, calling > numberToStringECMAScript is OK. > I'll check that. I think it's OK to be consistent with what Add does here. > > >> Source/JavaScriptCore/runtime/StringConstructor.cpp:47 > >> + fromCharCode stringFromCharCode DontEnum|Function 1 FromCharCodeIntrinsic > > > > I think this should be a separate patch. > > I've just uploaded this part in the separate patch :) > https://bugs.webkit.org/show_bug.cgi?id=167505
Yusuke Suzuki
Comment 6 2017-03-21 01:11:05 PDT
Oops, I forgot this patch! I'll land it with pointed fixes.
Yusuke Suzuki
Comment 7 2017-03-21 03:38:34 PDT
Created attachment 304995 [details] Patch Patch for landing
Yusuke Suzuki
Comment 8 2017-03-21 04:31:54 PDT
Note You need to log in before you can comment on or make changes to this bug.