Backed out changeset b92529577644 (bug 895395) on suspicion of causing shutdown hangs on OS X
authorEd Morley <emorley@mozilla.com>
Wed, 20 Nov 2013 12:29:48 +0000
changeset 171039 7e9be570d4b89b016f7bdbe7cb6bafa2b29589fa
parent 171038 4f993fa378ebe15621a7e03114ae99552db757f5
child 171040 25c9def33304900cef23eb331f54fe80ee4df5ee
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs895395
milestone28.0a1
backs outb92529577644a37517e87fe053ba29ab9e3f4c90
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
Backed out changeset b92529577644 (bug 895395) on suspicion of causing shutdown hangs on OS X
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/NameFunctions.cpp
js/src/frontend/NameFunctions.h
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -350,17 +350,19 @@ frontend::CompileScript(ExclusiveContext
         if (canHaveDirectives) {
             if (!parser.maybeParseDirective(/* stmtList = */ nullptr, pn, &canHaveDirectives))
                 return nullptr;
         }
 
         if (!FoldConstants(cx, &pn, &parser))
             return nullptr;
 
-        if (!NameFunctions(cx, pn))
+        // Inferring names for functions in compiled scripts is currently only
+        // supported while on the main thread. See bug 895395.
+        if (cx->isJSContext() && !NameFunctions(cx->asJSContext(), pn))
             return nullptr;
 
         if (!EmitTree(cx, &bce, pn))
             return nullptr;
 
         parser.handler.freeTree(pn);
     }
 
--- a/js/src/frontend/NameFunctions.cpp
+++ b/js/src/frontend/NameFunctions.cpp
@@ -18,17 +18,17 @@ using namespace js;
 using namespace js::frontend;
 
 namespace {
 
 class NameResolver
 {
     static const size_t MaxParents = 100;
 
-    ExclusiveContext *cx;
+    JSContext *cx;
     size_t nparents;                /* number of parents in the parents array */
     ParseNode *parents[MaxParents]; /* history of ParseNodes we've been looking at */
     StringBuffer *buf;              /* when resolving, buffer to append to */
 
     /* Test whether a ParseNode represents a function invocation */
     bool call(ParseNode *pn) {
         return pn && pn->isKind(PNK_CALL);
     }
@@ -257,17 +257,17 @@ class NameResolver
      * This is the case for functions which do things like simply create a scope
      * for new variables and then return an anonymous function using this scope.
      */
     bool isDirectCall(int pos, ParseNode *cur) {
         return pos >= 0 && call(parents[pos]) && parents[pos]->pn_head == cur;
     }
 
   public:
-    explicit NameResolver(ExclusiveContext *cx) : cx(cx), nparents(0), buf(nullptr) {}
+    explicit NameResolver(JSContext *cx) : cx(cx), nparents(0), buf(nullptr) {}
 
     /*
      * Resolve all names for anonymous functions recursively within the
      * ParseNode instance given. The prefix is for each subsequent name, and
      * should initially be nullptr.
      */
     void resolve(ParseNode *cur, HandleAtom prefixArg = NullPtr()) {
         RootedAtom prefix(cx, prefixArg);
@@ -326,14 +326,14 @@ class NameResolver
         }
         nparents--;
     }
 };
 
 } /* anonymous namespace */
 
 bool
-frontend::NameFunctions(ExclusiveContext *cx, ParseNode *pn)
+frontend::NameFunctions(JSContext *cx, ParseNode *pn)
 {
     NameResolver nr(cx);
     nr.resolve(pn);
     return true;
 }
--- a/js/src/frontend/NameFunctions.h
+++ b/js/src/frontend/NameFunctions.h
@@ -5,22 +5,19 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef frontend_NameFunctions_h
 #define frontend_NameFunctions_h
 
 #include "js/TypeDecls.h"
 
 namespace js {
-
-class ExclusiveContext;
-
 namespace frontend {
 
 class ParseNode;
 
 bool
-NameFunctions(ExclusiveContext *cx, ParseNode *pn);
+NameFunctions(JSContext *cx, ParseNode *pn);
 
 } /* namespace frontend */
 } /* namespace js */
 
 #endif /* frontend_NameFunctions_h */