From 06dad708cbea997dc0d46dcbba307d1f63a3a717 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Wed, 20 Nov 2013 12:29:48 +0000 Subject: [PATCH] Backed out changeset b92529577644 (bug 895395) on suspicion of causing shutdown hangs on OS X --- js/src/frontend/BytecodeCompiler.cpp | 4 +++- js/src/frontend/NameFunctions.cpp | 6 +++--- js/src/frontend/NameFunctions.h | 5 +---- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index cfcf1735ed9..c0fc473f71b 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -355,7 +355,9 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco 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)) diff --git a/js/src/frontend/NameFunctions.cpp b/js/src/frontend/NameFunctions.cpp index 23805cace95..ab26b3fddd5 100644 --- a/js/src/frontend/NameFunctions.cpp +++ b/js/src/frontend/NameFunctions.cpp @@ -23,7 +23,7 @@ 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 */ @@ -262,7 +262,7 @@ class NameResolver } 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 @@ -331,7 +331,7 @@ class NameResolver } /* anonymous namespace */ bool -frontend::NameFunctions(ExclusiveContext *cx, ParseNode *pn) +frontend::NameFunctions(JSContext *cx, ParseNode *pn) { NameResolver nr(cx); nr.resolve(pn); diff --git a/js/src/frontend/NameFunctions.h b/js/src/frontend/NameFunctions.h index 0f8717e7443..c6845c4cbfa 100644 --- a/js/src/frontend/NameFunctions.h +++ b/js/src/frontend/NameFunctions.h @@ -10,15 +10,12 @@ #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 */