Closed
Bug 648526
Opened 14 years ago
Closed 13 years ago
Emit JSOP_OBJECT when array initializer contains negative numbers
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla15
People
(Reporter: jandem, Assigned: evilpies)
Details
Attachments
(1 file, 2 obsolete files)
3.19 KB,
patch
|
bhackett1024
:
review+
|
Details | Diff | Splinter Review |
Noticed this when reducing some testcase:
--
js> [1]; dis()
main:
00000: object [1]
00003: popv
--
And this:
--
js> [-1]; dis()
main:
00000: newarray 1
00004: zero
00005: int8 -1
00007: initelem
00008: endinit
--
The problem seems to be that JSParseNode::getConstantValue does not support negative numbers.
I don't know if this will win performance somewhere. SS base64 uses an array with negative numbers though and some benchmarks like to use arrays as vectors like this: [-1, 0, 1].
Reporter | ||
Comment 1•14 years ago
|
||
Brian asking your r? because you wrote JSParseNode::isConstant. The problem was that -10 is constant folded to one token after parsing the initializer.
Attachment #524651 -
Flags: review?(bhackett1024)
Comment 2•14 years ago
|
||
This will I think break in JSParseNode::getConstantValue if it is not also updated. Can you add a testcase or update tests/basic/testInitSingleton?
Reporter | ||
Updated•14 years ago
|
Attachment #524651 -
Flags: review?(bhackett1024)
Assignee | ||
Updated•14 years ago
|
Assignee: jdemooij → evilpies
Assignee | ||
Comment 3•14 years ago
|
||
Brain is this a sensible approach to do this, or is there some reason that we can't doing folding there?
Attachment #584467 -
Flags: feedback?(bhackett1024)
Comment 4•14 years ago
|
||
Comment on attachment 584467 [details] [diff] [review]
do FoldConstants for every node
I think FoldConstants is fine to use here, and should be more robust.
Attachment #584467 -
Flags: feedback?(bhackett1024) → review+
Assignee | ||
Comment 5•13 years ago
|
||
Finally came around finishing this. I know the tests are kinda dense, but I hope we test constant folding in enough other places.
Attachment #524651 -
Attachment is obsolete: true
Attachment #584467 -
Attachment is obsolete: true
Attachment #618364 -
Flags: review?(bhackett1024)
Updated•13 years ago
|
Attachment #618364 -
Flags: review?(bhackett1024) → review+
Assignee | ||
Comment 6•13 years ago
|
||
Comment 7•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla15
You need to log in
before you can comment on or make changes to this bug.
Description
•