Bug 948230 - Use accessor methods for JSScript bitfields, r=jandem.

This commit is contained in:
Brian Hackett 2013-12-10 18:22:28 -08:00
parent b871057a05
commit 182feb3da6
48 changed files with 415 additions and 310 deletions

View File

@ -41,8 +41,8 @@ IsEvalCacheCandidate(JSScript *script)
// Make sure there are no inner objects which might use the wrong parent
// and/or call scope by reusing the previous eval's script. Skip the
// script's first object, which entrains the eval's scope.
return script->savedCallerFun &&
!script->hasSingletons &&
return script->savedCallerFun() &&
!script->hasSingletons() &&
script->objects()->length == 1 &&
!script->hasRegexps();
}
@ -99,8 +99,7 @@ class EvalScriptGuard
~EvalScriptGuard() {
if (script_) {
CallDestroyScriptHook(cx_->runtime()->defaultFreeOp(), script_);
script_->isActiveEval = false;
script_->isCachedEval = true;
script_->cacheForEval();
EvalCacheEntry cacheEntry = {script_, lookup_.callerScript, lookup_.pc};
lookup_.str = lookupStr_;
if (lookup_.str && IsEvalCacheCandidate(script_))
@ -120,8 +119,7 @@ class EvalScriptGuard
script_ = p_->script;
cx_->runtime()->evalCache.remove(p_);
CallNewScriptHook(cx_, script_, NullPtr());
script_->isCachedEval = false;
script_->isActiveEval = true;
script_->uncacheForEval();
}
}
@ -129,7 +127,7 @@ class EvalScriptGuard
// JSScript::initFromEmitter has already called js_CallNewScriptHook.
JS_ASSERT(!script_ && script);
script_ = script;
script_->isActiveEval = true;
script_->setActiveEval();
}
bool foundScript() {
@ -164,7 +162,7 @@ TryEvalJSON(JSContext *cx, JSScript *callerScript,
if (length > 2 &&
((chars[0] == '[' && chars[length - 1] == ']') ||
(chars[0] == '(' && chars[length - 1] == ')')) &&
(!callerScript || !callerScript->strict))
(!callerScript || !callerScript->strict()))
{
// Remarkably, JavaScript syntax is not a superset of JSON syntax:
// strings in JavaScript cannot contain the Unicode line and paragraph
@ -210,7 +208,7 @@ MarkFunctionsWithinEvalScript(JSScript *script)
if (obj->is<JSFunction>()) {
JSFunction *fun = &obj->as<JSFunction>();
if (fun->hasScript())
fun->nonLazyScript()->directlyInsideEval = true;
fun->nonLazyScript()->setDirectlyInsideEval();
else if (fun->isInterpretedLazy())
fun->lazyScript()->setDirectlyInsideEval();
}

View File

@ -148,7 +148,7 @@ ParallelArrayObject::constructHelper(JSContext *cx, MutableHandleFunction ctor,
jsbytecode *pc;
RootedScript script(cx, cx->currentScript(&pc));
if (script) {
if (ctor->nonLazyScript()->shouldCloneAtCallsite) {
if (ctor->nonLazyScript()->shouldCloneAtCallsite()) {
ctor.set(CloneFunctionAtCallsite(cx, ctor, script, pc));
if (!ctor)
return false;

View File

@ -79,7 +79,7 @@ CheckArgumentsWithinEval(JSContext *cx, Parser<FullParseHandler> &parser, Handle
}
// It's an error to use |arguments| in a legacy generator expression.
if (script->isGeneratorExp && script->isLegacyGenerator()) {
if (script->isGeneratorExp() && script->isLegacyGenerator()) {
parser.report(ParseError, false, nullptr, JSMSG_BAD_GENEXP_BODY, js_arguments_str);
return false;
}
@ -238,7 +238,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco
bool savedCallerFun =
options.compileAndGo &&
evalCaller &&
(evalCaller->function() || evalCaller->savedCallerFun);
(evalCaller->function() || evalCaller->savedCallerFun());
Rooted<JSScript*> script(cx, JSScript::Create(cx, NullPtr(), savedCallerFun,
options, staticLevel, sourceObject, 0, length));
if (!script)
@ -274,7 +274,7 @@ frontend::CompileScript(ExclusiveContext *cx, LifoAlloc *alloc, HandleObject sco
return nullptr;
/* If this is a direct call to eval, inherit the caller's strictness. */
if (evalCaller && evalCaller->strict)
if (evalCaller && evalCaller->strict())
globalsc.strict = true;
if (options.compileAndGo) {
@ -450,11 +450,11 @@ frontend::CompileLazyFunction(JSContext *cx, LazyScript *lazy, const jschar *cha
script->bindings = pn->pn_funbox->bindings;
if (lazy->directlyInsideEval())
script->directlyInsideEval = true;
script->setDirectlyInsideEval();
if (lazy->usesArgumentsAndApply())
script->usesArgumentsAndApply = true;
script->setUsesArgumentsAndApply();
if (lazy->hasBeenCloned())
script->hasBeenCloned = true;
script->setHasBeenCloned();
BytecodeEmitter bce(/* parent = */ nullptr, &parser, pn->pn_funbox, script, options.forEval,
/* evalCaller = */ NullPtr(), /* hasGlobalScope = */ true,

View File

@ -1178,7 +1178,7 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn)
if (funbox->function()->isNamedLambda())
hops++;
}
if (bce->script->directlyInsideEval)
if (bce->script->directlyInsideEval())
return false;
RootedObject outerScope(bce->sc->context, bce->script->enclosingStaticScope());
for (StaticScopeIter<CanGC> ssi(bce->sc->context, outerScope); !ssi.done(); ssi++) {
@ -1210,14 +1210,14 @@ TryConvertFreeName(BytecodeEmitter *bce, ParseNode *pn)
hops++;
}
if (script->funHasExtensibleScope || script->directlyInsideEval)
if (script->funHasExtensibleScope() || script->directlyInsideEval())
return false;
}
}
// Unbound names aren't recognizable global-property references if the
// script isn't running against its global object.
if (!bce->script->compileAndGo || !bce->hasGlobalScope)
if (!bce->script->compileAndGo() || !bce->hasGlobalScope)
return false;
// Deoptimized names also aren't necessarily globals.
@ -1342,7 +1342,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (dn->pn_cookie.isFree()) {
if (HandleScript caller = bce->evalCaller) {
JS_ASSERT(bce->script->compileAndGo);
JS_ASSERT(bce->script->compileAndGo());
/*
* Don't generate upvars on the left side of a for loop. See
@ -1735,7 +1735,7 @@ BytecodeEmitter::isInLoop()
bool
BytecodeEmitter::checkSingletonContext()
{
if (!script->compileAndGo || sc->isFunctionBox() || isInLoop())
if (!script->compileAndGo() || sc->isFunctionBox() || isInLoop())
return false;
hasSingletons = true;
return true;
@ -1744,7 +1744,7 @@ BytecodeEmitter::checkSingletonContext()
bool
BytecodeEmitter::needsImplicitThis()
{
if (!script->compileAndGo)
if (!script->compileAndGo())
return true;
if (sc->isFunctionBox()) {
@ -1780,7 +1780,7 @@ BytecodeEmitter::tellDebuggerAboutCompiledScript(ExclusiveContext *cx)
// nullptr parent), and so the hook should never be fired.
if (emitterMode != LazyFunction && !parent) {
GlobalObject *compileAndGoGlobal = nullptr;
if (script->compileAndGo)
if (script->compileAndGo())
compileAndGoGlobal = &script->global();
Debugger::onNewScript(cx->asJSContext(), script, compileAndGoGlobal);
}
@ -1852,7 +1852,7 @@ EmitNewInit(ExclusiveContext *cx, BytecodeEmitter *bce, JSProtoKey key)
static bool
IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
{
JS_ASSERT(bce->script->compileAndGo);
JS_ASSERT(bce->script->compileAndGo());
RootedObject obj(cx);
gc::AllocKind kind = GuessObjectGCKind(2);
@ -1882,7 +1882,7 @@ IteratorResultShape(ExclusiveContext *cx, BytecodeEmitter *bce, unsigned *shape)
static bool
EmitPrepareIteratorResult(ExclusiveContext *cx, BytecodeEmitter *bce)
{
if (bce->script->compileAndGo) {
if (bce->script->compileAndGo()) {
unsigned shape;
if (!IteratorResultShape(cx, bce, &shape))
return false;
@ -2730,8 +2730,8 @@ frontend::EmitFunctionScript(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNo
* initializers created within it may be given more precise types.
*/
if (runOnce) {
bce->script->treatAsRunOnce = true;
JS_ASSERT(!bce->script->hasRunOnce);
bce->script->setTreatAsRunOnce();
JS_ASSERT(!bce->script->hasRunOnce());
}
/* Initialize fun->script() so that the debugger has a valid fun->script(). */
@ -4779,7 +4779,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
if (fun->isInterpreted()) {
bool singleton =
cx->typeInferenceEnabled() &&
bce->script->compileAndGo &&
bce->script->compileAndGo() &&
fun->isInterpreted() &&
(bce->checkSingletonContext() ||
(!bce->isInLoop() && bce->isRunOnceLambda()));
@ -4808,8 +4808,8 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
CompileOptions options(cx, bce->parser->options());
options.setPrincipals(parent->principals())
.setOriginPrincipals(parent->originPrincipals())
.setCompileAndGo(parent->compileAndGo)
.setSelfHostingMode(parent->selfHosted)
.setCompileAndGo(parent->compileAndGo())
.setSelfHostingMode(parent->selfHosted())
.setNoScriptRval(false)
.setForEval(false)
.setVersion(parent->getVersion());
@ -4837,7 +4837,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
return false;
if (funbox->usesArguments && funbox->usesApply)
script->usesArgumentsAndApply = true;
script->setUsesArgumentsAndApply();
}
} else {
JS_ASSERT(IsAsmJSModuleNative(fun->native()));
@ -5303,9 +5303,9 @@ EmitStatement(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
bool wantval = false;
bool useful = false;
if (bce->sc->isFunctionBox()) {
JS_ASSERT(!bce->script->noScriptRval);
JS_ASSERT(!bce->script->noScriptRval());
} else {
useful = wantval = !bce->script->noScriptRval;
useful = wantval = !bce->script->noScriptRval();
}
/* Don't eliminate expressions with side effects. */
@ -5849,7 +5849,7 @@ EmitObject(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
* JSOP_NEWOBJECT with the final shape instead.
*/
RootedObject obj(cx);
if (bce->script->compileAndGo) {
if (bce->script->compileAndGo()) {
gc::AllocKind kind = GuessObjectGCKind(pn->pn_count);
obj = NewBuiltinClassInstance(cx, &JSObject::class_, kind);
if (!obj)

View File

@ -735,7 +735,7 @@ js::gc::MarkRuntime(JSTracer *trc, bool useSavedRoots)
if (rt->profilingScripts && !rt->isHeapMinorCollecting()) {
for (CellIterUnderGC i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) {
JSScript *script = i.get<JSScript>();
if (script->hasScriptCounts) {
if (script->hasScriptCounts()) {
MarkScriptRoot(trc, &script, "profilingScripts");
JS_ASSERT(script == i.get<JSScript>());
}

View File

@ -197,9 +197,9 @@ jit::CheckFrequentBailouts(JSContext *cx, JSScript *script)
IonScript *ionScript = script->ionScript();
if (ionScript->numBailouts() >= js_IonOptions.frequentBailoutThreshold &&
!script->hadFrequentBailouts)
!script->hadFrequentBailouts())
{
script->hadFrequentBailouts = true;
script->setHadFrequentBailouts();
IonSpew(IonSpew_Invalidate, "Invalidating due to too many bailouts");

View File

@ -582,7 +582,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
// prologue in this case because the prologue expects the scope
// chain in R1 for eval and global scripts.
JS_ASSERT(!script->isForEval());
JS_ASSERT(script->compileAndGo);
JS_ASSERT(script->compileAndGo());
scopeChain = &(script->global());
}
}
@ -1363,9 +1363,8 @@ HandleBoundsCheckFailure(JSContext *cx, HandleScript outerScript, HandleScript i
// TODO: Currently this mimic's Ion's handling of this case. Investigate setting
// the flag on innerScript as opposed to outerScript, and maybe invalidating both
// inner and outer scripts, instead of just the outer one.
if (!outerScript->failedBoundsCheck) {
outerScript->failedBoundsCheck = true;
}
if (!outerScript->failedBoundsCheck())
outerScript->setFailedBoundsCheck();
IonSpew(IonSpew_BaselineBailouts, "Invalidating due to bounds check failure");
return Invalidate(cx, outerScript);
}
@ -1382,7 +1381,7 @@ HandleShapeGuardFailure(JSContext *cx, HandleScript outerScript, HandleScript in
// TODO: Currently this mimic's Ion's handling of this case. Investigate setting
// the flag on innerScript as opposed to outerScript, and maybe invalidating both
// inner and outer scripts, instead of just the outer one.
outerScript->failedShapeGuard = true;
outerScript->setFailedShapeGuard();
IonSpew(IonSpew_BaselineBailouts, "Invalidating due to shape guard failure");
return Invalidate(cx, outerScript);
}

View File

@ -575,7 +575,7 @@ BaselineCompiler::initScopeChain()
// ScopeChain pointer in BaselineFrame has already been initialized
// in prologue.
if (script->isForEval() && script->strict) {
if (script->isForEval() && script->strict()) {
// Strict eval needs its own call object.
prepareVMCall();
@ -1092,7 +1092,7 @@ BaselineCompiler::emit_JSOP_THIS()
frame.pushThis();
// In strict mode code or self-hosted functions, |this| is left alone.
if (script->strict || (function() && function()->isSelfHostedBuiltin()))
if (script->strict() || (function() && function()->isSelfHostedBuiltin()))
return true;
Label skipIC;
@ -1753,7 +1753,7 @@ BaselineCompiler::emit_JSOP_DELELEM()
pushArg(R1);
pushArg(R0);
if (!callVM(script->strict ? DeleteElementStrictInfo : DeleteElementNonStrictInfo))
if (!callVM(script->strict() ? DeleteElementStrictInfo : DeleteElementNonStrictInfo))
return false;
masm.boxNonDouble(JSVAL_TYPE_BOOLEAN, ReturnReg, R1);
@ -1898,7 +1898,7 @@ BaselineCompiler::emit_JSOP_DELPROP()
pushArg(ImmGCPtr(script->getName(pc)));
pushArg(R0);
if (!callVM(script->strict ? DeletePropertyStrictInfo : DeletePropertyNonStrictInfo))
if (!callVM(script->strict() ? DeletePropertyStrictInfo : DeletePropertyNonStrictInfo))
return false;
masm.boxNonDouble(JSVAL_TYPE_BOOLEAN, ReturnReg, R1);
@ -1965,7 +1965,7 @@ bool
BaselineCompiler::emit_JSOP_SETALIASEDVAR()
{
JSScript *outerScript = ScopeCoordinateFunctionScript(script, pc);
if (outerScript && outerScript->treatAsRunOnce) {
if (outerScript && outerScript->treatAsRunOnce()) {
// Type updates for this operation might need to be tracked, so treat
// this as a SETPROP.
@ -2299,7 +2299,7 @@ BaselineCompiler::emitFormalArgAccess(uint32_t arg, bool get)
{
// Fast path: the script does not use |arguments|, or is strict. In strict
// mode, formals do not alias the arguments object.
if (!script->argumentsHasVarBinding() || script->strict) {
if (!script->argumentsHasVarBinding() || script->strict()) {
if (get) {
frame.pushArg(arg);
} else {
@ -2367,7 +2367,7 @@ BaselineCompiler::emit_JSOP_SETARG()
{
// Ionmonkey can't inline functions with SETARG with magic arguments.
if (!script->argsObjAliasesFormals() && script->argumentsAliasesFormals())
script->uninlineable = true;
script->setUninlineable();
modifiesArguments_ = true;
@ -2509,7 +2509,7 @@ bool
BaselineCompiler::emit_JSOP_TRY()
{
// Ionmonkey can't inline function with JSOP_TRY.
script->uninlineable = true;
script->setUninlineable();
return true;
}
@ -2745,7 +2745,7 @@ BaselineCompiler::emit_JSOP_RETRVAL()
masm.moveValue(UndefinedValue(), JSReturnOperand);
if (!script->noScriptRval) {
if (!script->noScriptRval()) {
// Return the value in the return value slot, if any.
Label done;
Address flags = frame.addressOfFlags();

View File

@ -328,10 +328,10 @@ class BaselineFrame
return flags_ & EVAL;
}
bool isStrictEvalFrame() const {
return isEvalFrame() && script()->strict;
return isEvalFrame() && script()->strict();
}
bool isNonStrictEvalFrame() const {
return isEvalFrame() && !script()->strict;
return isEvalFrame() && !script()->strict();
}
bool isDirectEvalFrame() const {
return isEvalFrame() && script()->staticLevel() > 0;

View File

@ -4952,7 +4952,7 @@ DoSetElemFallback(JSContext *cx, BaselineFrame *frame, ICSetElem_Fallback *stub,
if (!InitArrayElemOperation(cx, pc, obj, index.toInt32(), rhs))
return false;
} else {
if (!SetObjectElement(cx, obj, index, rhs, script->strict, script, pc))
if (!SetObjectElement(cx, obj, index, rhs, script->strict(), script, pc))
return false;
}
@ -7236,7 +7236,7 @@ DoSetPropFallback(JSContext *cx, BaselineFrame *frame, ICSetProp_Fallback *stub,
return false;
} else if (op == JSOP_SETALIASEDVAR) {
obj->as<ScopeObject>().setAliasedVar(cx, pc, name, rhs);
} else if (script->strict) {
} else if (script->strict()) {
if (!js::SetProperty<true>(cx, obj, id, rhs))
return false;
} else {
@ -7911,7 +7911,7 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
if (!calleeScript->hasBaselineScript() && !calleeScript->hasIonScript())
return true;
if (calleeScript->shouldCloneAtCallsite)
if (calleeScript->shouldCloneAtCallsite())
return true;
// Check if this stub chain has already generalized scripted calls.
@ -8016,7 +8016,7 @@ MaybeCloneFunctionAtCallsite(JSContext *cx, MutableHandleValue callee, HandleScr
if (!IsFunctionObject(callee, fun.address()))
return true;
if (!fun->hasScript() || !fun->nonLazyScript()->shouldCloneAtCallsite)
if (!fun->hasScript() || !fun->nonLazyScript()->shouldCloneAtCallsite())
return true;
if (!cx->typeInferenceEnabled())

View File

@ -280,7 +280,7 @@ CanEnterBaselineJIT(JSContext *cx, HandleScript script, bool osr)
return Method_Skipped;
}
if (script->isCallsiteClone) {
if (script->isCallsiteClone()) {
// Ensure the original function is compiled too, so that bailouts from
// Ion code have a BaselineScript to resume into.
RootedScript original(cx, script->originalFunction()->nonLazyScript());

View File

@ -2762,7 +2762,7 @@ CodeGenerator::maybeCreateScriptCounts()
CompileInfo *outerInfo = &gen->info();
JSScript *script = outerInfo->script();
if (script && !script->hasScriptCounts && !script->initScriptCounts(cx))
if (script && !script->hasScriptCounts() && !script->initScriptCounts(cx))
return nullptr;
counts = js_new<IonScriptCounts>();
@ -6615,7 +6615,7 @@ CodeGenerator::visitCallDeleteProperty(LCallDeleteProperty *lir)
pushArg(ImmGCPtr(lir->mir()->name()));
pushArg(ToValue(lir, LCallDeleteProperty::Value));
if (lir->mir()->block()->info().script()->strict)
if (lir->mir()->block()->info().script()->strict())
return callVM(DeletePropertyStrictInfo, lir);
return callVM(DeletePropertyNonStrictInfo, lir);
@ -6633,7 +6633,7 @@ CodeGenerator::visitCallDeleteElement(LCallDeleteElement *lir)
pushArg(ToValue(lir, LCallDeleteElement::Index));
pushArg(ToValue(lir, LCallDeleteElement::Value));
if (lir->mir()->block()->info().script()->strict)
if (lir->mir()->block()->info().script()->strict())
return callVM(DeleteElementStrictInfo, lir);
return callVM(DeleteElementNonStrictInfo, lir);

View File

@ -1280,7 +1280,7 @@ OptimizeMIR(MIRGenerator *mir)
// repeated bailouts. Disable it if this script is known to bailout
// frequently.
JSScript *script = mir->info().script();
if (!script || !script->hadFrequentBailouts) {
if (!script || !script->hadFrequentBailouts()) {
LICM licm(mir, graph);
if (!licm.analyze())
return false;
@ -1786,7 +1786,7 @@ CheckScript(JSContext *cx, JSScript *script, bool osr)
return false;
}
if (!script->compileAndGo) {
if (!script->compileAndGo()) {
IonSpew(IonSpew_Abort, "not compile-and-go");
return false;
}

View File

@ -2126,7 +2126,7 @@ jit::AnalyzeNewScriptProperties(JSContext *cx, HandleFunction fun,
RootedScript script(cx, fun->nonLazyScript());
if (!script->compileAndGo || !script->canBaselineCompile())
if (!script->compileAndGo() || !script->canBaselineCompile())
return true;
Vector<PropertyName *> accessedProperties(cx);

View File

@ -129,8 +129,8 @@ IonBuilder::IonBuilder(JSContext *analysisContext, CompileCompartment *comp, Tem
inspector(inspector),
inliningDepth_(inliningDepth),
numLoopRestarts_(0),
failedBoundsCheck_(info->script()->failedBoundsCheck),
failedShapeGuard_(info->script()->failedShapeGuard),
failedBoundsCheck_(info->script()->failedBoundsCheck()),
failedShapeGuard_(info->script()->failedShapeGuard()),
nonStringIteration_(false),
lazyArguments_(nullptr),
inlineCallInfo_(nullptr)
@ -378,7 +378,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
if (target->isHeavyweight())
return DontInline(inlineScript, "Heavyweight function");
if (inlineScript->uninlineable)
if (inlineScript->uninlineable())
return DontInline(inlineScript, "Uninlineable script");
if (!inlineScript->analyzedArgsUsage())
@ -387,7 +387,7 @@ IonBuilder::canInlineTarget(JSFunction *target, CallInfo &callInfo)
if (inlineScript->needsArgsObj())
return DontInline(inlineScript, "Script that needs an arguments object");
if (!inlineScript->compileAndGo)
if (!inlineScript->compileAndGo())
return DontInline(inlineScript, "Non-compileAndGo script");
types::TypeObjectKey *targetType = types::TypeObjectKey::get(target);
@ -947,7 +947,7 @@ IonBuilder::initScopeChain(MDefinition *callee)
// will try to access the scope. For other scripts, the scope instructions
// will be held live by resume points and code will still be generated for
// them, so just use a constant undefined value.
if (!script()->compileAndGo)
if (!script()->compileAndGo())
return abort("non-CNG global scripts are not supported");
if (JSFunction *fun = info().fun()) {
@ -1714,7 +1714,7 @@ IonBuilder::inspectOpcode(JSOp op)
return jsop_in();
case JSOP_SETRVAL:
JS_ASSERT(!script()->noScriptRval);
JS_ASSERT(!script()->noScriptRval());
current->setSlot(info().returnValueSlot(), current->pop());
return true;
@ -3435,7 +3435,7 @@ IonBuilder::jsop_try()
return abort("Has try-finally");
// Try-catch within inline frames is not yet supported.
JS_ASSERT(script()->uninlineable && !isInlineBuilder());
JS_ASSERT(script()->uninlineable() && !isInlineBuilder());
graph().setHasTryBlock();
@ -3514,7 +3514,7 @@ IonBuilder::processReturn(JSOp op)
case JSOP_RETRVAL:
// Return undefined eagerly if script doesn't use return value.
if (script()->noScriptRval) {
if (script()->noScriptRval()) {
MInstruction *ins = MConstant::New(alloc(), UndefinedValue());
current->add(ins);
def = ins;
@ -3859,7 +3859,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
// Inlining the callee failed. Mark the callee as uninlineable only if
// the inlining was aborted for a non-exception reason.
if (inlineBuilder.abortReason_ == AbortReason_Disable) {
calleeScript->uninlineable = true;
calleeScript->setUninlineable();
abortReason_ = AbortReason_Inlining;
} else if (inlineBuilder.abortReason_ == AbortReason_Inlining) {
abortReason_ = AbortReason_Inlining;
@ -3886,7 +3886,7 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
// Accumulate return values.
if (returns.length() == 0) {
// Inlining of functions that have no exit is not supported.
calleeScript->uninlineable = true;
calleeScript->setUninlineable();
abortReason_ = AbortReason_Inlining;
return false;
}
@ -3990,7 +3990,7 @@ IonBuilder::makeInliningDecision(JSFunction *target, CallInfo &callInfo)
JSScript *targetScript = target->nonLazyScript();
// Skip heuristics if we have an explicit hint to inline.
if (!targetScript->shouldInline) {
if (!targetScript->shouldInline()) {
// Cap the inlining depth.
if (IsSmallFunction(targetScript)) {
if (inliningDepth_ >= js_IonOptions.smallFunctionMaxInlineDepth)
@ -4610,7 +4610,7 @@ IonBuilder::createCallObject(MDefinition *callee, MDefinition *scope)
// instructions could potentially bailout, thus leaking the dynamic slots
// pointer. Run-once scripts need a singleton type, so always do a VM call
// in such cases.
MNewCallObject *callObj = MNewCallObject::New(alloc(), templateObj, script()->treatAsRunOnce, slots);
MNewCallObject *callObj = MNewCallObject::New(alloc(), templateObj, script()->treatAsRunOnce(), slots);
current->add(callObj);
// Initialize the object's reserved slots. No post barrier is needed here,
@ -5019,7 +5019,7 @@ IonBuilder::jsop_call(uint32_t argc, bool constructing)
ObjectVector targets(alloc());
for (uint32_t i = 0; i < originals.length(); i++) {
JSFunction *fun = &originals[i]->as<JSFunction>();
if (fun->hasScript() && fun->nonLazyScript()->shouldCloneAtCallsite) {
if (fun->hasScript() && fun->nonLazyScript()->shouldCloneAtCallsite()) {
if (JSFunction *clone = ExistingCloneFunctionAtCallsite(compartment->callsiteClones(), fun, script(), pc)) {
fun = clone;
hasClones = true;
@ -5396,7 +5396,7 @@ IonBuilder::jsop_compare(JSOp op)
bool
IonBuilder::jsop_newarray(uint32_t count)
{
JS_ASSERT(script()->compileAndGo);
JS_ASSERT(script()->compileAndGo());
JSObject *templateObject = inspector->getTemplateObject(pc);
if (!templateObject)
@ -5428,7 +5428,7 @@ bool
IonBuilder::jsop_newobject()
{
// Don't bake in the TypeObject for non-CNG scripts.
JS_ASSERT(script()->compileAndGo);
JS_ASSERT(script()->compileAndGo());
JSObject *templateObject = inspector->getTemplateObject(pc);
if (!templateObject)
@ -5700,7 +5700,7 @@ IonBuilder::newOsrPreheader(MBasicBlock *predecessor, jsbytecode *loopEntry)
// Initialize |return value|
{
MInstruction *returnValue;
if (!script()->noScriptRval)
if (!script()->noScriptRval())
returnValue = MOsrReturnValue::New(alloc(), entry);
else
returnValue = MConstant::New(alloc(), UndefinedValue());
@ -7471,7 +7471,7 @@ IonBuilder::setElemTryCache(bool *emitted, MDefinition *object,
current->add(MPostWriteBarrier::New(alloc(), object, value));
// Emit SetElementCache.
MInstruction *ins = MSetElementCache::New(alloc(), object, index, value, script()->strict, guardHoles);
MInstruction *ins = MSetElementCache::New(alloc(), object, index, value, script()->strict(), guardHoles);
current->add(ins);
current->push(value);
@ -8058,7 +8058,7 @@ IonBuilder::invalidatedIdempotentCache()
{
IonBuilder *builder = this;
do {
if (builder->script()->invalidatedIdempotentCache)
if (builder->script()->invalidatedIdempotentCache())
return true;
builder = builder->callerBuilder_;
} while (builder);
@ -8660,7 +8660,7 @@ IonBuilder::jsop_setprop(PropertyName *name)
// Always use a call if we are doing the definite properties analysis and
// not actually emitting code, to simplify later analysis.
if (info().executionMode() == DefinitePropertiesAnalysis) {
MInstruction *ins = MCallSetProperty::New(alloc(), obj, value, name, script()->strict);
MInstruction *ins = MCallSetProperty::New(alloc(), obj, value, name, script()->strict());
current->add(ins);
current->push(value);
return resumeAfter(ins);
@ -8695,7 +8695,7 @@ IonBuilder::jsop_setprop(PropertyName *name)
return emitted;
// Emit call.
MInstruction *ins = MCallSetProperty::New(alloc(), obj, value, name, script()->strict);
MInstruction *ins = MCallSetProperty::New(alloc(), obj, value, name, script()->strict());
current->add(ins);
current->push(value);
return resumeAfter(ins);
@ -8981,7 +8981,7 @@ IonBuilder::setPropTryCache(bool *emitted, MDefinition *obj,
JS_ASSERT(*emitted == false);
// Emit SetPropertyCache.
MSetPropertyCache *ins = MSetPropertyCache::New(alloc(), obj, value, name, script()->strict, barrier);
MSetPropertyCache *ins = MSetPropertyCache::New(alloc(), obj, value, name, script()->strict(), barrier);
if (!objTypes || objTypes->propertyNeedsBarrier(constraints(), NameToId(name)))
ins->setNeedsBarrier();
@ -9122,7 +9122,7 @@ IonBuilder::jsop_setarg(uint32_t arg)
// the frame does not actually need to be updated with the new arg value.
if (info().argumentsAliasesFormals()) {
// JSOP_SETARG with magic arguments within inline frames is not yet supported.
JS_ASSERT(script()->uninlineable && !isInlineBuilder());
JS_ASSERT(script()->uninlineable() && !isInlineBuilder());
MSetFrameArgument *store = MSetFrameArgument::New(alloc(), arg, val);
current->add(store);
@ -9207,7 +9207,7 @@ IonBuilder::jsop_this()
if (!info().fun())
return abort("JSOP_THIS outside of a JSFunction.");
if (script()->strict || info().fun()->isSelfHostedBuiltin()) {
if (script()->strict() || info().fun()->isSelfHostedBuiltin()) {
// No need to wrap primitive |this| in strict mode or self-hosted code.
current->pushSlot(info().thisSlot());
return true;
@ -9360,7 +9360,7 @@ bool
IonBuilder::hasStaticScopeObject(ScopeCoordinate sc, JSObject **pcall)
{
JSScript *outerScript = ScopeCoordinateFunctionScript(script(), pc);
if (!outerScript || !outerScript->treatAsRunOnce)
if (!outerScript || !outerScript->treatAsRunOnce())
return false;
types::TypeObjectKey *funType = types::TypeObjectKey::get(outerScript->function());

View File

@ -1746,7 +1746,7 @@ GetPropertyIC::update(JSContext *cx, size_t cacheIndex,
IonSpew(IonSpew_InlineCaches, "Invalidating from idempotent cache %s:%d",
topScript->filename(), topScript->lineno());
topScript->invalidatedIdempotentCache = true;
topScript->setInvalidatedIdempotentCache();
// Do not re-invalidate if the lookup already caused invalidation.
if (!topScript->hasIonScript())
@ -4033,7 +4033,7 @@ GenerateScopeChainGuard(MacroAssembler &masm, JSObject *scopeObj,
if (!callObj->isForEval()) {
JSFunction *fun = &callObj->callee();
JSScript *script = fun->nonLazyScript();
if (!script->funHasExtensibleScope)
if (!script->funHasExtensibleScope())
return;
}
} else if (scopeObj->is<GlobalObject>()) {
@ -4336,7 +4336,7 @@ CallsiteCloneIC::update(JSContext *cx, size_t cacheIndex, HandleObject callee)
// Act as the identity for functions that are not clone-at-callsite, as we
// generate this cache as long as some callees are clone-at-callsite.
RootedFunction fun(cx, &callee->as<JSFunction>());
if (!fun->hasScript() || !fun->nonLazyScript()->shouldCloneAtCallsite)
if (!fun->hasScript() || !fun->nonLazyScript()->shouldCloneAtCallsite())
return fun;
IonScript *ion = GetTopIonJSScript(cx)->ionScript();

View File

@ -1265,7 +1265,7 @@ IonBuilder::inlineNewParallelArray(CallInfo &callInfo)
JSFunction *target = nullptr;
if (targetObj && targetObj->is<JSFunction>())
target = &targetObj->as<JSFunction>();
if (target && target->isInterpreted() && target->nonLazyScript()->shouldCloneAtCallsite) {
if (target && target->isInterpreted() && target->nonLazyScript()->shouldCloneAtCallsite()) {
if (JSFunction *clone = ExistingCloneFunctionAtCallsite(compartment->callsiteClones(), target, script(), pc))
target = clone;
}
@ -1290,7 +1290,7 @@ IonBuilder::inlineParallelArray(CallInfo &callInfo)
if (!target)
return InliningStatus_NotInlined;
JS_ASSERT(target->nonLazyScript()->shouldCloneAtCallsite);
JS_ASSERT(target->nonLazyScript()->shouldCloneAtCallsite());
if (JSFunction *clone = ExistingCloneFunctionAtCallsite(compartment->callsiteClones(), target, script(), pc))
target = clone;

View File

@ -465,7 +465,7 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
}
bool strict() const {
return info_.script()->strict;
return info_.script()->strict();
}
void dumpStack(FILE *fp);

View File

@ -872,7 +872,7 @@ GetPossibleCallees(JSContext *cx,
if (!rootedScript)
return false;
if (rootedScript->shouldCloneAtCallsite) {
if (rootedScript->shouldCloneAtCallsite()) {
rootedFun = CloneFunctionAtCallsite(cx, rootedFun, script, pc);
if (!rootedFun)
return false;

View File

@ -63,7 +63,7 @@ InvokeFunction(JSContext *cx, HandleObject obj0, uint32_t argc, Value *argv, Val
return false;
// Clone function at call site if needed.
if (fun->nonLazyScript()->shouldCloneAtCallsite) {
if (fun->nonLazyScript()->shouldCloneAtCallsite()) {
jsbytecode *pc;
RootedScript script(cx, cx->currentScript(&pc));
fun = CloneFunctionAtCallsite(cx, fun, script, pc);

View File

@ -1633,7 +1633,7 @@ ScriptAnalysis::needsArgsObj(JSContext *cx)
* statement. In the former case, we will dynamically detect the use and
* mark the arguments optimization as having failed.
*/
if (script_->bindingsAccessedDynamically)
if (script_->bindingsAccessedDynamically())
return false;
/*
@ -1655,7 +1655,7 @@ ScriptAnalysis::needsArgsObj(JSContext *cx)
* arguments. The compiler can then assume that accesses through
* arguments[i] will be on unaliased variables.
*/
if (script_->funHasAnyAliasedFormal && argumentsContentsObserved_)
if (script_->funHasAnyAliasedFormal() && argumentsContentsObserved_)
return true;
return false;

View File

@ -3966,7 +3966,7 @@ JS_CloneFunctionObject(JSContext *cx, JSObject *funobjArg, JSObject *parentArg)
return nullptr;
}
if (fun->isInterpreted() && (fun->nonLazyScript()->enclosingStaticScope() ||
(fun->nonLazyScript()->compileAndGo && !parent->is<GlobalObject>())))
(fun->nonLazyScript()->compileAndGo() && !parent->is<GlobalObject>())))
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_BAD_CLONE_FUNOBJ_SCOPE);
return nullptr;
@ -4570,7 +4570,7 @@ JS_BufferIsCompilableUnit(JSContext *cx, JSObject *objArg, const char *utf8, siz
JS_PUBLIC_API(JSObject *)
JS_GetGlobalFromScript(JSScript *script)
{
JS_ASSERT(!script->isCachedEval);
JS_ASSERT(!script->isCachedEval());
return &script->global();
}

View File

@ -113,7 +113,7 @@ JSFunction *
js::ExistingCloneFunctionAtCallsite(const CallsiteCloneTable &table, JSFunction *fun,
JSScript *script, jsbytecode *pc)
{
JS_ASSERT(fun->nonLazyScript()->shouldCloneAtCallsite);
JS_ASSERT(fun->nonLazyScript()->shouldCloneAtCallsite());
JS_ASSERT(!fun->nonLazyScript()->enclosingStaticScope());
JS_ASSERT(types::UseNewTypeForClone(fun));
@ -148,9 +148,7 @@ js::CloneFunctionAtCallsite(JSContext *cx, HandleFunction fun, HandleScript scri
* Store a link back to the original for function.caller and avoid cloning
* clones.
*/
clone->nonLazyScript()->shouldCloneAtCallsite = false;
clone->nonLazyScript()->isCallsiteClone = true;
clone->nonLazyScript()->setOriginalFunctionObject(fun);
clone->nonLazyScript()->setIsCallsiteClone(fun);
typedef CallsiteCloneKey Key;
typedef CallsiteCloneTable Table;
@ -470,7 +468,7 @@ checkReportFlags(JSContext *cx, unsigned *flags)
* strict if the nearest scripted frame is strict, see bug 536306.
*/
JSScript *script = cx->currentScript();
if (script && script->strict)
if (script && script->strict())
*flags &= ~JSREPORT_WARNING;
else if (cx->options().extraWarnings())
*flags |= JSREPORT_WARNING;

View File

@ -360,7 +360,7 @@ js::IsInNonStrictPropertySet(JSContext *cx)
{
jsbytecode *pc;
JSScript *script = cx->currentScript(&pc, JSContext::ALLOW_CROSS_COMPARTMENT);
return script && !script->strict && (js_CodeSpec[*pc].format & JOF_SET);
return script && !script->strict() && (js_CodeSpec[*pc].format & JOF_SET);
}
JS_FRIEND_API(bool)

View File

@ -118,7 +118,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu
/* Callsite clones should never escape to script. */
JSObject &maybeClone = iter.calleev().toObject();
if (maybeClone.is<JSFunction>() && maybeClone.as<JSFunction>().nonLazyScript()->isCallsiteClone)
if (maybeClone.is<JSFunction>() && maybeClone.as<JSFunction>().nonLazyScript()->isCallsiteClone())
vp.setObject(*maybeClone.as<JSFunction>().nonLazyScript()->originalFunction());
else
vp.set(iter.calleev());
@ -640,7 +640,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
if (fun->hasScript()) {
script = fun->nonLazyScript();
if (script->isGeneratorExp) {
if (script->isGeneratorExp()) {
if ((!bodyOnly && !out.append("function genexp() {")) ||
!out.append("\n [generator expression]\n") ||
(!bodyOnly && !out.append("}")))
@ -701,7 +701,7 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
// have "use strict", we insert "use strict" into the body of the
// function. This ensures that if the result of toString is evaled, the
// resulting function will have the same semantics.
bool addUseStrict = script->strict && !script->explicitUseStrict && !fun->isArrow();
bool addUseStrict = script->strict() && !script->explicitUseStrict() && !fun->isArrow();
bool buildBody = funCon && !bodyOnly;
if (buildBody) {

View File

@ -99,8 +99,8 @@ class JSFunction : public JSObject
// Note: this should be kept in sync with FunctionBox::isHeavyweight().
return nonLazyScript()->bindings.hasAnyAliasedBindings() ||
nonLazyScript()->funHasExtensibleScope ||
nonLazyScript()->funNeedsDeclEnvObject;
nonLazyScript()->funHasExtensibleScope() ||
nonLazyScript()->funNeedsDeclEnvObject();
}
/* A function can be classified as either native (C++) or interpreted (JS): */
@ -166,7 +166,7 @@ class JSFunction : public JSObject
/* Returns the strictness of this function, which must be interpreted. */
bool strict() const {
return nonLazyScript()->strict;
return nonLazyScript()->strict();
}
// Can be called multiple times by the parser.

View File

@ -44,9 +44,9 @@ CanReuseFunctionForClone(JSContext *cx, HandleFunction fun)
lazy->setHasBeenCloned();
} else {
JSScript *script = fun->nonLazyScript();
if (script->hasBeenCloned)
if (script->hasBeenCloned())
return false;
script->hasBeenCloned = true;
script->setHasBeenCloned();
}
return true;
}

View File

@ -5373,7 +5373,7 @@ js::StopPCCountProfiling(JSContext *cx)
for (ZonesIter zone(rt, SkipAtoms); !zone.done(); zone.next()) {
for (CellIter i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) {
JSScript *script = i.get<JSScript>();
if (script->hasScriptCounts && script->types) {
if (script->hasScriptCounts() && script->types) {
ScriptAndCounts sac;
sac.script = script;
sac.scriptCounts.set(script->releaseScriptCounts());

View File

@ -968,9 +968,9 @@ types::FinishCompilation(JSContext *cx, HandleScript script, ExecutionMode execu
// If necessary, add constraints to trigger invalidation on the script
// after any future changes to the stack type sets.
if (entry.script->hasFreezeConstraints)
if (entry.script->hasFreezeConstraints())
continue;
entry.script->hasFreezeConstraints = true;
entry.script->setHasFreezeConstraints();
size_t count = TypeScript::NumTypeSets(entry.script);
@ -1932,7 +1932,7 @@ types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, JSProtoKey key
* arrays, but not normal arrays.
*/
if (script->function() && !script->treatAsRunOnce)
if (script->function() && !script->treatAsRunOnce())
return GenericObject;
if (key != JSProto_Object && !(key >= JSProto_Int8Array && key <= JSProto_Uint8ClampedArray))
@ -3402,7 +3402,7 @@ types::UseNewTypeForClone(JSFunction *fun)
if (!fun->isInterpreted())
return false;
if (fun->hasScript() && fun->nonLazyScript()->shouldCloneAtCallsite)
if (fun->hasScript() && fun->nonLazyScript()->shouldCloneAtCallsite())
return true;
if (fun->isArrow())
@ -3437,7 +3437,7 @@ types::UseNewTypeForClone(JSFunction *fun)
uint32_t begin, end;
if (fun->hasScript()) {
if (!fun->nonLazyScript()->usesArgumentsAndApply)
if (!fun->nonLazyScript()->usesArgumentsAndApply())
return false;
begin = fun->nonLazyScript()->sourceStart();
end = fun->nonLazyScript()->sourceEnd();
@ -4215,7 +4215,7 @@ TypeScript::Sweep(FreeOp *fop, JSScript *script)
* Freeze constraints on stack type sets need to be regenerated the next
* time the script is analyzed.
*/
script->hasFreezeConstraints = false;
script->clearHasFreezeConstraints();
}
void

View File

@ -707,7 +707,7 @@ TypeScript::InitObject(JSContext *cx, JSScript *script, jsbytecode *pc, JSProtoK
/* :XXX: Limit script->length so we don't need to check the offset up front? */
uint32_t offset = script->pcToOffset(pc);
if (!cx->typeInferenceEnabled() || !script->compileAndGo || offset >= AllocationSiteKey::OFFSET_LIMIT)
if (!cx->typeInferenceEnabled() || !script->compileAndGo() || offset >= AllocationSiteKey::OFFSET_LIMIT)
return GetTypeNewObject(cx, kind);
AllocationSiteKey key;

View File

@ -4222,7 +4222,7 @@ GetPropertyHelperInline(JSContext *cx,
return true;
/* Don't warn repeatedly for the same script. */
if (!script || script->warnedAboutUndefinedProp)
if (!script || script->warnedAboutUndefinedProp())
return true;
/* We may just be checking if that object has an iterator. */
@ -4237,7 +4237,7 @@ GetPropertyHelperInline(JSContext *cx,
}
unsigned flags = JSREPORT_WARNING | JSREPORT_STRICT;
script->warnedAboutUndefinedProp = true;
script->setWarnedAboutUndefinedProp();
/* Ok, bad undefined property reference: whine about it. */
RootedValue val(cx, IdToValue(id));
@ -4484,7 +4484,7 @@ MaybeReportUndeclaredVarAssignment(JSContext *cx, JSString *propname)
// If the code is not strict and extra warnings aren't enabled, then no
// check is needed.
if (!script->strict && !cx->options().extraWarnings())
if (!script->strict() && !cx->options().extraWarnings())
return true;
}
@ -4508,7 +4508,7 @@ js::ReportIfUndeclaredVarAssignment(JSContext *cx, HandleString propname)
// If the code is not strict and extra warnings aren't enabled, then no
// check is needed.
if (!script->strict && !cx->options().extraWarnings())
if (!script->strict() && !cx->options().extraWarnings())
return true;
/*

View File

@ -277,7 +277,7 @@ js::DumpIonScriptCounts(Sprinter *sp, jit::IonScriptCounts *ionCounts)
void
js_DumpPCCounts(JSContext *cx, HandleScript script, js::Sprinter *sp)
{
JS_ASSERT(script->hasScriptCounts);
JS_ASSERT(script->hasScriptCounts());
#ifdef DEBUG
jsbytecode *pc = script->code();
@ -2365,7 +2365,7 @@ js::GetPCCountScriptContents(JSContext *cx, size_t index)
StringBuffer buf(cx);
if (!script->function() && !script->compileAndGo)
if (!script->function() && !script->compileAndGo())
return buf.finishString();
{

View File

@ -477,23 +477,23 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
nTypeSets = script->nTypeSets();
funLength = script->funLength();
if (script->noScriptRval)
if (script->noScriptRval())
scriptBits |= (1 << NoScriptRval);
if (script->savedCallerFun)
if (script->savedCallerFun())
scriptBits |= (1 << SavedCallerFun);
if (script->strict)
if (script->strict())
scriptBits |= (1 << Strict);
if (script->explicitUseStrict)
if (script->explicitUseStrict())
scriptBits |= (1 << ExplicitUseStrict);
if (script->selfHosted)
if (script->selfHosted())
scriptBits |= (1 << SelfHosted);
if (script->bindingsAccessedDynamically)
if (script->bindingsAccessedDynamically())
scriptBits |= (1 << ContainsDynamicNameAccess);
if (script->funHasExtensibleScope)
if (script->funHasExtensibleScope())
scriptBits |= (1 << FunHasExtensibleScope);
if (script->funNeedsDeclEnvObject)
if (script->funNeedsDeclEnvObject())
scriptBits |= (1 << FunNeedsDeclEnvObject);
if (script->funHasAnyAliasedFormal)
if (script->funHasAnyAliasedFormal())
scriptBits |= (1 << FunHasAnyAliasedFormal);
if (script->argumentsHasVarBinding())
scriptBits |= (1 << ArgumentsHasVarBinding);
@ -501,15 +501,15 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
scriptBits |= (1 << NeedsArgsObj);
if (!enclosingScript || enclosingScript->scriptSource() != script->scriptSource())
scriptBits |= (1 << OwnSource);
if (script->isGeneratorExp)
if (script->isGeneratorExp())
scriptBits |= (1 << IsGeneratorExp);
if (script->isLegacyGenerator())
scriptBits |= (1 << IsLegacyGenerator);
if (script->isStarGenerator())
scriptBits |= (1 << IsStarGenerator);
JS_ASSERT(!script->compileAndGo);
JS_ASSERT(!script->hasSingletons);
JS_ASSERT(!script->compileAndGo());
JS_ASSERT(!script->hasSingletons());
}
if (!xdr->codeUint32(&prologLength))
@ -599,23 +599,23 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
scriptp.set(script);
if (scriptBits & (1 << Strict))
script->strict = true;
script->strict_ = true;
if (scriptBits & (1 << ExplicitUseStrict))
script->explicitUseStrict = true;
script->explicitUseStrict_ = true;
if (scriptBits & (1 << ContainsDynamicNameAccess))
script->bindingsAccessedDynamically = true;
script->bindingsAccessedDynamically_ = true;
if (scriptBits & (1 << FunHasExtensibleScope))
script->funHasExtensibleScope = true;
script->funHasExtensibleScope_ = true;
if (scriptBits & (1 << FunNeedsDeclEnvObject))
script->funNeedsDeclEnvObject = true;
script->funNeedsDeclEnvObject_ = true;
if (scriptBits & (1 << FunHasAnyAliasedFormal))
script->funHasAnyAliasedFormal = true;
script->funHasAnyAliasedFormal_ = true;
if (scriptBits & (1 << ArgumentsHasVarBinding))
script->setArgumentsHasVarBinding();
if (scriptBits & (1 << NeedsArgsObj))
script->setNeedsArgsObj(true);
if (scriptBits & (1 << IsGeneratorExp))
script->isGeneratorExp = true;
script->isGeneratorExp_ = true;
if (scriptBits & (1 << IsLegacyGenerator)) {
JS_ASSERT(!(scriptBits & (1 << IsStarGenerator)));
@ -843,7 +843,7 @@ JSScript::scriptSource() const {
bool
JSScript::initScriptCounts(JSContext *cx)
{
JS_ASSERT(!hasScriptCounts);
JS_ASSERT(!hasScriptCounts());
size_t n = 0;
@ -887,7 +887,7 @@ JSScript::initScriptCounts(JSContext *cx)
js_free(base);
return false;
}
hasScriptCounts = true; // safe to set this; we can't fail after this point
hasScriptCounts_ = true; // safe to set this; we can't fail after this point
JS_ASSERT(size_t(cursor - base) == bytes);
@ -902,7 +902,7 @@ JSScript::initScriptCounts(JSContext *cx)
static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(JSScript *script)
{
JS_ASSERT(script->hasScriptCounts);
JS_ASSERT(script->hasScriptCounts());
ScriptCountsMap *map = script->compartment()->scriptCountsMap;
ScriptCountsMap::Ptr p = map->lookup(script);
JS_ASSERT(p);
@ -938,14 +938,14 @@ JSScript::releaseScriptCounts()
ScriptCountsMap::Ptr p = GetScriptCountsMapEntry(this);
ScriptCounts counts = p->value();
compartment()->scriptCountsMap->remove(p);
hasScriptCounts = false;
hasScriptCounts_ = false;
return counts;
}
void
JSScript::destroyScriptCounts(FreeOp *fop)
{
if (hasScriptCounts) {
if (hasScriptCounts()) {
ScriptCounts scriptCounts = releaseScriptCounts();
scriptCounts.destroy(fop);
}
@ -1784,12 +1784,12 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa
new (&script->bindings) Bindings;
script->enclosingScopeOrOriginalFunction_ = enclosingScope;
script->savedCallerFun = savedCallerFun;
script->savedCallerFun_ = savedCallerFun;
script->initCompartment(cx);
script->compileAndGo = options.compileAndGo;
script->selfHosted = options.selfHostingMode;
script->noScriptRval = options.noScriptRval;
script->compileAndGo_ = options.compileAndGo;
script->selfHosted_ = options.selfHostingMode;
script->noScriptRval_ = options.noScriptRval;
script->version = options.version;
JS_ASSERT(script->getVersion() == options.version); // assert that no overflow occurred
@ -1990,12 +1990,12 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
bce->tryNoteList.finish(script->trynotes());
if (bce->blockScopeList.length() != 0)
bce->blockScopeList.finish(script->blockScopes());
script->strict = bce->sc->strict;
script->explicitUseStrict = bce->sc->hasExplicitUseStrict();
script->bindingsAccessedDynamically = bce->sc->bindingsAccessedDynamically();
script->funHasExtensibleScope = funbox ? funbox->hasExtensibleScope() : false;
script->funNeedsDeclEnvObject = funbox ? funbox->needsDeclEnvObject() : false;
script->hasSingletons = bce->hasSingletons;
script->strict_ = bce->sc->strict;
script->explicitUseStrict_ = bce->sc->hasExplicitUseStrict();
script->bindingsAccessedDynamically_ = bce->sc->bindingsAccessedDynamically();
script->funHasExtensibleScope_ = funbox ? funbox->hasExtensibleScope() : false;
script->funNeedsDeclEnvObject_ = funbox ? funbox->needsDeclEnvObject() : false;
script->hasSingletons_ = bce->hasSingletons;
if (funbox) {
if (funbox->argumentsHasLocalBinding()) {
@ -2012,15 +2012,15 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
RootedFunction fun(cx, nullptr);
if (funbox) {
JS_ASSERT(!bce->script->noScriptRval);
script->isGeneratorExp = funbox->inGenexpLambda;
JS_ASSERT(!bce->script->noScriptRval());
script->isGeneratorExp_ = funbox->inGenexpLambda;
script->setGeneratorKind(funbox->generatorKind());
script->setFunction(funbox->function());
}
for (unsigned i = 0, n = script->bindings.numArgs(); i < n; ++i) {
if (script->formalIsAliased(i)) {
script->funHasAnyAliasedFormal = true;
script->funHasAnyAliasedFormal_ = true;
break;
}
}
@ -2093,10 +2093,10 @@ JSScript::enclosingScriptsCompiledSuccessfully() const
void
js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
{
if (script->selfHosted)
if (script->selfHosted())
return;
JS_ASSERT(!script->isActiveEval);
JS_ASSERT(!script->isActiveEval());
if (JSNewScriptHook hook = cx->runtime()->debugHooks.newScriptHook) {
AutoKeepAtoms keepAtoms(cx->perThreadData);
hook(cx, script->filename(), script->lineno(), script, fun,
@ -2107,7 +2107,7 @@ js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
void
js::CallDestroyScriptHook(FreeOp *fop, JSScript *script)
{
if (script->selfHosted)
if (script->selfHosted())
return;
// The hook will only call into JS if a GC is not running.
@ -2473,12 +2473,12 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
CompileOptions options(cx);
options.setPrincipals(cx->compartment()->principals)
.setOriginPrincipals(src->originPrincipals())
.setCompileAndGo(src->compileAndGo)
.setSelfHostingMode(src->selfHosted)
.setNoScriptRval(src->noScriptRval)
.setCompileAndGo(src->compileAndGo())
.setSelfHostingMode(src->selfHosted())
.setNoScriptRval(src->noScriptRval())
.setVersion(src->getVersion());
RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun,
RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun(),
options, src->staticLevel(),
sourceObject, src->sourceStart(), src->sourceEnd()));
if (!dst) {
@ -2511,21 +2511,21 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
dst->setNeedsArgsObj(src->needsArgsObj());
}
dst->cloneHasArray(src);
dst->strict = src->strict;
dst->explicitUseStrict = src->explicitUseStrict;
dst->bindingsAccessedDynamically = src->bindingsAccessedDynamically;
dst->funHasExtensibleScope = src->funHasExtensibleScope;
dst->funNeedsDeclEnvObject = src->funNeedsDeclEnvObject;
dst->funHasAnyAliasedFormal = src->funHasAnyAliasedFormal;
dst->hasSingletons = src->hasSingletons;
dst->treatAsRunOnce = src->treatAsRunOnce;
dst->isGeneratorExp = src->isGeneratorExp;
dst->strict_ = src->strict();
dst->explicitUseStrict_ = src->explicitUseStrict();
dst->bindingsAccessedDynamically_ = src->bindingsAccessedDynamically();
dst->funHasExtensibleScope_ = src->funHasExtensibleScope();
dst->funNeedsDeclEnvObject_ = src->funNeedsDeclEnvObject();
dst->funHasAnyAliasedFormal_ = src->funHasAnyAliasedFormal();
dst->hasSingletons_ = src->hasSingletons();
dst->treatAsRunOnce_ = src->treatAsRunOnce();
dst->isGeneratorExp_ = src->isGeneratorExp();
dst->setGeneratorKind(src->generatorKind());
/* Copy over hints. */
dst->shouldInline = src->shouldInline;
dst->shouldCloneAtCallsite = src->shouldCloneAtCallsite;
dst->isCallsiteClone = src->isCallsiteClone;
dst->shouldInline_ = src->shouldInline();
dst->shouldCloneAtCallsite_ = src->shouldCloneAtCallsite();
dst->isCallsiteClone_ = src->isCallsiteClone();
if (nconsts != 0) {
HeapValue *vector = Rebase<HeapValue>(dst, src, src->consts()->vector);
@ -2578,7 +2578,7 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c
script = clone->nonLazyScript();
CallNewScriptHook(cx, script, clone);
RootedGlobalObject global(cx, script->compileAndGo ? &script->global() : nullptr);
RootedGlobalObject global(cx, script->compileAndGo() ? &script->global() : nullptr);
Debugger::onNewScript(cx, script, global);
return true;
@ -2587,7 +2587,7 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c
DebugScript *
JSScript::debugScript()
{
JS_ASSERT(hasDebugScript);
JS_ASSERT(hasDebugScript_);
DebugScriptMap *map = compartment()->debugScriptMap;
JS_ASSERT(map);
DebugScriptMap::Ptr p = map->lookup(this);
@ -2598,21 +2598,21 @@ JSScript::debugScript()
DebugScript *
JSScript::releaseDebugScript()
{
JS_ASSERT(hasDebugScript);
JS_ASSERT(hasDebugScript_);
DebugScriptMap *map = compartment()->debugScriptMap;
JS_ASSERT(map);
DebugScriptMap::Ptr p = map->lookup(this);
JS_ASSERT(p);
DebugScript *debug = p->value();
map->remove(p);
hasDebugScript = false;
hasDebugScript_ = false;
return debug;
}
void
JSScript::destroyDebugScript(FreeOp *fop)
{
if (hasDebugScript) {
if (hasDebugScript_) {
for (jsbytecode *pc = code(); pc < codeEnd(); pc++) {
if (BreakpointSite *site = getBreakpointSite(pc)) {
/* Breakpoints are swept before finalization. */
@ -2628,7 +2628,7 @@ JSScript::destroyDebugScript(FreeOp *fop)
bool
JSScript::ensureHasDebugScript(JSContext *cx)
{
if (hasDebugScript)
if (hasDebugScript_)
return true;
size_t nbytes = offsetof(DebugScript, breakpoints) + length() * sizeof(BreakpointSite*);
@ -2652,7 +2652,7 @@ JSScript::ensureHasDebugScript(JSContext *cx)
js_free(debug);
return false;
}
hasDebugScript = true; // safe to set this; we can't fail after this point
hasDebugScript_ = true; // safe to set this; we can't fail after this point
/*
* Ensure that any Interpret() instances running on this script have
@ -2679,7 +2679,7 @@ JSScript::recompileForStepMode(FreeOp *fop)
bool
JSScript::tryNewStepMode(JSContext *cx, uint32_t newValue)
{
JS_ASSERT(hasDebugScript);
JS_ASSERT(hasDebugScript_);
DebugScript *debug = debugScript();
uint32_t prior = debug->stepMode;

View File

@ -637,74 +637,95 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
// The GeneratorKind of the script.
uint8_t generatorKindBits_:2;
// Unused padding; feel free to steal these if you need them.
uint8_t padToByte_:1;
// 1-bit fields.
public:
bool noScriptRval:1; /* no need for result value of last
expression statement */
bool savedCallerFun:1; /* can call getCallerFunction() */
bool strict:1; /* code is in strict mode */
bool explicitUseStrict:1; /* code has "use strict"; explicitly */
bool compileAndGo:1; /* see Parser::compileAndGo */
bool selfHosted:1; /* see Parser::selfHostingMode */
bool bindingsAccessedDynamically:1; /* see FunctionContextFlags */
bool funHasExtensibleScope:1; /* see FunctionContextFlags */
bool funNeedsDeclEnvObject:1; /* see FunctionContextFlags */
bool funHasAnyAliasedFormal:1; /* true if any formalIsAliased(i) */
bool warnedAboutUndefinedProp:1; /* have warned about uses of
undefined properties in this
script */
bool hasSingletons:1; /* script has singleton objects */
bool treatAsRunOnce:1; /* script is a lambda to treat as running once. */
bool hasRunOnce:1; /* if treatAsRunOnce, whether script has executed. */
bool hasBeenCloned:1; /* script has been reused for a clone. */
bool isActiveEval:1; /* script came from eval(), and is still active */
bool isCachedEval:1; /* script came from eval(), and is in eval cache */
// No need for result value of last expression statement.
bool noScriptRval_:1;
// Can call getCallerFunction().
bool savedCallerFun_:1;
// Code is in strict mode.
bool strict_:1;
// Code has "use strict"; explicitly.
bool explicitUseStrict_:1;
// See Parser::compileAndGo.
bool compileAndGo_:1;
// see Parser::selfHostingMode.
bool selfHosted_:1;
// See FunctionContextFlags.
bool bindingsAccessedDynamically_:1;
bool funHasExtensibleScope_:1;
bool funNeedsDeclEnvObject_:1;
// True if any formalIsAliased(i).
bool funHasAnyAliasedFormal_:1;
// Have warned about uses of undefined properties in this script.
bool warnedAboutUndefinedProp_:1;
// Script has singleton objects.
bool hasSingletons_:1;
// Script is a lambda to treat as running once.
bool treatAsRunOnce_:1;
// If treatAsRunOnce, whether script has executed.
bool hasRunOnce_:1;
// Script has been reused for a clone.
bool hasBeenCloned_:1;
// Script came from eval(), and is still active.
bool isActiveEval_:1;
// Script came from eval(), and is in eval cache.
bool isCachedEval_:1;
// Set for functions defined at the top level within an 'eval' script.
bool directlyInsideEval:1;
bool directlyInsideEval_:1;
// Both 'arguments' and f.apply() are used. This is likely to be a wrapper.
bool usesArgumentsAndApply:1;
bool usesArgumentsAndApply_:1;
/* script is attempted to be cloned anew at each callsite. This is
temporarily needed for ParallelArray selfhosted code until type
information can be made context sensitive. See discussion in
bug 826148. */
bool shouldCloneAtCallsite:1;
bool isCallsiteClone:1; /* is a callsite clone; has a link to the original function */
bool shouldInline:1; /* hint to inline when possible */
bool uninlineable:1; /* explicitly marked as uninlineable */
#ifdef JS_ION
bool failedBoundsCheck:1; /* script has had hoisted bounds checks fail */
bool failedShapeGuard:1; /* script has had hoisted shape guard fail */
bool hadFrequentBailouts:1;
#else
bool failedBoundsCheckPad:1;
bool failedShapeGuardPad:1;
bool hadFrequentBailoutsPad:1;
#endif
bool invalidatedIdempotentCache:1; /* idempotent cache has triggered invalidation */
bool shouldCloneAtCallsite_:1;
bool isCallsiteClone_:1; /* is a callsite clone; has a link to the original function */
bool shouldInline_:1; /* hint to inline when possible */
// IonMonkey compilation hints.
bool failedBoundsCheck_:1; /* script has had hoisted bounds checks fail */
bool failedShapeGuard_:1; /* script has had hoisted shape guard fail */
bool hadFrequentBailouts_:1;
bool uninlineable_:1; /* explicitly marked as uninlineable */
// Idempotent cache has triggered invalidation.
bool invalidatedIdempotentCache_:1;
// If the generator was created implicitly via a generator expression,
// isGeneratorExp will be true.
bool isGeneratorExp:1;
bool isGeneratorExp_:1;
bool hasScriptCounts:1;/* script has an entry in
JSCompartment::scriptCountsMap */
bool hasDebugScript:1; /* script has an entry in
JSCompartment::debugScriptMap */
bool hasFreezeConstraints:1; /* freeze constraints for stack
* type sets have been generated */
// Script has an entry in JSCompartment::scriptCountsMap.
bool hasScriptCounts_:1;
// Script has an entry in JSCompartment::debugScriptMap.
bool hasDebugScript_:1;
// Freeze constraints for stack type sets have been generated.
bool hasFreezeConstraints_:1;
private:
/* See comments below. */
bool argsHasVarBinding_:1;
bool needsArgsAnalysis_:1;
bool needsArgsObj_:1;
bool argsHasVarBinding_:1;
bool needsArgsAnalysis_:1;
bool needsArgsObj_:1;
//
// End of fields. Start methods.
@ -819,12 +840,98 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
return sourceEnd_;
}
bool noScriptRval() const {
js::AutoThreadSafeAccess ts(this);
return noScriptRval_;
}
bool savedCallerFun() const { return savedCallerFun_; }
bool strict() const {
js::AutoThreadSafeAccess ts(this);
return strict_;
}
bool explicitUseStrict() const { return explicitUseStrict_; }
bool compileAndGo() const {
js::AutoThreadSafeAccess ts(this);
return compileAndGo_;
}
bool selfHosted() const { return selfHosted_; }
bool bindingsAccessedDynamically() const { return bindingsAccessedDynamically_; }
bool funHasExtensibleScope() const { return funHasExtensibleScope_; }
bool funNeedsDeclEnvObject() const { return funNeedsDeclEnvObject_; }
bool funHasAnyAliasedFormal() const { return funHasAnyAliasedFormal_; }
bool hasSingletons() const { return hasSingletons_; }
bool treatAsRunOnce() const { return treatAsRunOnce_; }
bool hasRunOnce() const { return hasRunOnce_; }
bool hasBeenCloned() const { return hasBeenCloned_; }
void setTreatAsRunOnce() { treatAsRunOnce_ = true; }
void setHasRunOnce() { hasRunOnce_ = true; }
void setHasBeenCloned() { hasBeenCloned_ = true; }
bool isActiveEval() const { return isActiveEval_; }
bool isCachedEval() const { return isCachedEval_; }
bool directlyInsideEval() const { return directlyInsideEval_; }
void cacheForEval() {
JS_ASSERT(isActiveEval() && !isCachedEval());
isActiveEval_ = false;
isCachedEval_ = true;
}
void uncacheForEval() {
JS_ASSERT(isCachedEval() && !isActiveEval());
isCachedEval_ = false;
isActiveEval_ = true;
}
void setActiveEval() { isActiveEval_ = true; }
void setDirectlyInsideEval() { directlyInsideEval_ = true; }
bool usesArgumentsAndApply() const { return usesArgumentsAndApply_; }
void setUsesArgumentsAndApply() { usesArgumentsAndApply_ = true; }
bool shouldCloneAtCallsite() const { return shouldCloneAtCallsite_; }
bool shouldInline() const { return shouldInline_; }
void setShouldCloneAtCallsite() { shouldCloneAtCallsite_ = true; }
void setShouldInline() { shouldInline_ = true; }
bool isCallsiteClone() const { return isCallsiteClone_; }
bool isGeneratorExp() const { return isGeneratorExp_; }
bool failedBoundsCheck() const { return failedBoundsCheck_; }
bool failedShapeGuard() const { return failedShapeGuard_; }
bool hadFrequentBailouts() const { return hadFrequentBailouts_; }
bool uninlineable() const { return uninlineable_; }
bool invalidatedIdempotentCache() const { return invalidatedIdempotentCache_; }
void setFailedBoundsCheck() { failedBoundsCheck_ = true; }
void setFailedShapeGuard() { failedShapeGuard_ = true; }
void setHadFrequentBailouts() { hadFrequentBailouts_ = true; }
void setUninlineable() { uninlineable_ = true; }
void setInvalidatedIdempotentCache() { invalidatedIdempotentCache_ = true; }
bool hasScriptCounts() const { return hasScriptCounts_; }
bool hasFreezeConstraints() const { return hasFreezeConstraints_; }
void setHasFreezeConstraints() { hasFreezeConstraints_ = true; }
void clearHasFreezeConstraints() { hasFreezeConstraints_ = false; }
bool warnedAboutUndefinedProp() const { return warnedAboutUndefinedProp_; }
void setWarnedAboutUndefinedProp() { warnedAboutUndefinedProp_ = true; }
/* See ContextFlags::funArgumentsHasLocalBinding comment. */
bool argumentsHasVarBinding() const { return argsHasVarBinding_; }
jsbytecode *argumentsBytecode() const { JS_ASSERT(code()[0] == JSOP_ARGUMENTS); return code(); }
void setArgumentsHasVarBinding();
bool argumentsAliasesFormals() const {
return argumentsHasVarBinding() && !strict;
return argumentsHasVarBinding() && !strict();
}
js::GeneratorKind generatorKind() const {
@ -865,7 +972,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
* opcodes won't be emitted at all.
*/
bool argsObjAliasesFormals() const {
return needsArgsObj() && !strict;
return needsArgsObj() && !strict();
}
bool hasAnyIonScript() const {
@ -963,7 +1070,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
inline void setFunction(JSFunction *fun);
JSFunction *originalFunction() const;
void setOriginalFunctionObject(JSObject *fun);
void setIsCallsiteClone(JSObject *fun);
JSFlatString *sourceData(JSContext *cx);
@ -978,7 +1085,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
public:
/* Return whether this script was compiled for 'eval' */
bool isForEval() { return isCachedEval || isActiveEval; }
bool isForEval() { return isCachedEval() || isActiveEval(); }
#ifdef DEBUG
unsigned id();
@ -1007,7 +1114,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
/* See StaticScopeIter comment. */
JSObject *enclosingStaticScope() const {
if (isCallsiteClone)
if (isCallsiteClone())
return nullptr;
return enclosingScopeOrOriginalFunction_;
}
@ -1137,7 +1244,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
size_t innerObjectsStart() {
// The first object contains the caller if savedCallerFun is used.
return savedCallerFun ? 1 : 0;
return savedCallerFun() ? 1 : 0;
}
JSObject *getObject(jsbytecode *pc) {
@ -1171,7 +1278,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
return false;
jsbytecode *pc = code();
if (noScriptRval && JSOp(*pc) == JSOP_FALSE)
if (noScriptRval() && JSOp(*pc) == JSOP_FALSE)
++pc;
return JSOp(*pc) == JSOP_RETRVAL;
}
@ -1197,11 +1304,11 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
public:
bool hasBreakpointsAt(jsbytecode *pc);
bool hasAnyBreakpointsOrStepMode() { return hasDebugScript; }
bool hasAnyBreakpointsOrStepMode() { return hasDebugScript_; }
js::BreakpointSite *getBreakpointSite(jsbytecode *pc)
{
return hasDebugScript ? debugScript()->breakpoints[pcToOffset(pc)] : nullptr;
return hasDebugScript_ ? debugScript()->breakpoints[pcToOffset(pc)] : nullptr;
}
js::BreakpointSite *getOrCreateBreakpointSite(JSContext *cx, jsbytecode *pc);
@ -1229,10 +1336,10 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
*/
bool changeStepModeCount(JSContext *cx, int delta);
bool stepModeEnabled() { return hasDebugScript && !!debugScript()->stepMode; }
bool stepModeEnabled() { return hasDebugScript_ && !!debugScript()->stepMode; }
#ifdef DEBUG
uint32_t stepModeCount() { return hasDebugScript ? (debugScript()->stepMode & stepCountMask) : 0; }
uint32_t stepModeCount() { return hasDebugScript_ ? (debugScript()->stepMode & stepCountMask) : 0; }
#endif
void finalize(js::FreeOp *fop);

View File

@ -28,7 +28,7 @@ inline
AliasedFormalIter::AliasedFormalIter(JSScript *script)
: begin_(script->bindings.bindingArray()),
p_(begin_),
end_(begin_ + (script->funHasAnyAliasedFormal ? script->bindings.numArgs() : 0)),
end_(begin_ + (script->funHasAnyAliasedFormal() ? script->bindings.numArgs() : 0)),
slot_(CallObject::RESERVED_SLOTS)
{
settle();
@ -67,7 +67,7 @@ JSScript::getFunction(size_t index)
inline JSFunction *
JSScript::getCallerFunction()
{
JS_ASSERT(savedCallerFun);
JS_ASSERT(savedCallerFun());
return getFunction(0);
}
@ -76,7 +76,7 @@ JSScript::functionOrCallerFunction()
{
if (function())
return function();
if (savedCallerFun)
if (savedCallerFun())
return getCallerFunction();
return nullptr;
}
@ -109,14 +109,17 @@ JSScript::principals()
inline JSFunction *
JSScript::originalFunction() const {
if (!isCallsiteClone)
if (!isCallsiteClone())
return nullptr;
return &enclosingScopeOrOriginalFunction_->as<JSFunction>();
}
inline void
JSScript::setOriginalFunctionObject(JSObject *fun) {
JS_ASSERT(isCallsiteClone);
JSScript::setIsCallsiteClone(JSObject *fun) {
JS_ASSERT(shouldCloneAtCallsite());
shouldCloneAtCallsite_ = false;
isCallsiteClone_ = true;
JS_ASSERT(isCallsiteClone());
JS_ASSERT(fun->is<JSFunction>());
enclosingScopeOrOriginalFunction_ = fun;
}

View File

@ -646,7 +646,7 @@ WorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void *toke
if (script) {
// The Debugger only needs to be told about the topmost script that was compiled.
GlobalObject *compileAndGoGlobal = nullptr;
if (script->compileAndGo)
if (script->compileAndGo())
compileAndGoGlobal = &script->global();
Debugger::onNewScript(maybecx, script, compileAndGoGlobal);

View File

@ -2293,7 +2293,7 @@ Clone(JSContext *cx, unsigned argc, jsval *vp)
}
if (funobj->compartment() != cx->compartment()) {
JSFunction *fun = &funobj->as<JSFunction>();
if (fun->hasScript() && fun->nonLazyScript()->compileAndGo) {
if (fun->hasScript() && fun->nonLazyScript()->compileAndGo()) {
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_UNEXPECTED_TYPE,
"function", "compile-and-go");
return false;

View File

@ -1108,12 +1108,12 @@ AddNewScriptRecipients(GlobalObject::DebuggerVector *src, AutoValueVector *dest)
void
Debugger::slowPathOnNewScript(JSContext *cx, HandleScript script, GlobalObject *compileAndGoGlobal_)
{
if (script->selfHosted)
if (script->selfHosted())
return;
Rooted<GlobalObject*> compileAndGoGlobal(cx, compileAndGoGlobal_);
JS_ASSERT(script->compileAndGo == !!compileAndGoGlobal);
JS_ASSERT(script->compileAndGo() == !!compileAndGoGlobal);
/*
* Build the list of recipients. For compile-and-go scripts, this is the
@ -1122,7 +1122,7 @@ Debugger::slowPathOnNewScript(JSContext *cx, HandleScript script, GlobalObject *
* debugger observing any global in the script's compartment.
*/
AutoValueVector triggered(cx);
if (script->compileAndGo) {
if (script->compileAndGo()) {
if (GlobalObject::DebuggerVector *debuggers = compileAndGoGlobal->getDebuggers()) {
if (!AddNewScriptRecipients(debuggers, &triggered))
return;
@ -1277,7 +1277,7 @@ Debugger::onSingleStep(JSContext *cx, MutableHandleValue vp)
}
}
}
if (trappingScript->compileAndGo)
if (trappingScript->compileAndGo())
JS_ASSERT(stepperCount == trappingScript->stepModeCount());
else
JS_ASSERT(stepperCount <= trappingScript->stepModeCount());
@ -2571,7 +2571,7 @@ class Debugger::ScriptQuery {
* condition occurred.
*/
void consider(JSScript *script) {
if (oom || script->selfHosted)
if (oom || script->selfHosted())
return;
JSCompartment *compartment = script->compartment();
if (!compartments.has(compartment))
@ -3438,7 +3438,7 @@ Debugger::observesScript(JSScript *script) const
{
if (!enabled)
return false;
return observesGlobal(&script->global()) && !script->selfHosted;
return observesGlobal(&script->global()) && !script->selfHosted();
}
/* static */ bool
@ -4347,7 +4347,7 @@ js::EvaluateInEnv(JSContext *cx, Handle<Env*> env, HandleValue thisv, AbstractFr
if (!script)
return false;
script->isActiveEval = true;
script->setActiveEval();
ExecuteType type = !frame ? EXECUTE_DEBUG_GLOBAL : EXECUTE_DEBUG;
return ExecuteKernel(cx, script, *env, thisv, type, frame, rval.address());
}

View File

@ -710,14 +710,14 @@ Debugger::onExceptionUnwind(JSContext *cx, MutableHandleValue vp)
void
Debugger::onNewScript(JSContext *cx, HandleScript script, GlobalObject *compileAndGoGlobal)
{
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal);
JS_ASSERT_IF(script->compileAndGo, compileAndGoGlobal == &script->uninlinedGlobal());
JS_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal);
JS_ASSERT_IF(script->compileAndGo(), compileAndGoGlobal == &script->uninlinedGlobal());
// We early return in slowPathOnNewScript for self-hosted scripts, so we can
// ignore those in our assertion here.
JS_ASSERT_IF(!script->compartment()->options().invisibleToDebugger() &&
!script->selfHosted,
!script->selfHosted(),
script->compartment()->firedOnNewGlobalObject);
JS_ASSERT_IF(!script->compileAndGo, !compileAndGoGlobal);
JS_ASSERT_IF(!script->compileAndGo(), !compileAndGoGlobal);
if (!script->compartment()->getDebuggees().empty())
slowPathOnNewScript(cx, script, compileAndGoGlobal);
}

View File

@ -227,7 +227,7 @@ SetNameOperation(JSContext *cx, JSScript *script, jsbytecode *pc, HandleObject s
JS_ASSERT(*pc == JSOP_SETNAME || *pc == JSOP_SETGNAME);
JS_ASSERT_IF(*pc == JSOP_SETGNAME, scope == cx->global());
bool strict = script->strict;
bool strict = script->strict();
RootedPropertyName name(cx, script->getName(pc));
RootedValue valCopy(cx, val);

View File

@ -331,12 +331,12 @@ SetPropertyOperation(JSContext *cx, HandleScript script, jsbytecode *pc, HandleV
RootedId id(cx, NameToId(script->getName(pc)));
if (JS_LIKELY(!obj->getOps()->setProperty)) {
if (!baseops::SetPropertyHelper<SequentialExecution>(cx, obj, obj, id, 0,
&rref, script->strict))
&rref, script->strict()))
{
return false;
}
} else {
if (!JSObject::setGeneric(cx, obj, obj, id, &rref, script->strict))
if (!JSObject::setGeneric(cx, obj, obj, id, &rref, script->strict()))
return false;
}
@ -1298,14 +1298,14 @@ Interpret(JSContext *cx, RunState &state)
#define SET_SCRIPT(s) \
JS_BEGIN_MACRO \
script = (s); \
if (script->hasAnyBreakpointsOrStepMode() || script->hasScriptCounts) \
if (script->hasAnyBreakpointsOrStepMode() || script->hasScriptCounts()) \
activation.enableInterruptsUnconditionally(); \
JS_END_MACRO
#define SANITY_CHECKS() \
JS_BEGIN_MACRO \
js::gc::MaybeVerifyBarriers(cx); \
JS_ASSERT_IF(script->hasScriptCounts, \
JS_ASSERT_IF(script->hasScriptCounts(), \
activation.opMask() == EnableInterruptsPseudoOpcode); \
JS_END_MACRO
@ -1401,12 +1401,12 @@ CASE(EnableInterruptsPseudoOpcode)
jsbytecode op = *REGS.pc;
if (cx->runtime()->profilingScripts) {
if (!script->hasScriptCounts)
if (!script->hasScriptCounts())
script->initScriptCounts(cx);
moreInterrupts = true;
}
if (script->hasScriptCounts) {
if (script->hasScriptCounts()) {
PCCounts counts = script->getPCCounts(REGS.pc);
counts.get(PCCounts::BASE_INTERP)++;
moreInterrupts = true;
@ -2176,7 +2176,7 @@ END_CASE(JSOP_POS)
CASE(JSOP_DELNAME)
{
/* Strict mode code should never contain JSOP_DELNAME opcodes. */
JS_ASSERT(!script->strict);
JS_ASSERT(!script->strict());
RootedPropertyName &name = rootName0;
name = script->getName(REGS.pc);
@ -2202,7 +2202,7 @@ CASE(JSOP_DELPROP)
bool succeeded;
if (!JSObject::deleteProperty(cx, obj, name, &succeeded))
goto error;
if (!succeeded && script->strict) {
if (!succeeded && script->strict()) {
obj->reportNotConfigurable(cx, NameToId(name));
goto error;
}
@ -2223,7 +2223,7 @@ CASE(JSOP_DELELEM)
bool succeeded;
if (!JSObject::deleteByValue(cx, obj, propval, &succeeded))
goto error;
if (!succeeded && script->strict) {
if (!succeeded && script->strict()) {
// XXX This observably calls ToString(propval). We should convert to
// PropertyKey and use that to delete, and to report an error if
// necessary!
@ -2358,7 +2358,7 @@ CASE(JSOP_SETELEM)
RootedId &id = rootId0;
FETCH_ELEMENT_ID(-2, id);
Value &value = REGS.sp[-1];
if (!SetObjectElementOperation(cx, obj, id, value, script->strict))
if (!SetObjectElementOperation(cx, obj, id, value, script->strict()))
goto error;
REGS.sp[-3] = value;
REGS.sp -= 2;
@ -2375,7 +2375,7 @@ CASE(JSOP_ENUMELEM)
RootedId &id = rootId0;
FETCH_ELEMENT_ID(-1, id);
rval = REGS.sp[-3];
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strict))
if (!JSObject::setGeneric(cx, obj, obj, id, &rval, script->strict()))
goto error;
REGS.sp -= 3;
}
@ -2488,7 +2488,7 @@ CASE(JSOP_FUNCALL)
funScript = fun->getOrCreateScript(cx);
if (!funScript)
goto error;
if (cx->typeInferenceEnabled() && funScript->shouldCloneAtCallsite) {
if (cx->typeInferenceEnabled() && funScript->shouldCloneAtCallsite()) {
fun = CloneFunctionAtCallsite(cx, fun, script, REGS.pc);
if (!fun)
goto error;
@ -3022,7 +3022,7 @@ CASE(JSOP_INITPROP)
if (JS_UNLIKELY(name == cx->names().proto)
? !baseops::SetPropertyHelper<SequentialExecution>(cx, obj, obj, id, 0, &rval,
script->strict)
script->strict())
: !DefineNativeProperty(cx, obj, id, rval, nullptr, nullptr,
JSPROP_ENUMERATE, 0, 0, 0)) {
goto error;
@ -3596,7 +3596,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
if (!fun)
return false;
} else {
JS_ASSERT(script->compileAndGo);
JS_ASSERT(script->compileAndGo());
JS_ASSERT(!script->function());
}
@ -3623,7 +3623,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
* ECMA requires functions defined when entering Eval code to be
* impermanent.
*/
unsigned attrs = script->isActiveEval
unsigned attrs = script->isActiveEval()
? JSPROP_ENUMERATE
: JSPROP_ENUMERATE | JSPROP_PERMANENT;
@ -3660,7 +3660,7 @@ js::DefFunOperation(JSContext *cx, HandleScript script, HandleObject scopeChain,
*/
/* Step 5f. */
return JSObject::setProperty(cx, parent, parent, name, &rval, script->strict);
return JSObject::setProperty(cx, parent, parent, name, &rval, script->strict());
}
bool
@ -3853,10 +3853,10 @@ js::ImplicitThisOperation(JSContext *cx, HandleObject scopeObj, HandlePropertyNa
bool
js::RunOnceScriptPrologue(JSContext *cx, HandleScript script)
{
JS_ASSERT(script->treatAsRunOnce);
JS_ASSERT(script->treatAsRunOnce());
if (!script->hasRunOnce) {
script->hasRunOnce = true;
if (!script->hasRunOnce()) {
script->setHasRunOnce();
return true;
}

View File

@ -72,7 +72,7 @@ js::ScriptDebugPrologue(JSContext *cx, AbstractFramePtr frame)
{
JS_ASSERT_IF(frame.isStackFrame(), frame.asStackFrame() == cx->interpreterFrame());
if (!frame.script()->selfHosted) {
if (!frame.script()->selfHosted()) {
if (frame.isFramePushedByExecute()) {
if (JSInterpreterHook hook = cx->runtime()->debugHooks.executeHook)
frame.setHookData(hook(cx, Jsvalify(frame), IsTopFrameConstructing(cx, frame),
@ -596,7 +596,7 @@ JS_GetScriptVersion(JSContext *cx, JSScript *script)
JS_PUBLIC_API(bool)
JS_GetScriptIsSelfHosted(JSScript *script)
{
return script->selfHosted;
return script->selfHosted();
}
/***************************************************************************/
@ -848,7 +848,7 @@ extern JS_PUBLIC_API(void)
JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
{
Rooted<JSScript*> script(cx, scriptArg);
JS_ASSERT(script->hasScriptCounts);
JS_ASSERT(script->hasScriptCounts());
Sprinter sprinter(cx);
if (!sprinter.init())
@ -892,7 +892,7 @@ JS_DumpCompartmentPCCounts(JSContext *cx)
if (script->compartment() != cx->compartment())
continue;
if (script->hasScriptCounts && script->enclosingScriptsCompiledSuccessfully())
if (script->hasScriptCounts() && script->enclosingScriptsCompiledSuccessfully())
JS_DumpPCCounts(cx, script);
}

View File

@ -146,12 +146,12 @@ CallObject::create(JSContext *cx, HandleScript script, HandleShape shape, Handle
JS_ASSERT(CanBeFinalizedInBackground(kind, &CallObject::class_));
kind = gc::GetBackgroundAllocKind(kind);
gc::InitialHeap heap = script->treatAsRunOnce ? gc::TenuredHeap : gc::DefaultHeap;
gc::InitialHeap heap = script->treatAsRunOnce() ? gc::TenuredHeap : gc::DefaultHeap;
JSObject *obj = JSObject::create(cx, kind, heap, shape, type, slots);
if (!obj)
return nullptr;
if (script->treatAsRunOnce) {
if (script->treatAsRunOnce()) {
RootedObject nobj(cx, obj);
if (!JSObject::setSingletonType(cx, nobj))
return nullptr;
@ -196,7 +196,7 @@ CallObject::createTemplateObject(JSContext *cx, HandleScript script, gc::Initial
CallObject *
CallObject::create(JSContext *cx, HandleScript script, HandleObject enclosing, HandleFunction callee)
{
gc::InitialHeap heap = script->treatAsRunOnce ? gc::TenuredHeap : gc::DefaultHeap;
gc::InitialHeap heap = script->treatAsRunOnce() ? gc::TenuredHeap : gc::DefaultHeap;
CallObject *callobj = CallObject::createTemplateObject(cx, script, heap);
if (!callobj)
return nullptr;
@ -204,7 +204,7 @@ CallObject::create(JSContext *cx, HandleScript script, HandleObject enclosing, H
callobj->as<ScopeObject>().setEnclosingScope(enclosing);
callobj->initFixedSlot(CALLEE_SLOT, ObjectOrNullValue(callee));
if (script->treatAsRunOnce) {
if (script->treatAsRunOnce()) {
Rooted<CallObject*> ncallobj(cx, callobj);
if (!JSObject::setSingletonType(cx, ncallobj))
return nullptr;

View File

@ -233,13 +233,13 @@ intrinsic_SetScriptHints(JSContext *cx, unsigned argc, Value *vp)
if (!JSObject::getGeneric(cx, flags, flags, id, &propv))
return false;
if (ToBoolean(propv))
funScript->shouldCloneAtCallsite = true;
funScript->setShouldCloneAtCallsite();
id = AtomToId(Atomize(cx, "inline", strlen("inline")));
if (!JSObject::getGeneric(cx, flags, flags, id, &propv))
return false;
if (ToBoolean(propv))
funScript->shouldInline = true;
funScript->setShouldInline();
args.rval().setUndefined();
return true;

View File

@ -137,7 +137,7 @@ template <class Op>
inline void
StackFrame::forEachUnaliasedActual(Op op)
{
JS_ASSERT(!script()->funHasAnyAliasedFormal);
JS_ASSERT(!script()->funHasAnyAliasedFormal());
JS_ASSERT(!script()->needsArgsObj());
const Value *argsEnd = argv() + numActualArgs();
@ -860,7 +860,7 @@ InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx, Sta
regs_ = state.asGenerator()->gen()->regs;
}
JS_ASSERT_IF(entryFrame_->isEvalFrame(), state_.script()->isActiveEval);
JS_ASSERT_IF(entryFrame_->isEvalFrame(), state_.script()->isActiveEval());
}
InterpreterActivation::~InterpreterActivation()

View File

@ -258,7 +258,7 @@ StackFrame::prologue(JSContext *cx)
JS_ASSERT(cx->interpreterRegs().pc == script->code());
if (isEvalFrame()) {
if (script->strict) {
if (script->strict()) {
CallObject *callobj = CallObject::createForStrictEval(cx, this);
if (!callobj)
return false;

View File

@ -475,11 +475,11 @@ class StackFrame
}
inline bool isStrictEvalFrame() const {
return isEvalFrame() && script()->strict;
return isEvalFrame() && script()->strict();
}
bool isNonStrictEvalFrame() const {
return isEvalFrame() && !script()->strict;
return isEvalFrame() && !script()->strict();
}
bool isDirectEvalFrame() const {
@ -1616,7 +1616,7 @@ class NonBuiltinScriptFrameIter : public ScriptFrameIter
void settle() {
if (!includeSelfhostedFrames())
while (!done() && script()->selfHosted)
while (!done() && script()->selfHosted())
ScriptFrameIter::operator++();
}

View File

@ -117,7 +117,7 @@ XDRState<mode>::codeScript(MutableHandleScript scriptp)
return false;
if (mode == XDR_DECODE) {
JS_ASSERT(!script->compileAndGo);
JS_ASSERT(!script->compileAndGo());
CallNewScriptHook(cx(), script, NullPtr());
Debugger::onNewScript(cx(), script, nullptr);
scriptp.set(script);