If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Decompiler still outputs "NaN" (etc) incorrectly for |case|

VERIFIED FIXED in mozilla1.9alpha4

Status

()

Core
JavaScript Engine
P2
minor
VERIFIED FIXED
11 years ago
11 years ago

People

(Reporter: Jesse Ruderman, Assigned: brendan)

Tracking

(Blocks: 1 bug, {testcase})

Trunk
mozilla1.9alpha4
testcase
Points:
---
Dependency tree / graph
Bug Flags:
in-testsuite +

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 2 obsolete attachments)

(Reporter)

Description

11 years ago
Bug 351219 didn't fix switch |case| decompilation:

js> function() { switch(a) { case 0/0: a; case 1/0: b; case -1/0: c; case -0: d; } }
function () {
    switch (a) {
      case NaN:
        a;
      case Infinity:
        b;
      case -Infinity:
        c;
      case 0:
        d;
      default:;
    }
}
(Assignee)

Comment 1

11 years ago
Created attachment 260198 [details] [diff] [review]
fix
Assignee: general → brendan
Status: NEW → ASSIGNED
Attachment #260198 - Flags: review?(mrbkap)
(Assignee)

Updated

11 years ago
OS: Mac OS X → All
Priority: -- → P2
Hardware: PC → All
Target Milestone: --- → mozilla1.9alpha4
(Assignee)

Comment 2

11 years ago
Created attachment 260199 [details] [diff] [review]
fix, v2

Forgot static, and added an assertion.

/be
Attachment #260198 - Attachment is obsolete: true
Attachment #260199 - Flags: review?(mrbkap)
Attachment #260198 - Flags: review?(mrbkap)

Updated

11 years ago
Attachment #260199 - Flags: review?(mrbkap) → review+
(Assignee)

Comment 3

11 years ago
Created attachment 260307 [details] [diff] [review]
patch to commit

Use ?: in JSOP_NUMBER's decompiler instead of if/else with common left-hand side (todo) of single assignment statement in then and else clauses. Bonus: no Sprint* function calls have to wrap unnaturally given the wrapped ?:.

/be
Attachment #260199 - Attachment is obsolete: true
Attachment #260307 - Flags: review+
(Assignee)

Comment 4

11 years ago
Fixed on trunk:

js/src/jsopcode.c 3.222

/be
Blocks: 355044
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED

Comment 5

11 years ago
/cvsroot/mozilla/js/tests/js1_5/decompilation/regress-375882.js,v  <--  regress-375882.js
initial revision: 1.1

the case 1 / -0 : just looks weird to me.

function ( ) { 
    switch ( a ) { 
        case 0 / 0 : a ; 
        case 1 / 0 : b ; 
        case 1 / - 0 : c ; 
        case - 0 : d ; 
        default : ; 
    } 
}



Flags: in-testsuite+
(Assignee)

Comment 6

11 years ago
We could use -1 / 0 since the expression will be auto-parenthesized as needed, based on operator precedence. File a new bug for this prettier form if you like?

/be

Comment 7

11 years ago
verified fixed linux, windows, mac* shell 20070406
Status: RESOLVED → VERIFIED
(Reporter)

Updated

11 years ago
No longer blocks: 349611
(Reporter)

Updated

11 years ago
Blocks: 349611
You need to log in before you can comment on or make changes to this bug.