Bug 704369: Factor conditional expr emit. (r=Waldo)
authorChris Leary <cdleary@mozilla.com>
Tue, 22 Nov 2011 11:46:18 -0800
changeset 83750 e5963f5906f7c0e270b1b52744af8251c5f207d8
parent 83749 2cd6087dbca3801fd2be5bf43499569a86c85564
child 83751 b09bfe78aa7787936f5a819788bb04ae7d561397
push id519
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 00:38:35 +0000
treeherdermozilla-beta@788ea1ef610b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersWaldo
bugs704369
milestone11.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 704369: Factor conditional expr emit. (r=Waldo)
js/src/frontend/BytecodeEmitter.cpp
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -6646,50 +6646,46 @@ EmitSyntheticStatements(JSContext *cx, B
     return PopStatementBCE(cx, bce);
 }
 
 static bool
 EmitConditionalExpression(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
 {
     /* Emit the condition, then branch if false to the else part. */
     if (!EmitTree(cx, bce, pn->pn_kid1))
-        return JS_FALSE;
+        return false;
     ptrdiff_t noteIndex = NewSrcNote(cx, bce, SRC_COND);
     if (noteIndex < 0)
-        return JS_FALSE;
+        return false;
     ptrdiff_t beq = EmitJump(cx, bce, JSOP_IFEQ, 0);
     if (beq < 0 || !EmitTree(cx, bce, pn->pn_kid2))
-        return JS_FALSE;
+        return false;
 
     /* Jump around else, fixup the branch, emit else, fixup jump. */
     ptrdiff_t jmp = EmitJump(cx, bce, JSOP_GOTO, 0);
     if (jmp < 0)
-        return JS_FALSE;
+        return false;
     CHECK_AND_SET_JUMP_OFFSET_AT(cx, bce, beq);
 
     /*
      * Because each branch pushes a single value, but our stack budgeting
      * analysis ignores branches, we now have to adjust bce->stackDepth to
      * ignore the value pushed by the first branch.  Execution will follow
      * only one path, so we must decrement bce->stackDepth.
      *
-     * Failing to do this will foil code, such as the try/catch/finally
-     * exception handling code generator, that samples bce->stackDepth for
-     * use at runtime (JSOP_SETSP), or in let expression and block code
-     * generation, which must use the stack depth to compute local stack
-     * indexes correctly.
+     * Failing to do this will foil code, such as let expression and block
+     * code generation, which must use the stack depth to compute local
+     * stack indexes correctly.
      */
     JS_ASSERT(bce->stackDepth > 0);
     bce->stackDepth--;
     if (!EmitTree(cx, bce, pn->pn_kid3))
-        return JS_FALSE;
+        return false;
     CHECK_AND_SET_JUMP_OFFSET_AT(cx, bce, jmp);
-    if (!SetSrcNoteOffset(cx, bce, noteIndex, 0, jmp - beq))
-        return JS_FALSE;
-    return true;
+    return SetSrcNoteOffset(cx, bce, noteIndex, 0, jmp - beq);
 }
 
 JSBool
 frontend::EmitTree(JSContext *cx, BytecodeEmitter *bce, ParseNode *pn)
 {
     ptrdiff_t top, off, tmp, jmp;
     ParseNode *pn2, *pn3;
     JSAtom *atom;