зеркало из https://github.com/mozilla/gecko-dev.git
Bug 679939 part 3. Add a CompileOptions flag for indicating that the script should be compiled runOnce. r=luke
This commit is contained in:
Родитель
293371ff60
Коммит
02d052c10e
|
@ -537,6 +537,8 @@ CompileFunctionBody(JSContext* cx, MutableHandleFunction fun, const ReadOnlyComp
|
|||
const AutoNameVector& formals, SourceBufferHolder& srcBuf,
|
||||
HandleObject enclosingStaticScope, GeneratorKind generatorKind)
|
||||
{
|
||||
MOZ_ASSERT(!options.isRunOnce);
|
||||
|
||||
js::TraceLoggerThread* logger = js::TraceLoggerForMainThread(cx->runtime());
|
||||
js::TraceLoggerEvent event(logger, TraceLogger_AnnotateScripts, options);
|
||||
js::AutoTraceLog scriptLogger(logger, event);
|
||||
|
|
|
@ -3343,6 +3343,7 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
|
|||
column(0),
|
||||
compileAndGo(false),
|
||||
hasPollutedGlobalScope(false),
|
||||
isRunOnce(false),
|
||||
forEval(false),
|
||||
noScriptRval(false),
|
||||
selfHostingMode(false),
|
||||
|
@ -3383,6 +3384,8 @@ class JS_FRIEND_API(ReadOnlyCompileOptions)
|
|||
unsigned column;
|
||||
bool compileAndGo;
|
||||
bool hasPollutedGlobalScope;
|
||||
// isRunOnce only applies to non-function scripts.
|
||||
bool isRunOnce;
|
||||
bool forEval;
|
||||
bool noScriptRval;
|
||||
bool selfHostingMode;
|
||||
|
@ -3475,6 +3478,7 @@ class JS_FRIEND_API(OwningCompileOptions) : public ReadOnlyCompileOptions
|
|||
OwningCompileOptions& setColumn(unsigned c) { column = c; return *this; }
|
||||
OwningCompileOptions& setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
|
||||
OwningCompileOptions& setHasPollutedScope(bool p) { hasPollutedGlobalScope = p; return *this; }
|
||||
OwningCompileOptions& setIsRunOnce(bool once) { isRunOnce = once; return *this; }
|
||||
OwningCompileOptions& setForEval(bool eval) { forEval = eval; return *this; }
|
||||
OwningCompileOptions& setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
|
||||
OwningCompileOptions& setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
|
||||
|
@ -3559,6 +3563,7 @@ class MOZ_STACK_CLASS JS_FRIEND_API(CompileOptions) : public ReadOnlyCompileOpti
|
|||
CompileOptions& setColumn(unsigned c) { column = c; return *this; }
|
||||
CompileOptions& setCompileAndGo(bool cng) { compileAndGo = cng; return *this; }
|
||||
CompileOptions& setHasPollutedScope(bool p) { hasPollutedGlobalScope = p; return *this; }
|
||||
CompileOptions& setIsRunOnce(bool once) { isRunOnce = once; return *this; }
|
||||
CompileOptions& setForEval(bool eval) { forEval = eval; return *this; }
|
||||
CompileOptions& setNoScriptRval(bool nsr) { noScriptRval = nsr; return *this; }
|
||||
CompileOptions& setSelfHostingMode(bool shm) { selfHostingMode = shm; return *this; }
|
||||
|
|
|
@ -2418,6 +2418,7 @@ JSScript::Create(ExclusiveContext* cx, HandleObject enclosingScope, bool savedCa
|
|||
script->hasPollutedGlobalScope_ = options.hasPollutedGlobalScope;
|
||||
script->selfHosted_ = options.selfHostingMode;
|
||||
script->noScriptRval_ = options.noScriptRval;
|
||||
script->treatAsRunOnce_ = options.isRunOnce;
|
||||
|
||||
script->version = options.version;
|
||||
MOZ_ASSERT(script->getVersion() == options.version); // assert that no overflow occurred
|
||||
|
|
Загрузка…
Ссылка в новой задаче