mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1165486 - Cleanup: rename staticEvalScope to topStaticScope to prepare for the static top-level lexical scope. (r=luke)
This commit is contained in:
parent
92cb3daad4
commit
43ad2924bd
@ -350,7 +350,7 @@ EvalKernel(JSContext* cx, const CallArgs& args, EvalType evalType, AbstractFrame
|
|||||||
: SourceBufferHolder::NoOwnership;
|
: SourceBufferHolder::NoOwnership;
|
||||||
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
|
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
|
||||||
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
||||||
scopeobj, callerScript, staticScope,
|
scopeobj, staticScope, callerScript,
|
||||||
options, srcBuf, linearStr, staticLevel);
|
options, srcBuf, linearStr, staticLevel);
|
||||||
if (!compiled)
|
if (!compiled)
|
||||||
return false;
|
return false;
|
||||||
@ -436,7 +436,7 @@ js::DirectEvalStringFromIon(JSContext* cx,
|
|||||||
: SourceBufferHolder::NoOwnership;
|
: SourceBufferHolder::NoOwnership;
|
||||||
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
|
SourceBufferHolder srcBuf(chars, linearStr->length(), ownership);
|
||||||
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
JSScript* compiled = frontend::CompileScript(cx, &cx->tempLifoAlloc(),
|
||||||
scopeobj, callerScript, staticScope,
|
scopeobj, staticScope, callerScript,
|
||||||
options, srcBuf, linearStr, staticLevel);
|
options, srcBuf, linearStr, staticLevel);
|
||||||
if (!compiled)
|
if (!compiled)
|
||||||
return false;
|
return false;
|
||||||
|
@ -210,8 +210,8 @@ frontend::CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOp
|
|||||||
|
|
||||||
JSScript*
|
JSScript*
|
||||||
frontend::CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, HandleObject scopeChain,
|
frontend::CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, HandleObject scopeChain,
|
||||||
|
Handle<ScopeObject*> enclosingStaticScope,
|
||||||
HandleScript evalCaller,
|
HandleScript evalCaller,
|
||||||
Handle<StaticEvalObject*> evalStaticScope,
|
|
||||||
const ReadOnlyCompileOptions& options,
|
const ReadOnlyCompileOptions& options,
|
||||||
SourceBufferHolder& srcBuf,
|
SourceBufferHolder& srcBuf,
|
||||||
JSString* source_ /* = nullptr */,
|
JSString* source_ /* = nullptr */,
|
||||||
@ -284,22 +284,22 @@ frontend::CompileScript(ExclusiveContext* cx, LifoAlloc* alloc, HandleObject sco
|
|||||||
|
|
||||||
bool savedCallerFun = evalCaller && evalCaller->functionOrCallerFunction();
|
bool savedCallerFun = evalCaller && evalCaller->functionOrCallerFunction();
|
||||||
Directives directives(options.strictOption);
|
Directives directives(options.strictOption);
|
||||||
GlobalSharedContext globalsc(cx, directives, evalStaticScope, options.extraWarningsOption);
|
GlobalSharedContext globalsc(cx, directives, enclosingStaticScope, options.extraWarningsOption);
|
||||||
|
|
||||||
Rooted<JSScript*> script(cx, JSScript::Create(cx, evalStaticScope, savedCallerFun,
|
Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingStaticScope, savedCallerFun,
|
||||||
options, staticLevel, sourceObject, 0,
|
options, staticLevel, sourceObject, 0,
|
||||||
srcBuf.length()));
|
srcBuf.length()));
|
||||||
if (!script)
|
if (!script)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
bool insideNonGlobalEval =
|
bool insideNonGlobalEval =
|
||||||
evalStaticScope && evalStaticScope->enclosingScopeForStaticScopeIter();
|
enclosingStaticScope && enclosingStaticScope->is<StaticEvalObject>() &&
|
||||||
|
enclosingStaticScope->as<StaticEvalObject>().enclosingScopeForStaticScopeIter();
|
||||||
BytecodeEmitter::EmitterMode emitterMode =
|
BytecodeEmitter::EmitterMode emitterMode =
|
||||||
options.selfHostingMode ? BytecodeEmitter::SelfHosting : BytecodeEmitter::Normal;
|
options.selfHostingMode ? BytecodeEmitter::SelfHosting : BytecodeEmitter::Normal;
|
||||||
BytecodeEmitter bce(/* parent = */ nullptr, &parser, &globalsc, script,
|
BytecodeEmitter bce(/* parent = */ nullptr, &parser, &globalsc, script,
|
||||||
/* lazyScript = */ nullptr, options.forEval,
|
/* lazyScript = */ nullptr, options.forEval,
|
||||||
evalCaller, insideNonGlobalEval,
|
evalCaller, insideNonGlobalEval, options.lineno, emitterMode);
|
||||||
options.lineno, emitterMode);
|
|
||||||
if (!bce.init())
|
if (!bce.init())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
@ -17,18 +17,17 @@ class AutoNameVector;
|
|||||||
class LazyScript;
|
class LazyScript;
|
||||||
class LifoAlloc;
|
class LifoAlloc;
|
||||||
class ScriptSourceObject;
|
class ScriptSourceObject;
|
||||||
class StaticEvalObject;
|
class ScopeObject;
|
||||||
struct SourceCompressionTask;
|
struct SourceCompressionTask;
|
||||||
|
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
JSScript*
|
JSScript*
|
||||||
CompileScript(ExclusiveContext* cx, LifoAlloc* alloc,
|
CompileScript(ExclusiveContext* cx, LifoAlloc* alloc,
|
||||||
HandleObject scopeChain, HandleScript evalCaller,
|
HandleObject scopeChain, Handle<ScopeObject*> enclosingStaticScope,
|
||||||
Handle<StaticEvalObject*> evalStaticScope,
|
HandleScript evalCaller, const ReadOnlyCompileOptions& options,
|
||||||
const ReadOnlyCompileOptions& options, SourceBufferHolder& srcBuf,
|
SourceBufferHolder& srcBuf, JSString* source_ = nullptr,
|
||||||
JSString* source_ = nullptr, unsigned staticLevel = 0,
|
unsigned staticLevel = 0, SourceCompressionTask* extraSct = nullptr);
|
||||||
SourceCompressionTask* extraSct = nullptr);
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length);
|
CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length);
|
||||||
|
@ -769,7 +769,7 @@ BytecodeEmitter::enclosingStaticScope()
|
|||||||
|
|
||||||
// Top-level eval scripts have a placeholder static scope so that
|
// Top-level eval scripts have a placeholder static scope so that
|
||||||
// StaticScopeIter may iterate through evals.
|
// StaticScopeIter may iterate through evals.
|
||||||
return sc->asGlobalSharedContext()->evalStaticScope();
|
return sc->asGlobalSharedContext()->topStaticScope();
|
||||||
}
|
}
|
||||||
|
|
||||||
return sc->asFunctionBox()->function();
|
return sc->asFunctionBox()->function();
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
|
|
||||||
class StaticEvalObject;
|
class ScopeObject;
|
||||||
|
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
|
@ -256,21 +256,21 @@ class SharedContext
|
|||||||
class GlobalSharedContext : public SharedContext
|
class GlobalSharedContext : public SharedContext
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
Handle<StaticEvalObject*> staticEvalScope_;
|
Handle<ScopeObject*> topStaticScope_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GlobalSharedContext(ExclusiveContext* cx,
|
GlobalSharedContext(ExclusiveContext* cx,
|
||||||
Directives directives, Handle<StaticEvalObject*> staticEvalScope,
|
Directives directives, Handle<ScopeObject*> topStaticScope,
|
||||||
bool extraWarnings)
|
bool extraWarnings)
|
||||||
: SharedContext(cx, directives, extraWarnings),
|
: SharedContext(cx, directives, extraWarnings),
|
||||||
staticEvalScope_(staticEvalScope)
|
topStaticScope_(topStaticScope)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ObjectBox* toObjectBox() { return nullptr; }
|
ObjectBox* toObjectBox() { return nullptr; }
|
||||||
HandleObject evalStaticScope() const { return staticEvalScope_; }
|
HandleObject topStaticScope() const { return topStaticScope_; }
|
||||||
|
|
||||||
bool allowSyntax(AllowedSyntax allowed) const {
|
bool allowSyntax(AllowedSyntax allowed) const {
|
||||||
StaticScopeIter<CanGC> it(context, staticEvalScope_);
|
StaticScopeIter<CanGC> it(context, topStaticScope_);
|
||||||
for (; !it.done(); it++) {
|
for (; !it.done(); it++) {
|
||||||
if (it.type() == StaticScopeIter<CanGC>::Function &&
|
if (it.type() == StaticScopeIter<CanGC>::Function &&
|
||||||
!it.fun().isArrow())
|
!it.fun().isArrow())
|
||||||
|
@ -6275,8 +6275,8 @@ EvaluateInEnv(JSContext* cx, Handle<Env*> env, HandleValue thisv, AbstractFrameP
|
|||||||
.maybeMakeStrictMode(frame ? frame.script()->strict() : false);
|
.maybeMakeStrictMode(frame ? frame.script()->strict() : false);
|
||||||
RootedScript callerScript(cx, frame ? frame.script() : nullptr);
|
RootedScript callerScript(cx, frame ? frame.script() : nullptr);
|
||||||
SourceBufferHolder srcBuf(chars.start().get(), chars.length(), SourceBufferHolder::NoOwnership);
|
SourceBufferHolder srcBuf(chars.start().get(), chars.length(), SourceBufferHolder::NoOwnership);
|
||||||
RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(), env, callerScript,
|
RootedScript script(cx, frontend::CompileScript(cx, &cx->tempLifoAlloc(), env, staticScope,
|
||||||
staticScope, options, srcBuf,
|
callerScript, options, srcBuf,
|
||||||
/* source = */ nullptr,
|
/* source = */ nullptr,
|
||||||
/* staticLevel = */ frame ? 1 : 0));
|
/* staticLevel = */ frame ? 1 : 0));
|
||||||
if (!script)
|
if (!script)
|
||||||
|
Loading…
Reference in New Issue
Block a user