Back out 32ab46a3803b (bug 588061) for Linux debug jsreftest failures
authorMatt Brubeck <mbrubeck@mozilla.com>
Fri, 22 Jul 2011 14:13:22 -0700
changeset 73247 47b309008c4e83022a06e65c40c1ce9bb3a6bfff
parent 73246 df6aa347bc83d99208cf619a00aacd41e165e129
child 73248 6dca486181bda74ef3ad6bf2513874ff5269036d
push id726
push usermbrubeck@mozilla.com
push dateFri, 22 Jul 2011 21:14:23 +0000
treeherdermozilla-inbound@47b309008c4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs588061
milestone8.0a1
backs out32ab46a3803b20e9f6313ff24f6610a64fdaf4e5
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
Back out 32ab46a3803b (bug 588061) for Linux debug jsreftest failures
js/src/jsparse.cpp
js/src/jsreflect.cpp
js/src/jsscan.cpp
--- a/js/src/jsparse.cpp
+++ b/js/src/jsparse.cpp
@@ -1500,26 +1500,33 @@ CheckStrictParameters(JSContext *cx, JST
     }
 
     return true;
 }
 
 JSParseNode *
 Parser::functionBody()
 {
+    JSStmtInfo stmtInfo;
+    uintN oldflags, firstLine;
+    JSParseNode *pn;
+
     JS_ASSERT(tc->inFunction());
-
-    JSStmtInfo stmtInfo;
     js_PushStatement(tc, &stmtInfo, STMT_BLOCK, -1);
     stmtInfo.flags = SIF_BODY_BLOCK;
 
-    uintN oldflags = tc->flags;
+    oldflags = tc->flags;
     tc->flags &= ~(TCF_RETURN_EXPR | TCF_RETURN_VOID);
 
-    JSParseNode *pn;
+    /*
+     * Save the body's first line, and store it in pn->pn_pos.begin.lineno
+     * later, because we may have not peeked in tokenStream yet, so statements
+     * won't acquire a valid pn->pn_pos.begin from the current token.
+     */
+    firstLine = tokenStream.getLineno();
 #if JS_HAS_EXPR_CLOSURES
     if (tokenStream.currentToken().type == TOK_LC) {
         pn = statements();
     } else {
         pn = UnaryNode::create(tc);
         if (pn) {
             pn->pn_kid = assignExpr();
             if (!pn->pn_kid) {
@@ -1540,16 +1547,17 @@ Parser::functionBody()
     }
 #else
     pn = statements();
 #endif
 
     if (pn) {
         JS_ASSERT(!(tc->topStmt->flags & SIF_SCOPE));
         js_PopStatement(tc);
+        pn->pn_pos.begin.lineno = firstLine;
 
         /* Check for falling off the end of a function that returns a value. */
         if (context->hasStrictOption() && (tc->flags & TCF_RETURN_EXPR) &&
             !CheckFinalReturn(context, tc, pn)) {
             pn = NULL;
         }
     }
 
@@ -3496,19 +3504,19 @@ Parser::statements()
              * PNX_FUNCDEFS notifies the emitter that the block contains body-
              * level function definitions that should be processed before the
              * rest of nodes.
              *
              * TCF_HAS_FUNCTION_STMT is for the TOK_LC case in Statement. It
              * is relevant only for function definitions not at body-level,
              * which we call function statements.
              */
-            if (tc->atBodyLevel()) {
+            if (tc->atBodyLevel())
                 pn->pn_xflags |= PNX_FUNCDEFS;
-            } else {
+            else {
                 tc->flags |= TCF_HAS_FUNCTION_STMT;
                 /* Function statements extend the Call object at runtime. */
                 tc->noteHasExtensibleScope();
             }
         }
         pn->append(pn2);
     }
 
--- a/js/src/jsreflect.cpp
+++ b/js/src/jsreflect.cpp
@@ -1877,17 +1877,20 @@ ASTSerializer::blockStatement(JSParseNod
     NodeVector stmts(cx);
     return statements(pn, stmts) &&
            builder.blockStatement(stmts, &pn->pn_pos, dst);
 }
 
 bool
 ASTSerializer::program(JSParseNode *pn, Value *dst)
 {
-    JS_ASSERT(pn->pn_pos.begin.lineno == lineno);
+    JS_ASSERT(pn);
+
+    /* Workaround for bug 588061: parser's reported start position is always 0:0. */
+    pn->pn_pos.begin.lineno = lineno;
 
     NodeVector stmts(cx);
     return statements(pn, stmts) &&
            builder.program(stmts, &pn->pn_pos, dst);
 }
 
 bool
 ASTSerializer::sourceElement(JSParseNode *pn, Value *dst)
--- a/js/src/jsscan.cpp
+++ b/js/src/jsscan.cpp
@@ -222,28 +222,16 @@ TokenStream::init(const jschar *base, si
     maybeStrSpecial[unsigned('"')] = true;
     maybeStrSpecial[unsigned('\'')] = true;
     maybeStrSpecial[unsigned('\\')] = true;
     maybeStrSpecial[unsigned('\n')] = true;
     maybeStrSpecial[unsigned('\r')] = true;
     maybeStrSpecial[unsigned(LINE_SEPARATOR & 0xff)] = true;
     maybeStrSpecial[unsigned(PARA_SEPARATOR & 0xff)] = true;
     maybeStrSpecial[unsigned(EOF & 0xff)] = true;
-
-    /*
-     * Set |ln| as the beginning line number of the ungot "current token", so
-     * that js::Parser::statements (and potentially other such methods, in the
-     * future) can create parse nodes with good source coordinates before they
-     * explicitly get any tokens.
-     *
-     * Switching the parser/lexer so we always get the next token ahead of the
-     * parser needing it (the so-called "pump-priming" model) might be a better
-     * way to address the dependency from statements on the current token.
-     */
-    tokens[0].pos.begin.lineno = ln;
     return true;
 }
 
 TokenStream::~TokenStream()
 {
     if (flags & TSF_OWNFILENAME)
         cx->free_((void *) filename);
 }