Closed
Bug 1122723
Opened 9 years ago
Closed 9 years ago
IonMonkey: Fold MConcat with the empty string
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: sstangl, Assigned: sstangl)
Details
Attachments
(1 file)
1.31 KB,
patch
|
h4writer
:
review+
|
Details | Diff | Splinter Review |
Super-simple patch. Shumway occasionally uses ""+x to induce ToString(x). This eliminates the concat operation.
Assignee | ||
Comment 1•9 years ago
|
||
Attachment #8550491 -
Flags: review?(hv1989)
Comment 2•9 years ago
|
||
Comment on attachment 8550491 [details] [diff] [review] patch Review of attachment 8550491 [details] [diff] [review]: ----------------------------------------------------------------- Good find.
Attachment #8550491 -
Flags: review?(hv1989) → review+
Comment 3•9 years ago
|
||
> Good find.
Indeed. It's also surprising we didn't encounter this in other hot code: it's one of the standard ways of coercing to string in JS, after all.
Assignee | ||
Comment 4•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/65151ac03846
Comment 5•9 years ago
|
||
> Shumway occasionally uses ""+x to induce ToString(x).
The two operations are not identical when |x| is an object without the default "valueOf" function property. I skimmed the JITs a bit -- do we "handle" this by making MConcat use ConvertToStringPolicy, which boxes objects into values, then having it bail if the resulting value is ever an object at runtime? That's desperately unclear from cursory examination of the code -- could we add comments "somewhere" to clarify string concatenation as being safe to use ToString, even tho according to spec it's not?
Assignee | ||
Comment 6•9 years ago
|
||
(In reply to Jeff Walden [:Waldo] (remove +bmo to email) from comment #5) > I skimmed the JITs a bit -- do we "handle" this by making MConcat use > ConvertToStringPolicy, which boxes objects into values, then having it bail > if the resulting value is ever an object at runtime? MConcat uses ConvertToStringPolicy for both arguments (MIR.h:6086), which wraps non-MIRType_String inputs with MToString (TypePolicy.cpp:398). MToString uses a ToStringPolicy. ToStringPolicy::staticAdjustInputs() replaces incoming MIRType_Object inputs with MBox(MIRType_Object) (TypePolicy.cpp:687). visitToString() then lowers MIRType_Value input to LValueToString. visitValueToString() then emits bail code for the MIRType_Object case (CodeGenerator.cpp:929). Yeah comments would probably be nice.
Comment 7•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/65151ac03846
Assignee: nobody → sstangl
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in
before you can comment on or make changes to this bug.
Description
•