Closed Bug 475849 Opened 16 years ago Closed 16 years ago

Parens around for-condition lead to inefficient bytecode

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set
minor

Tracking

()

RESOLVED DUPLICATE of bug 461269

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: testcase)

This is a simple-infinite-loop example, but similar things happen in other cases. js> dis(function() { for (; (1); ) { } }) flags: LAMBDA INTERPRETED main: 00000: nop 00001: goto 4 (3) 00004: true 00005: ifne 4 (-1) 00008: stop js> dis(function() { for (; 1; ) { } }) flags: LAMBDA INTERPRETED main: 00000: nop 00001: goto 1 (0) 00004: stop js> dis(function() { for (; (true); ) { } }) flags: LAMBDA INTERPRETED main: 00000: nop 00001: goto 1 (0) 00004: stop
Depends on: 461269
In current tracemonkey tip: js> dis(function() { for (; (1); ) { } }) flags: LAMBDA NULL_CLOSURE main: 00000: nop 00001: loop 00002: goto 1 (-1) 00005: stop Source notes: 0: 0 [ 0] for cond 1 update 1 tail 1 js> dis(function() { for (; 1; ) { } }) flags: LAMBDA NULL_CLOSURE main: 00000: nop 00001: loop 00002: goto 1 (-1) 00005: stop Source notes: 0: 0 [ 0] for cond 1 update 1 tail 1 js> dis(function() { for (; (true); ) { } }) flags: LAMBDA NULL_CLOSURE main: 00000: nop 00001: loop 00002: goto 1 (-1) 00005: stop Source notes: 0: 0 [ 0] for cond 1 update 1 tail 1 (The "loop" instruction is a no-op that we emit for the benefit of the JIT, particularly when blacklisting a loop so that the JIT doesn't waste any more time trying to compile it.)
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.