Closed
Bug 1120069
Opened 10 years ago
Closed 10 years ago
IonMonkey: Implement MTruncateToInt32 recover instruction
Categories
(Core :: JavaScript Engine: JIT, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: andy.zsshen, Assigned: andy.zsshen, Mentored)
References
Details
Attachments
(5 files, 10 obsolete files)
(deleted),
image/png
|
Details | |
(deleted),
image/png
|
Details | |
(deleted),
image/png
|
Details | |
(deleted),
patch
|
Details | Diff | Splinter Review | |
(deleted),
patch
|
nbp
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
Assignee | ||
Comment 1•10 years ago
|
||
Implement MTruncateToInt32 in js/src/jit/Recover.cpp.
See Bug 1003801 comment 0 for explanation.
Mentor: nicolas.b.pierron
OS: Windows 8.1 → Windows 7
Whiteboard: [good first bug][lang=c++]
Assignee | ||
Comment 2•10 years ago
|
||
The implemented recovering code and its test case.
Attachment #8547020 -
Flags: review?(nicolas.b.pierron)
Assignee | ||
Updated•10 years ago
|
Whiteboard: [good first bug][lang=c++]
Assignee | ||
Comment 3•10 years ago
|
||
Update the patch. It can pass the try server testing:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=b74bb7207092
Attachment #8547020 -
Attachment is obsolete: true
Attachment #8547020 -
Flags: review?(nicolas.b.pierron)
Attachment #8547286 -
Flags: review?(nicolas.b.pierron)
Comment 4•10 years ago
|
||
Comment on attachment 8547286 [details] [diff] [review]
Recover_MTruncateToInt32.patch
Review of attachment 8547286 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit-test/tests/ion/dce-with-rinstructions.js
@@ +1029,5 @@
> }
>
> +var uceFault_trunc_to_int32_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_trunc_to_int32_number'));
> +function rtrunc_to_int32_number(i) {
> + var x = Math.imul(i + 0.12, i + 0.23);
use a bitwise operator instead of Math.imul, such as (i + 0.12) | 0
@@ +1041,5 @@
> + var t1 = i + 0.12;
> + var t2 = i + 0.23;
> + var o1 = { valueOf: function() { return t1; } };
> + var o2 = { valueOf: function() { return t2; } };
> + var x = Math.imul(o1, o2);
same here.
::: js/src/jit/MIR.h
@@ +4638,5 @@
> #endif
>
> + bool writeRecoverData(CompactBufferWriter &writer) const;
> + bool canRecoverOnBailout() const {
> + return true;
I am surprised the test case does highlight the issue, Can you verify with iongraph that the second test is using recover instructions.
::: js/src/jit/Recover.cpp
@@ +1104,5 @@
> +{
> + RootedValue result(cx);
> +
> + // Directly apply public conversion.
> + double in = iter.read().toNumber();
Use:
if (!ToNumber(cx, val, &dbl))
return false;
instead of toNumber, as the ToNumber function will handle the conversion from string to integers.
Add a test case for strings such as
assertEq( (i + "0") | 0, 990)
Attachment #8547286 -
Flags: review?(nicolas.b.pierron) → feedback+
Assignee | ||
Comment 5•10 years ago
|
||
Update the number conversion and refine the test cases.
Attachment #8547286 -
Attachment is obsolete: true
Attachment #8547643 -
Flags: review?(nicolas.b.pierron)
Assignee | ||
Comment 6•10 years ago
|
||
The iongraph for rtrunct_to_int32_number
Assignee | ||
Comment 7•10 years ago
|
||
The iongraph for rtrunc_to_int32_object
Comment 8•10 years ago
|
||
Comment on attachment 8547643 [details] [diff] [review]
Recover_MTruncateToInt32.patch
Review of attachment 8547643 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit-test/tests/ion/dce-with-rinstructions.js
@@ +1031,5 @@
> +var uceFault_trunc_to_int32_number = eval(uneval(uceFault).replace('uceFault', 'uceFault_trunc_to_int32_number'));
> +function rtrunc_to_int32_number(i) {
> + var x = (i + 0.12) | 0;
> + if (uceFault_trunc_to_int32_number(i) || uceFault_trunc_to_int32_number(i))
> + assertEq(x, (i + 0.12) | 0);
replace this by 99.
@@ +1042,5 @@
> + var o1 = { valueOf: function() { return t1; } };
> + var x = o1 | 0;
> + t1 = 777.12;
> + if (uceFault_trunc_to_int32_object(i) || uceFault_trunc_to_int32_object(i))
> + assertEq(x, (i + 0.12) | 0);
same here.
@@ +1049,5 @@
> +var uceFault_trunc_to_int32_string = eval(uneval(uceFault).replace('uceFault', 'uceFault_trunc_to_int32_string'));
> +function rtrunc_to_int32_string(i) {
> + var x = (i + "0") | 0;
> + if (uceFault_trunc_to_int32_string(i) || uceFault_trunc_to_int32_string(i))
> + assertEq(x, (i + "0") | 0);
replace it by 990
::: js/src/jit/MIR.h
@@ +4638,5 @@
> #endif
>
> + bool writeRecoverData(CompactBufferWriter &writer) const;
> + bool canRecoverOnBailout() const {
> + return true;
Can you attach the last MIR phase of the 3 test function that are added in dce-with-rinstructions.js ?
I really doubt that we want to return true here.
Assignee | ||
Comment 9•10 years ago
|
||
The iongraph for rtrunc_to_int32_string.
It is weird...
As these graph show, the truncatetoint32 operations are not colored as gray.
However, the program will call RTruncateToInt32::recover() when I set a break
point at the function prologue for verification.
Assignee | ||
Comment 10•10 years ago
|
||
Add the input MIR type checking for canRecoverOnBailout().
Attachment #8547643 -
Attachment is obsolete: true
Attachment #8547643 -
Flags: review?(nicolas.b.pierron)
Attachment #8548995 -
Flags: review?(nicolas.b.pierron)
Comment 11•10 years ago
|
||
Comment on attachment 8548995 [details] [diff] [review]
Recover_TruncateToInt32.patch
Review of attachment 8548995 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/MIR.h
@@ +4638,5 @@
> #endif
>
> + bool writeRecoverData(CompactBufferWriter &writer) const;
> + bool canRecoverOnBailout() const {
> + return input()->type() != MIRType_Object;
We probably want an inequality, in order to prevent accepting boxed objects.
Attachment #8548995 -
Flags: review?(nicolas.b.pierron) → feedback+
Assignee | ||
Comment 12•10 years ago
|
||
Refine the return condition for canRecoverOnBailout().
The try testing result:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=2e3e602a7582
Attachment #8548995 -
Attachment is obsolete: true
Attachment #8551302 -
Flags: review?(nicolas.b.pierron)
Assignee | ||
Comment 13•10 years ago
|
||
The iongraph for rtrunc_to_int32_number.
Attachment #8547645 -
Attachment is obsolete: true
Assignee | ||
Comment 14•10 years ago
|
||
The iongraph for rtrunc_to_int32_object
Attachment #8547647 -
Attachment is obsolete: true
Assignee | ||
Comment 15•10 years ago
|
||
The iongraph for rtrunc_to_int32_string
Attachment #8547656 -
Attachment is obsolete: true
Comment 16•10 years ago
|
||
Comment on attachment 8551302 [details] [diff] [review]
Recover_TruncateToInt32.patch
Review of attachment 8551302 [details] [diff] [review]:
-----------------------------------------------------------------
Sounds good to land :)
Attachment #8551302 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Updated•10 years ago
|
Assignee: nobody → andy.zsshen
Comment 17•10 years ago
|
||
Hi, this patch failed to apply:
applying Recover_TruncateToInt32.patch
patching file js/src/jit-test/tests/ion/dce-with-rinstructions.js
Hunk #2 FAILED at 1187
1 out of 2 hunks FAILED -- saving rejects to file js/src/jit-test/tests/ion/dce-with-rinstructions.js.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh Recover_TruncateToInt32.patch
could you take a look, thanks!
Flags: needinfo?(andy.zsshen)
Keywords: checkin-needed
Assignee | ||
Comment 18•10 years ago
|
||
Resolve the conflict.
Attachment #8551302 -
Attachment is obsolete: true
Flags: needinfo?(andy.zsshen)
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 19•10 years ago
|
||
Flags: in-testsuite+
Keywords: checkin-needed
Comment 20•10 years ago
|
||
Status: UNCONFIRMED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Comment 21•10 years ago
|
||
Comment on attachment 8553151 [details] [diff] [review]
Recover_TruncateToInt32.patch
Review of attachment 8553151 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/Recover.cpp
@@ +1143,5 @@
> +
> + double in;
> + if (!ToNumber(cx, value, &in))
> + return false;
> + int out = ToInt32(in);
int out = JS::ToInt32(in);
Assignee | ||
Comment 22•10 years ago
|
||
Code refinement:
Change ToNumber() to ToInt32() for value range testing.
Try testing result:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=addfb387c306
Assignee | ||
Comment 23•10 years ago
|
||
Code refinement:
Change ToNumber() to ToInt32() for value range testing.
Try testing result:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=addfb387c306
Attachment #8554580 -
Attachment is obsolete: true
Attachment #8554584 -
Flags: review?(nicolas.b.pierron)
Comment 24•10 years ago
|
||
Comment on attachment 8554584 [details] [diff] [review]
Recover_TruncateToInt32_Refine.patch
Review of attachment 8554584 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/Recover.cpp
@@ +1141,5 @@
> RootedValue value(cx, iter.read());
> RootedValue result(cx);
>
> + int32_t trunc;
> + if (!ToInt32(cx, value, &trunc))
Add the JS:: namespace specifier.
And make sure jsapi.h is #include in this file.
Attachment #8554584 -
Flags: review?(nicolas.b.pierron)
Assignee | ||
Comment 25•10 years ago
|
||
1. Include the jsapi.h
2. Add the JS:: namespace specification
Attachment #8554584 -
Attachment is obsolete: true
Attachment #8554605 -
Flags: review?(nicolas.b.pierron)
Comment 26•10 years ago
|
||
Comment on attachment 8554605 [details] [diff] [review]
Recover_TruncateToInt32_Refine.patch
Review of attachment 8554605 [details] [diff] [review]:
-----------------------------------------------------------------
This looks good :)
Attachment #8554605 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 27•10 years ago
|
||
Before check-in, It should be better to run the test again:
https:https://treeherder.mozilla.org/#/jobs?repo=try&revision=9e0db6e9b100
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 28•10 years ago
|
||
Keywords: checkin-needed
Comment 29•10 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•