Open
Bug 1125590
Opened 11 years ago
Updated 4 months ago
Fold constant strings in MConcat
Categories
(Core :: JavaScript Engine: JIT, defect, P5)
Tracking
()
NEW
People
(Reporter: andy.zsshen, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.91 Safari/537.36
Reporter | ||
Updated•11 years ago
|
Component: Untriaged → JavaScript Engine: JIT
Product: Firefox → Core
Reporter | ||
Comment 1•11 years ago
|
||
For GVN optimization, we rely on the "foldsTo" function in each MIR to reduce computation.
Currently, "MConcat::foldsTo" tests whether the "rhs()" or "lhs()" is empty constant and returns the
non constant operand.
We can further test if both inputs are constants and return "MConstant" with the concatenated
constant strings.
![]() |
||
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(jdemooij)
Comment 2•11 years ago
|
||
Thanks for the report.
Unfortunately this is complicated, because we can't allocate strings in MConcat::foldsTo (we don't have a JSContext* and we could be running on a background thread). Maybe we could hack around that by allocating the string on the main thread after compilation is done (in CodeGenerator::link), but it's likely not worth the complexity..
Flags: needinfo?(jdemooij)
Comment 3•11 years ago
|
||
We had an issue like that before, and instead decided to do it as part of the JavaScript parser.
Comment 4•9 years ago
|
||
Sounds like a fun project sometimes in the far future. Feel free to take it. Just putting needinfo to remember it.
Flags: needinfo?(hv1989)
Priority: -- → P5
Comment 5•8 years ago
|
||
object-literal-ext.es6 in six-speed ends up with two constant strings. In think for that case we could fold in the IonBuilder where we should be able to allocate.
Blocks: six-speed
Comment 6•8 years ago
|
||
I once tried to do this. The main issue is that we run the compilation on a different thread. When foldsTo is executed, we cannot safely allocate a JSString, and we do not want to lock the main thread for creating it.
I see 2 options:
(1) Create mirror structures to store the same information, and when linking / codegen, register this information back to compartment associated with the compilation.
(2) Create a new zone in which we can allocate new object (template object), strings, and others, in a similar way as we do for Parsing tasks, and merge these zones back if the compilation succeeded.
I think the option (2) is the best, as it open the road for later running IonBuilder off-main thread as well.
Updated•3 years ago
|
Severity: normal → S3
Comment 7•2 years ago
|
||
Clear a needinfo that is pending on an inactive user.
Inactive users most likely will not respond; if the missing information is essential and cannot be collected another way, the bug maybe should be closed as INCOMPLETE
.
For more information, please visit BugBot documentation.
Flags: needinfo?(hv1989)
Comment 8•4 months ago
|
||
Still relevant?
You need to log in
before you can comment on or make changes to this bug.
Description
•