Bug 947782 - Use accessor methods for JSScript uint32/uint16 fields, r=jandem.

This commit is contained in:
Brian Hackett 2013-12-09 11:26:09 -08:00
parent 2d95621d99
commit e9de0bd6a8
46 changed files with 346 additions and 285 deletions

View File

@ -263,7 +263,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame
RootedValue thisv(cx);
if (evalType == DIRECT_EVAL) {
JS_ASSERT_IF(caller.isStackFrame(), !caller.asStackFrame()->runningInJit());
staticLevel = caller.script()->staticLevel + 1;
staticLevel = caller.script()->staticLevel() + 1;
// Direct calls to eval are supposed to see the caller's |this|. If we
// haven't wrapped that yet, do so now, before we make a copy of it for
@ -347,7 +347,7 @@ js::DirectEvalStringFromIon(JSContext *cx,
// ES5 15.1.2.1 steps 2-8.
unsigned staticLevel = callerScript->staticLevel + 1;
unsigned staticLevel = callerScript->staticLevel() + 1;
Rooted<JSStableString*> stableStr(cx, str->ensureStable(cx));
if (!stableStr)

View File

@ -892,7 +892,7 @@ EmitAliasedVarOp(ExclusiveContext *cx, JSOp op, ParseNode *pn, BytecodeEmitter *
}
} else {
JS_ASSERT(pn->isDefn());
JS_ASSERT(pn->pn_cookie.level() == bce->script->staticLevel);
JS_ASSERT(pn->pn_cookie.level() == bce->script->staticLevel());
}
ScopeCoordinate sc;
@ -939,7 +939,7 @@ EmitVarOp(ExclusiveContext *cx, ParseNode *pn, JSOp op, BytecodeEmitter *bce)
if (!bce->isAliasedName(pn)) {
JS_ASSERT(pn->isUsed() || pn->isDefn());
JS_ASSERT_IF(pn->isUsed(), pn->pn_cookie.level() == 0);
JS_ASSERT_IF(pn->isDefn(), pn->pn_cookie.level() == bce->script->staticLevel);
JS_ASSERT_IF(pn->isDefn(), pn->pn_cookie.level() == bce->script->staticLevel());
return EmitUnaliasedVarOp(cx, op, pn->pn_cookie.slot(), bce);
}
@ -1012,7 +1012,7 @@ BytecodeEmitter::isAliasedName(ParseNode *pn)
JS_ASSERT(dn->isBound());
/* If dn is in an enclosing function, it is definitely aliased. */
if (dn->pn_cookie.level() != script->staticLevel)
if (dn->pn_cookie.level() != script->staticLevel())
return true;
switch (dn->kind()) {
@ -1428,7 +1428,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
* Currently, the ALIASEDVAR ops do not support accessing the
* callee of a DeclEnvObject, so use NAME.
*/
if (dn->pn_cookie.level() != bce->script->staticLevel)
if (dn->pn_cookie.level() != bce->script->staticLevel())
return true;
DebugOnly<JSFunction *> fun = bce->sc->asFunctionBox()->function();
@ -1481,7 +1481,7 @@ BindNameToSlotHelper(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
* the definition is the number of function scopes between the current
* scope and dn's scope.
*/
unsigned skip = bce->script->staticLevel - dn->pn_cookie.level();
unsigned skip = bce->script->staticLevel() - dn->pn_cookie.level();
JS_ASSERT_IF(skip, dn->isClosed());
/*
@ -4817,7 +4817,7 @@ EmitFunc(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
Rooted<JSObject*> enclosingScope(cx, EnclosingStaticScope(bce));
Rooted<JSObject*> sourceObject(cx, bce->script->sourceObject());
Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingScope, false, options,
parent->staticLevel + 1,
parent->staticLevel() + 1,
sourceObject,
funbox->bufStart, funbox->bufEnd));
if (!script)

View File

@ -224,7 +224,7 @@ JS_GetTraceThingInfo(char *buf, size_t bufsize, JSTracer *trc, void *thing,
case JSTRACE_SCRIPT:
{
JSScript *script = static_cast<JSScript *>(thing);
JS_snprintf(buf, bufsize, " %s:%u", script->filename(), unsigned(script->lineno));
JS_snprintf(buf, bufsize, " %s:%u", script->filename(), unsigned(script->lineno()));
break;
}

View File

@ -474,7 +474,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
if (excInfo)
exprStackSlots = excInfo->numExprSlots;
else
exprStackSlots = iter.slots() - (script->nfixed + CountArgSlots(script, fun));
exprStackSlots = iter.slots() - (script->nfixed() + CountArgSlots(script, fun));
builder.resetFramePushed();
@ -502,7 +502,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
// | ReturnAddr | <-- return into main jitcode after IC
// +===============+
IonSpew(IonSpew_BaselineBailouts, " Unpacking %s:%d", script->filename(), script->lineno);
IonSpew(IonSpew_BaselineBailouts, " Unpacking %s:%d", script->filename(), script->lineno());
IonSpew(IonSpew_BaselineBailouts, " [BASELINE-JS FRAME]");
// Calculate and write the previous frame pointer value.
@ -521,7 +521,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
// Initialize BaselineFrame::frameSize
uint32_t frameSize = BaselineFrame::Size() + BaselineFrame::FramePointerOffset +
(sizeof(Value) * (script->nfixed + exprStackSlots));
(sizeof(Value) * (script->nfixed() + exprStackSlots));
IonSpew(IonSpew_BaselineBailouts, " FrameSize=%d", (int) frameSize);
blFrame->setFrameSize(frameSize);
@ -627,7 +627,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
JS_ASSERT(iter.slots() >= CountArgSlots(script, fun));
IonSpew(IonSpew_BaselineBailouts, " frame slots %u, nargs %u, nfixed %u",
iter.slots(), fun->nargs, script->nfixed);
iter.slots(), fun->nargs, script->nfixed());
if (!callerPC) {
// This is the first frame. Store the formals in a Vector until we
@ -653,7 +653,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
}
}
for (uint32_t i = 0; i < script->nfixed; i++) {
for (uint32_t i = 0; i < script->nfixed(); i++) {
Value slot = iter.read();
if (!builder.writeValue(slot, "FixedValue"))
return false;
@ -825,7 +825,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
IonSpew(IonSpew_BaselineBailouts, " Resuming %s pc offset %d (op %s) (line %d) of %s:%d",
resumeAfter ? "after" : "at", (int) pcOff, js_CodeName[op],
PCToLineNumber(script, pc), script->filename(), (int) script->lineno);
PCToLineNumber(script, pc), script->filename(), (int) script->lineno());
IonSpew(IonSpew_BaselineBailouts, " Bailout kind: %s",
BailoutKindString(bailoutKind));
#endif
@ -959,7 +959,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
if (caller && bailoutKind == Bailout_ArgumentCheck) {
IonSpew(IonSpew_BaselineBailouts, " Setting PCidx on innermost "
"inlined frame's parent's SPS entry (%s:%d) (pcIdx=%d)!",
caller->filename(), caller->lineno, caller->pcToOffset(callerPC));
caller->filename(), caller->lineno(), caller->pcToOffset(callerPC));
cx->runtime()->spsProfiler.updatePC(caller, callerPC);
} else if (bailoutKind != Bailout_ArgumentCheck) {
IonSpew(IonSpew_BaselineBailouts,
@ -1057,7 +1057,7 @@ InitFromBailout(JSContext *cx, HandleScript caller, jsbytecode *callerPC,
JS_ASSERT(actualArgc + 2 <= exprStackSlots);
for (unsigned i = 0; i < actualArgc + 1; i++) {
size_t argSlot = (script->nfixed + exprStackSlots) - (i + 1);
size_t argSlot = (script->nfixed() + exprStackSlots) - (i + 1);
if (!builder.writeValue(*blFrame->valueSlot(argSlot), "ArgVal"))
return false;
}
@ -1236,7 +1236,7 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt
// +---------------+
IonSpew(IonSpew_BaselineBailouts, "Bailing to baseline %s:%u (IonScript=%p) (FrameType=%d)",
iter.script()->filename(), iter.script()->lineno, (void *) iter.ionScript(),
iter.script()->filename(), iter.script()->lineno(), (void *) iter.ionScript(),
(int) prevFrameType);
if (excInfo)
@ -1260,7 +1260,7 @@ jit::BailoutIonToBaseline(JSContext *cx, JitActivation *activation, IonBailoutIt
RootedFunction callee(cx, iter.maybeCallee());
if (callee) {
IonSpew(IonSpew_BaselineBailouts, " Callee function (%s:%u)",
callee->existingScript()->filename(), callee->existingScript()->lineno);
callee->existingScript()->filename(), callee->existingScript()->lineno());
} else {
IonSpew(IonSpew_BaselineBailouts, " No callee!");
}
@ -1351,8 +1351,8 @@ static bool
HandleBoundsCheckFailure(JSContext *cx, HandleScript outerScript, HandleScript innerScript)
{
IonSpew(IonSpew_Bailouts, "Bounds check failure %s:%d, inlined into %s:%d",
innerScript->filename(), innerScript->lineno,
outerScript->filename(), outerScript->lineno);
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
JS_ASSERT(!outerScript->ionScript()->invalidated());
@ -1370,8 +1370,8 @@ static bool
HandleShapeGuardFailure(JSContext *cx, HandleScript outerScript, HandleScript innerScript)
{
IonSpew(IonSpew_Bailouts, "Shape guard failure %s:%d, inlined into %s:%d",
innerScript->filename(), innerScript->lineno,
outerScript->filename(), outerScript->lineno);
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
JS_ASSERT(!outerScript->ionScript()->invalidated());
@ -1387,8 +1387,8 @@ static bool
HandleBaselineInfoBailout(JSContext *cx, JSScript *outerScript, JSScript *innerScript)
{
IonSpew(IonSpew_Bailouts, "Baseline info failure %s:%d, inlined into %s:%d",
innerScript->filename(), innerScript->lineno,
outerScript->filename(), outerScript->lineno);
innerScript->filename(), innerScript->lineno(),
outerScript->filename(), outerScript->lineno());
JS_ASSERT(!outerScript->ionScript()->invalidated());
@ -1480,8 +1480,8 @@ jit::FinishBailoutToBaseline(BaselineBailoutInfo *bailoutInfo)
JS_ASSERT(outerScript);
IonSpew(IonSpew_BaselineBailouts,
" Restored outerScript=(%s:%u,%u) innerScript=(%s:%u,%u) (bailoutKind=%u)",
outerScript->filename(), outerScript->lineno, outerScript->getUseCount(),
innerScript->filename(), innerScript->lineno, innerScript->getUseCount(),
outerScript->filename(), outerScript->lineno(), outerScript->getUseCount(),
innerScript->filename(), innerScript->lineno(), innerScript->getUseCount(),
(unsigned) bailoutKind);
switch (bailoutKind) {

View File

@ -69,10 +69,10 @@ MethodStatus
BaselineCompiler::compile()
{
IonSpew(IonSpew_BaselineScripts, "Baseline compiling script %s:%d (%p)",
script->filename(), script->lineno, script.get());
script->filename(), script->lineno(), script.get());
IonSpew(IonSpew_Codegen, "# Emitting baseline code for script %s:%d",
script->filename(), script->lineno);
script->filename(), script->lineno());
if (cx->typeInferenceEnabled() && !script->ensureHasTypes(cx))
return Method_Error;
@ -172,7 +172,7 @@ BaselineCompiler::compile()
spsPushToggleOffset_.fixup(&masm);
// Note: There is an extra entry in the bytecode type map for the search hint, see below.
size_t bytecodeTypeMapEntries = cx->typeInferenceEnabled() ? script->nTypeSets + 1 : 0;
size_t bytecodeTypeMapEntries = cx->typeInferenceEnabled() ? script->nTypeSets() + 1 : 0;
BaselineScript *baselineScript = BaselineScript::New(cx, prologueOffset_.offset(),
spsPushToggleOffset_.offset(),
@ -190,7 +190,7 @@ BaselineCompiler::compile()
IonSpew(IonSpew_BaselineScripts, "Created BaselineScript %p (raw %p) for %s:%d",
(void *) script->baselineScript(), (void *) code->raw(),
script->filename(), script->lineno);
script->filename(), script->lineno());
#ifdef JS_ION_PERF
writePerfSpewerBaselineProfile(script, code);
@ -239,16 +239,16 @@ BaselineCompiler::compile()
JSOp op = JSOp(*pc);
if (js_CodeSpec[op].format & JOF_TYPESET) {
bytecodeMap[added++] = script->pcToOffset(pc);
if (added == script->nTypeSets)
if (added == script->nTypeSets())
break;
}
}
JS_ASSERT(added == script->nTypeSets);
JS_ASSERT(added == script->nTypeSets());
// The last entry in the last index found, and is used to avoid binary
// searches for the sought entry when queries are in linear order.
bytecodeMap[script->nTypeSets] = 0;
bytecodeMap[script->nTypeSets()] = 0;
}
if (script->compartment()->debugMode())
@ -456,7 +456,7 @@ BaselineCompiler::emitStackCheck(bool earlyCheck)
{
Label skipCall;
uintptr_t *limitAddr = &cx->runtime()->mainThread.ionStackLimit;
uint32_t slotsSize = script->nslots * sizeof(Value);
uint32_t slotsSize = script->nslots() * sizeof(Value);
uint32_t tolerance = earlyCheck ? slotsSize : 0;
masm.movePtr(BaselineStackReg, R1.scratchReg());

View File

@ -190,7 +190,7 @@ class BaselineCompiler : public BaselineCompilerSpecific
// early stack check.
static const unsigned EARLY_STACK_CHECK_SLOT_COUNT = 128;
bool needsEarlyStackCheck() const {
return script->nslots > EARLY_STACK_CHECK_SLOT_COUNT;
return script->nslots() > EARLY_STACK_CHECK_SLOT_COUNT;
}
public:

View File

@ -56,7 +56,7 @@ BaselineFrame::trace(JSTracer *trc)
bool
BaselineFrame::copyRawFrameSlots(AutoValueVector *vec) const
{
unsigned nfixed = script()->nfixed;
unsigned nfixed = script()->nfixed();
unsigned nformals = numFormalArgs();
if (!vec->resize(nformals + nfixed))

View File

@ -152,7 +152,7 @@ class BaselineFrame
Value &unaliasedVar(unsigned i, MaybeCheckAliasing checkAliasing = CHECK_ALIASING) const {
JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i));
JS_ASSERT(i < script()->nfixed);
JS_ASSERT(i < script()->nfixed());
return *valueSlot(i);
}
@ -334,7 +334,7 @@ class BaselineFrame
return isEvalFrame() && !script()->strict;
}
bool isDirectEvalFrame() const {
return isEvalFrame() && script()->staticLevel > 0;
return isEvalFrame() && script()->staticLevel() > 0;
}
bool isNonStrictDirectEvalFrame() const {
return isNonStrictEvalFrame() && isDirectEvalFrame();

View File

@ -17,7 +17,7 @@ bool
FrameInfo::init(TempAllocator &alloc)
{
// One slot is always needed for this/arguments type checks.
size_t nstack = Max(script->nslots - script->nfixed, 1);
size_t nstack = Max(script->nslots() - script->nfixed(), size_t(1));
if (!stack.init(alloc, nstack))
return false;

View File

@ -179,7 +179,7 @@ class FrameInfo
bool init(TempAllocator &alloc);
uint32_t nlocals() const {
return script->nfixed;
return script->nfixed();
}
uint32_t nargs() const {
return script->function()->nargs;

View File

@ -54,7 +54,7 @@ FallbackICSpew(JSContext *cx, ICFallbackStub *stub, const char *fmt, ...)
IonSpew(IonSpew_BaselineICFallback,
"Fallback hit for (%s:%d) (pc=%d,line=%d,uses=%d,stubs=%d): %s",
script->filename(),
script->lineno,
script->lineno(),
(int) script->pcToOffset(pc),
PCToLineNumber(script, pc),
script->getUseCount(),
@ -79,7 +79,7 @@ TypeFallbackICSpew(JSContext *cx, ICTypeMonitor_Fallback *stub, const char *fmt,
IonSpew(IonSpew_BaselineICFallback,
"Type monitor fallback hit for (%s:%d) (pc=%d,line=%d,uses=%d,stubs=%d): %s",
script->filename(),
script->lineno,
script->lineno(),
(int) script->pcToOffset(pc),
PCToLineNumber(script, pc),
script->getUseCount(),
@ -926,7 +926,7 @@ DoUseCountFallback(JSContext *cx, ICUseCount_Fallback *stub, BaselineFrame *fram
// Ensure that Ion-compiled code is available.
IonSpew(IonSpew_BaselineOSR,
"UseCount for %s:%d reached %d at pc %p, trying to switch to Ion!",
script->filename(), script->lineno, (int) script->getUseCount(), (void *) pc);
script->filename(), script->lineno(), (int) script->getUseCount(), (void *) pc);
void *jitcode = nullptr;
if (!EnsureCanEnterIon(cx, stub, frame, script, pc, &jitcode))
return false;
@ -1056,7 +1056,7 @@ DoProfilerFallback(JSContext *cx, BaselineFrame *frame, ICProfiler_Fallback *stu
return false;
IonSpew(IonSpew_BaselineIC, " Generating Profiler_PushFunction stub for %s:%d",
script->filename(), script->lineno);
script->filename(), script->lineno());
// Create a new optimized stub.
ICProfiler_PushFunction::Compiler compiler(cx, string, script);
@ -3779,7 +3779,7 @@ static bool TryAttachNativeGetElemStub(JSContext *cx, HandleScript script, jsbyt
"(obj=%p, shape=%p, holder=%p, holderShape=%p)",
(obj == holder) ? "direct" : "prototype",
needsAtomize ? " atomizing" : "",
getter->nonLazyScript()->filename(), getter->nonLazyScript()->lineno,
getter->nonLazyScript()->filename(), getter->nonLazyScript()->lineno(),
obj.get(), obj->lastProperty(), holder.get(), holder->lastProperty());
} else {
IonSpew(IonSpew_BaselineIC,
@ -6091,7 +6091,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
JS_ASSERT(callee->hasScript());
IonSpew(IonSpew_BaselineIC, " Generating GetProp(NativeObj/ScriptedGetter %s:%d) stub",
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno);
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno());
ICGetProp_CallScripted::Compiler compiler(cx, monitorStub, obj, holder, callee,
script->pcToOffset(pc));
@ -7110,7 +7110,7 @@ TryAttachSetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc, ICSetPr
JS_ASSERT(callee->hasScript());
IonSpew(IonSpew_BaselineIC, " Generating SetProp(NativeObj/ScriptedSetter %s:%d) stub",
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno);
callee->nonLazyScript()->filename(), callee->nonLazyScript()->lineno());
ICSetProp_CallScripted::Compiler compiler(cx, obj, holder, callee, script->pcToOffset(pc));
ICStub *newStub = compiler.getStub(compiler.getStubSpace(script));
@ -7900,7 +7900,7 @@ TryAttachCallStub(JSContext *cx, ICCall_Fallback *stub, HandleScript script, jsb
IonSpew(IonSpew_BaselineIC,
" Generating Call_Scripted stub (fun=%p, %s:%d, cons=%s)",
fun.get(), fun->nonLazyScript()->filename(), fun->nonLazyScript()->lineno,
fun.get(), fun->nonLazyScript()->filename(), fun->nonLazyScript()->lineno(),
constructing ? "yes" : "no");
ICCallScriptedCompiler compiler(cx, stub->fallbackMonitorStub()->firstMonitorStub(),
calleeScript, templateObject,

View File

@ -174,7 +174,7 @@ jit::EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc)
data.jitcode += MacroAssembler::ToggledCallSize();
data.osrFrame = fp;
data.osrNumStackValues = fp->script()->nfixed + cx->interpreterRegs().stackDepth();
data.osrNumStackValues = fp->script()->nfixed() + cx->interpreterRegs().stackDepth();
RootedValue thisv(cx);
@ -247,7 +247,7 @@ CanEnterBaselineJIT(JSContext *cx, HandleScript script, bool osr)
{
// Limit the locals on a given script so that stack check on baseline frames
// doesn't overflow a uint32_t value.
static_assert(sizeof(script->nslots) == sizeof(uint16_t), "script->nslots may get too large!");
JS_ASSERT(script->nslots() <= UINT16_MAX);
JS_ASSERT(jit::IsBaselineEnabled(cx));
@ -747,7 +747,7 @@ BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc)
if (!debugMode())
return;
SrcNoteLineScanner scanner(script->notes(), script->lineno);
SrcNoteLineScanner scanner(script->notes(), script->lineno());
JSRuntime *rt = script->runtimeFromMainThread();
IonContext ictx(CompileRuntime::get(rt),

View File

@ -108,7 +108,7 @@ BytecodeAnalysis::init(TempAllocator &alloc, GSNCache &gsn)
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
unsigned startOffset = script_->mainOffset + tn->start;
unsigned startOffset = script_->mainOffset() + tn->start;
if (startOffset == offset + 1) {
unsigned catchOffset = startOffset + tn->length;

View File

@ -35,8 +35,8 @@ C1Spewer::beginFunction(MIRGraph *graph, HandleScript script)
fprintf(spewout_, "begin_compilation\n");
if (script) {
fprintf(spewout_, " name \"%s:%d\"\n", script->filename(), script->lineno);
fprintf(spewout_, " method \"%s:%d\"\n", script->filename(), script->lineno);
fprintf(spewout_, " name \"%s:%d\"\n", script->filename(), (int)script->lineno());
fprintf(spewout_, " method \"%s:%d\"\n", script->filename(), (int)script->lineno());
} else {
fprintf(spewout_, " name \"asm.js compilation\"\n");
fprintf(spewout_, " method \"asm.js compilation\"\n");

View File

@ -5790,7 +5790,7 @@ CodeGenerator::generate()
{
IonSpew(IonSpew_Codegen, "# Emitting code for script %s:%d",
gen->info().script()->filename(),
gen->info().script()->lineno);
gen->info().script()->lineno());
if (!safepoints_.init(gen->alloc(), graph.totalSlotCount()))
return false;

View File

@ -61,8 +61,8 @@ class CompileInfo
nimplicit_ = StartArgSlot(script) /* scope chain and argument obj */
+ (fun ? 1 : 0); /* this */
nargs_ = fun ? fun->nargs : 0;
nlocals_ = script->nfixed;
nstack_ = script->nslots - script->nfixed;
nlocals_ = script->nfixed();
nstack_ = script->nslots() - script->nfixed();
nslots_ = nimplicit_ + nargs_ + nlocals_ + nstack_;
}
@ -107,7 +107,7 @@ class CompileInfo
}
unsigned lineno() const {
return script_->lineno;
return script_->lineno();
}
unsigned lineno(jsbytecode *pc) const {
return PCToLineNumber(script_, pc);

View File

@ -1884,13 +1884,13 @@ Compile(JSContext *cx, HandleScript script, BaselineFrame *osrFrame, jsbytecode
}
if (!CheckScript(cx, script, bool(osrPc))) {
IonSpew(IonSpew_Abort, "Aborted compilation of %s:%d", script->filename(), script->lineno);
IonSpew(IonSpew_Abort, "Aborted compilation of %s:%d", script->filename(), script->lineno());
return Method_CantCompile;
}
MethodStatus status = CheckScriptSize(cx, script);
if (status != Method_Compiled) {
IonSpew(IonSpew_Abort, "Aborted compilation of %s:%d", script->filename(), script->lineno);
IonSpew(IonSpew_Abort, "Aborted compilation of %s:%d", script->filename(), script->lineno());
return status;
}
@ -2147,7 +2147,7 @@ jit::CanEnterInParallel(JSContext *cx, HandleScript script)
parallel::Spew(
parallel::SpewCompile,
"Script %p:%s:%u was garbage-collected or invalidated",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return Method_Skipped;
}
@ -2344,7 +2344,7 @@ InvalidateActivation(FreeOp *fop, uint8_t *ionTop, bool invalidateAll)
JS_ASSERT(it.isScripted());
const char *type = it.isOptimizedJS() ? "Optimized" : "Baseline";
IonSpew(IonSpew_Invalidate, "#%d %s JS frame @ %p, %s:%d (fun: %p, script: %p, pc %p)",
frameno, type, it.fp(), it.script()->filename(), it.script()->lineno,
frameno, type, it.fp(), it.script()->filename(), it.script()->lineno(),
it.maybeCallee(), (JSScript *)it.script(), it.returnAddressToFp());
break;
}
@ -2503,7 +2503,7 @@ jit::Invalidate(types::TypeCompartment &types, FreeOp *fop,
continue;
IonSpew(IonSpew_Invalidate, " Invalidate %s:%u, IonScript %p",
co.script()->filename(), co.script()->lineno, co.ion());
co.script()->filename(), co.script()->lineno(), co.ion());
// Keep the ion script alive during the invalidation and flag this
// ionScript as being invalidated. This increment is removed by the
@ -2663,7 +2663,7 @@ void
jit::ForbidCompilation(JSContext *cx, JSScript *script, ExecutionMode mode)
{
IonSpew(IonSpew_Abort, "Disabling Ion mode %d compilation of script %s:%d",
mode, script->filename(), script->lineno);
mode, script->filename(), script->lineno());
CancelOffThreadIonCompile(cx->compartment(), script);

View File

@ -89,9 +89,9 @@ jit::NewBaselineFrameInspector(TempAllocator *temp, BaselineFrame *frame)
}
}
if (!inspector->varTypes.reserve(frame->script()->nfixed))
if (!inspector->varTypes.reserve(frame->script()->nfixed()))
return nullptr;
for (size_t i = 0; i < frame->script()->nfixed; i++) {
for (size_t i = 0; i < frame->script()->nfixed(); i++) {
if (script->varIsAliased(i))
inspector->varTypes.infallibleAppend(types::Type::UndefinedType());
else
@ -316,7 +316,7 @@ IonBuilder::DontInline(JSScript *targetScript, const char *reason)
{
if (targetScript) {
IonSpew(IonSpew_Inlining, "Cannot inline %s:%u: %s",
targetScript->filename(), targetScript->lineno, reason);
targetScript->filename(), targetScript->lineno(), reason);
} else {
IonSpew(IonSpew_Inlining, "Cannot inline: %s", reason);
}
@ -604,7 +604,7 @@ IonBuilder::build()
return false;
IonSpew(IonSpew_Scripts, "Analyzing script %s:%d (%p) (usecount=%d)",
script()->filename(), script()->lineno, (void *)script(), (int)script()->getUseCount());
script()->filename(), script()->lineno(), (void *)script(), (int)script()->getUseCount());
if (!initParameters())
return false;
@ -749,7 +749,7 @@ IonBuilder::buildInline(IonBuilder *callerBuilder, MResumePoint *callerResumePoi
inlineCallInfo_ = &callInfo;
IonSpew(IonSpew_Scripts, "Inlining script %s:%d (%p)",
script()->filename(), script()->lineno, (void *)script());
script()->filename(), script()->lineno(), (void *)script());
callerBuilder_ = callerBuilder;
callerResumePoint_ = callerResumePoint;
@ -984,7 +984,7 @@ bool
IonBuilder::initArgumentsObject()
{
IonSpew(IonSpew_MIR, "%s:%d - Emitting code to initialize arguments object! block=%p",
script()->filename(), script()->lineno, current);
script()->filename(), script()->lineno(), current);
JS_ASSERT(info().needsArgsObj());
MCreateArgumentsObject *argsObj = MCreateArgumentsObject::New(alloc(), current->scopeChain());
current->add(argsObj);

View File

@ -410,7 +410,7 @@ IonCache::linkAndAttachStub(JSContext *cx, MacroAssembler &masm, StubAttacher &a
if (pc_) {
IonSpew(IonSpew_InlineCaches, "Cache %p(%s:%d/%d) generated %s %s stub at %p",
this, script_->filename(), script_->lineno, script_->pcToOffset(pc_),
this, script_->filename(), script_->lineno(), script_->pcToOffset(pc_),
attachKind, CacheName(kind()), code->raw());
} else {
IonSpew(IonSpew_InlineCaches, "Cache %p generated %s %s stub at %p",
@ -1744,7 +1744,7 @@ GetPropertyIC::update(JSContext *cx, size_t cacheIndex,
// be complicated since (due to GVN) there can be multiple pc's
// associated with a single idempotent cache.
IonSpew(IonSpew_InlineCaches, "Invalidating from idempotent cache %s:%d",
topScript->filename(), topScript->lineno);
topScript->filename(), topScript->lineno());
topScript->invalidatedIdempotentCache = true;

View File

@ -313,7 +313,7 @@ CloseLiveIterator(JSContext *cx, const InlineFrameIterator &frame, uint32_t loca
SnapshotIterator si = frame.snapshotIterator();
// Skip stack slots until we reach the iterator object.
uint32_t base = CountArgSlots(frame.script(), frame.maybeCallee()) + frame.script()->nfixed;
uint32_t base = CountArgSlots(frame.script(), frame.maybeCallee()) + frame.script()->nfixed();
uint32_t skipSlots = base + localSlot - 1;
for (unsigned i = 0; i < skipSlots; i++)
@ -465,8 +465,8 @@ HandleExceptionBaseline(JSContext *cx, const IonFrameIterator &frame, ResumeFrom
// Skip if the try note's stack depth exceeds the frame's stack depth.
// See the big comment in TryNoteIter::settle for more info.
JS_ASSERT(frame.baselineFrame()->numValueSlots() >= script->nfixed);
size_t stackDepth = frame.baselineFrame()->numValueSlots() - script->nfixed;
JS_ASSERT(frame.baselineFrame()->numValueSlots() >= script->nfixed());
size_t stackDepth = frame.baselineFrame()->numValueSlots() - script->nfixed();
if (tn->stackDepth > stackDepth)
continue;
@ -477,7 +477,7 @@ HandleExceptionBaseline(JSContext *cx, const IonFrameIterator &frame, ResumeFrom
// Compute base pointer and stack pointer.
rfe->framePointer = frame.fp() - BaselineFrame::FramePointerOffset;
rfe->stackPointer = rfe->framePointer - BaselineFrame::Size() -
(script->nfixed + tn->stackDepth) * sizeof(Value);
(script->nfixed() + tn->stackDepth) * sizeof(Value);
switch (tn->kind) {
case JSTRY_CATCH:
@ -1590,7 +1590,7 @@ IonFrameIterator::dumpBaseline() const
}
fprintf(stderr, " file %s line %u\n",
script()->filename(), (unsigned) script()->lineno);
script()->filename(), (unsigned) script()->lineno());
JSContext *cx = GetIonContext()->cx;
RootedScript script(cx);
@ -1638,7 +1638,7 @@ InlineFrameIteratorMaybeGC<allowGC>::dump() const
}
fprintf(stderr, " file %s line %u\n",
script()->filename(), (unsigned) script()->lineno);
script()->filename(), (unsigned) script()->lineno());
fprintf(stderr, " script = %p, pc = %p\n", (void*) script(), pc());
fprintf(stderr, " current op: %s\n", js_CodeName[*pc()]);

View File

@ -53,7 +53,7 @@ FilterContainsLocation(HandleScript function)
return false;
const char *filename = function->filename();
const size_t line = function->lineno;
const size_t line = function->lineno();
const size_t filelen = strlen(filename);
const char *index = strstr(filter, filename);
while (index) {
@ -93,7 +93,7 @@ jit::IonSpewNewFunction(MIRGraph *graph, HandleScript func)
// off-thread spewing. Throw informative message when trying.
if (func) {
IonSpew(IonSpew_Logs, "Can't log script %s:%d. (Compiled on background thread.)",
func->filename(), func->lineno);
func->filename(), func->lineno());
} else {
IonSpew(IonSpew_Logs, "Can't log asm.js compilation. (Compiled on background thread.)");
}

View File

@ -185,7 +185,7 @@ JSONSpewer::beginFunction(JSScript *script)
beginObject();
if (script)
stringProperty("name", "%s:%d", script->filename(), script->lineno);
stringProperty("name", "%s:%d", script->filename(), script->lineno());
else
stringProperty("name", "asm.js compilation");
beginListProperty("passes");

View File

@ -499,8 +499,8 @@ MConstant::printOpcode(FILE *fp) const
}
if (fun->hasScript()) {
JSScript *script = fun->nonLazyScript();
fprintf(fp, " (%s:%u)",
script->filename() ? script->filename() : "", script->lineno);
fprintf(fp, " (%s:%d)",
script->filename() ? script->filename() : "", (int) script->lineno());
}
fprintf(fp, " at %p", (void *) fun);
break;

View File

@ -472,8 +472,8 @@ jit::AbortPar(ParallelBailoutCause cause, JSScript *outermostScript, JSScript *c
"Parallel abort with cause %d in %p:%s:%d "
"(%p:%s:%d at line %d)",
cause,
outermostScript, outermostScript->filename(), outermostScript->lineno,
currentScript, currentScript->filename(), currentScript->lineno,
outermostScript, outermostScript->filename(), outermostScript->lineno(),
currentScript, currentScript->filename(), currentScript->lineno(),
(currentScript ? PCToLineNumber(currentScript, bytecode) : 0));
JS_ASSERT(InParallelSection());
@ -492,8 +492,8 @@ jit::PropagateAbortPar(JSScript *outermostScript, JSScript *currentScript)
{
Spew(SpewBailouts,
"Propagate parallel abort via %p:%s:%d (%p:%s:%d)",
outermostScript, outermostScript->filename(), outermostScript->lineno,
currentScript, currentScript->filename(), currentScript->lineno);
outermostScript, outermostScript->filename(), outermostScript->lineno(),
currentScript, currentScript->filename(), currentScript->lineno());
JS_ASSERT(InParallelSection());
JS_ASSERT(outermostScript->hasParallelIonScript());
@ -522,7 +522,7 @@ jit::CallToUncompiledScriptPar(JSObject *obj)
if (func->hasScript()) {
JSScript *script = func->nonLazyScript();
Spew(SpewBailouts, "Call to uncompiled script: %p:%s:%d",
script, script->filename(), script->lineno);
script, script->filename(), script->lineno());
} else if (func->isInterpretedLazy()) {
Spew(SpewBailouts, "Call to uncompiled lazy script");
} else if (func->isBoundFunction()) {
@ -538,7 +538,7 @@ jit::CallToUncompiledScriptPar(JSObject *obj)
if (target->hasScript()) {
JSScript *script = target->nonLazyScript();
Spew(SpewBailouts, "Call to bound function leading (depth: %d) to script: %p:%s:%d",
depth, script, script->filename(), script->lineno);
depth, script, script->filename(), script->lineno());
} else {
Spew(SpewBailouts, "Call to bound function (excessive depth: %d)", depth);
}

View File

@ -309,11 +309,11 @@ SnapshotWriter::startFrame(JSFunction *fun, JSScript *script, jsbytecode *pc, ui
uint32_t implicit = StartArgSlot(script);
uint32_t formalArgs = CountArgSlots(script, fun);
nslots_ = formalArgs + script->nfixed + exprStack;
nslots_ = formalArgs + script->nfixed() + exprStack;
slotsWritten_ = 0;
IonSpew(IonSpew_Snapshots, "Starting frame; implicit %u, formals %u, fixed %u, exprs %u",
implicit, formalArgs - implicit, script->nfixed, exprStack);
implicit, formalArgs - implicit, script->nfixed(), exprStack);
uint32_t pcoff = script->pcToOffset(pc);
IonSpew(IonSpew_Snapshots, "Writing pc offset %u, nslots %u", pcoff, nslots_);

View File

@ -290,7 +290,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
unsigned startOffset = script_->mainOffset + tn->start;
unsigned startOffset = script_->mainOffset() + tn->start;
if (startOffset == offset + 1) {
unsigned catchOffset = startOffset + tn->length;
@ -317,7 +317,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
jsbytecode *next = pc + JSOP_GETLOCAL_LENGTH;
if (JSOp(*next) != JSOP_POP || jumpTarget(next)) {
uint32_t local = GET_SLOTNO(pc);
if (local >= script_->nfixed) {
if (local >= script_->nfixed()) {
localsAliasStack_ = true;
break;
}
@ -328,7 +328,7 @@ ScriptAnalysis::analyzeBytecode(JSContext *cx)
case JSOP_CALLLOCAL:
case JSOP_SETLOCAL: {
uint32_t local = GET_SLOTNO(pc);
if (local >= script_->nfixed) {
if (local >= script_->nfixed()) {
localsAliasStack_ = true;
break;
}
@ -478,7 +478,7 @@ ScriptAnalysis::analyzeLifetimes(JSContext *cx)
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
unsigned startOffset = script_->mainOffset + tn->start;
unsigned startOffset = script_->mainOffset() + tn->start;
if (startOffset + tn->length == offset) {
/*
* Extend all live variables at exception entry to the start of
@ -877,7 +877,7 @@ ScriptAnalysis::analyzeSSA(JSContext *cx)
}
LifoAlloc &alloc = cx->typeLifoAlloc();
unsigned maxDepth = script_->nslots - script_->nfixed;
unsigned maxDepth = script_->nslots() - script_->nfixed();
/*
* Current value of each variable and stack value. Empty for missing or
@ -1210,7 +1210,7 @@ ScriptAnalysis::analyzeSSA(JSContext *cx)
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
unsigned startOffset = script_->mainOffset + tn->start;
unsigned startOffset = script_->mainOffset() + tn->start;
if (startOffset == offset + 1) {
unsigned catchOffset = startOffset + tn->length;

View File

@ -228,7 +228,7 @@ static inline uint32_t LocalSlot(JSScript *script, uint32_t local) {
return 1 + (script->function() ? script->function()->nargs : 0) + local;
}
static inline uint32_t TotalSlots(JSScript *script) {
return LocalSlot(script, 0) + script->nfixed;
return LocalSlot(script, 0) + script->nfixed();
}
static inline uint32_t StackSlot(JSScript *script, uint32_t index) {

View File

@ -301,7 +301,7 @@ js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
if (JSID_IS_ATOM(id, cx->names().length)) {
if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
return false;
uint16_t length = fun->hasScript() ? fun->nonLazyScript()->funLength :
uint16_t length = fun->hasScript() ? fun->nonLazyScript()->funLength() :
fun->nargs - fun->hasRest();
v.setInt32(length);
} else {
@ -687,8 +687,8 @@ js::FunctionToString(JSContext *cx, HandleFunction fun, bool bodyOnly, bool lamb
// asserted below, that in Function("function f() {}"), the inner
// function's sourceStart points to the '(', not the 'f'.
bool funCon = !fun->isArrow() &&
script->sourceStart == 0 &&
script->sourceEnd == script->scriptSource()->length() &&
script->sourceStart() == 0 &&
script->sourceEnd() == script->scriptSource()->length() &&
script->scriptSource()->argumentsNotIncluded();
// Functions created with the constructor can't be arrow functions or
@ -1204,7 +1204,7 @@ JSFunction::createScriptForLazilyInterpretedFunction(JSContext *cx, HandleFuncti
// A script's starting column isn't set by the bytecode emitter, so
// specify this from the lazy script so that if an identical lazy
// script is encountered later a match can be determined.
script->column = lazy->column();
script->setColumn(lazy->column());
LazyScriptCache::Lookup lookup(cx, lazy);
cx->runtime()->lazyScriptCache.insert(lookup, script);

View File

@ -210,7 +210,7 @@ unsigned JSScript::id() {
if (!id_) {
id_ = ++compartment()->types.scriptCount;
InferSpew(ISpewOps, "script #%u: %p %s:%d",
id_, this, filename() ? filename() : "<null>", lineno);
id_, this, filename() ? filename() : "<null>", lineno());
}
return id_;
}
@ -961,7 +961,7 @@ types::FinishCompilation(JSContext *cx, HandleScript script, ExecutionMode execu
if (!CheckFrozenTypeSet(cx, &entry.argTypes[i], types::TypeScript::ArgTypes(entry.script, i)))
succeeded = false;
}
for (size_t i = 0; i < entry.script->nTypeSets; i++) {
for (size_t i = 0; i < entry.script->nTypeSets(); i++) {
if (!CheckFrozenTypeSet(cx, &entry.bytecodeTypes[i], &entry.script->types->typeArray()[i]))
succeeded = false;
}
@ -1954,7 +1954,7 @@ types::UseNewTypeForInitializer(JSScript *script, jsbytecode *pc, JSProtoKey key
if (tn->kind != JSTRY_ITER && tn->kind != JSTRY_LOOP)
continue;
unsigned startOffset = script->mainOffset + tn->start;
unsigned startOffset = script->mainOffset() + tn->start;
unsigned endOffset = startOffset + tn->length;
if (offset >= startOffset && offset < endOffset)
@ -2140,7 +2140,7 @@ TypeCompartment::addPendingRecompile(JSContext *cx, const RecompileInfo &info)
}
InferSpew(ISpewOps, "addPendingRecompile: %p:%s:%d",
co->script(), co->script()->filename(), co->script()->lineno);
co->script(), co->script()->filename(), co->script()->lineno());
co->setPendingInvalidation();
}
@ -3439,8 +3439,8 @@ types::UseNewTypeForClone(JSFunction *fun)
if (fun->hasScript()) {
if (!fun->nonLazyScript()->usesArgumentsAndApply)
return false;
begin = fun->nonLazyScript()->sourceStart;
end = fun->nonLazyScript()->sourceEnd;
begin = fun->nonLazyScript()->sourceStart();
end = fun->nonLazyScript()->sourceEnd();
} else {
if (!fun->lazyScript()->usesArgumentsAndApply())
return false;
@ -3487,7 +3487,7 @@ JSScript::makeTypes(JSContext *cx)
new (&typeArray[i]) StackTypeSet();
#ifdef DEBUG
for (unsigned i = 0; i < nTypeSets; i++)
for (unsigned i = 0; i < nTypeSets(); i++)
InferSpew(ISpewOps, "typeSet: %sT%p%s bytecode%u #%u",
InferSpewColor(&typeArray[i]), &typeArray[i], InferSpewColorReset(),
i, id());
@ -4376,7 +4376,7 @@ TypeScript::printTypes(JSContext *cx, HandleScript script) const
fprintf(stderr, "Eval");
else
fprintf(stderr, "Main");
fprintf(stderr, " #%u %s:%d ", script->id(), script->filename(), script->lineno);
fprintf(stderr, " #%u %s:%d ", script->id(), script->filename(), (int) script->lineno());
if (script->function()) {
if (js::PropertyName *name = script->function()->name()) {

View File

@ -592,13 +592,13 @@ extern void TypeDynamicResult(JSContext *cx, JSScript *script, jsbytecode *pc,
/* static */ inline unsigned
TypeScript::NumTypeSets(JSScript *script)
{
return script->nTypeSets + analyze::LocalSlot(script, 0);
return script->nTypeSets() + analyze::LocalSlot(script, 0);
}
/* static */ inline StackTypeSet *
TypeScript::ThisTypes(JSScript *script)
{
return script->types->typeArray() + script->nTypeSets + js::analyze::ThisSlot();
return script->types->typeArray() + script->nTypeSets() + js::analyze::ThisSlot();
}
/*
@ -611,7 +611,7 @@ TypeScript::ThisTypes(JSScript *script)
TypeScript::ArgTypes(JSScript *script, unsigned i)
{
JS_ASSERT(i < script->function()->nargs);
return script->types->typeArray() + script->nTypeSets + js::analyze::ArgSlot(i);
return script->types->typeArray() + script->nTypeSets() + js::analyze::ArgSlot(i);
}
template <typename TYPESET>
@ -628,7 +628,7 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc, uint32_t *hint, TYPE
uint32_t offset = script->pcToOffset(pc);
// See if this pc is the next typeset opcode after the last one looked up.
if (bytecodeMap[*hint + 1] == offset && (*hint + 1) < script->nTypeSets) {
if (bytecodeMap[*hint + 1] == offset && (*hint + 1) < script->nTypeSets()) {
(*hint)++;
return typeArray + *hint;
}
@ -639,7 +639,7 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc, uint32_t *hint, TYPE
// Fall back to a binary search.
size_t bottom = 0;
size_t top = script->nTypeSets - 1;
size_t top = script->nTypeSets() - 1;
size_t mid = bottom + (top - bottom) / 2;
while (mid < top) {
if (bytecodeMap[mid] < offset)
@ -665,7 +665,7 @@ TypeScript::BytecodeTypes(JSScript *script, jsbytecode *pc)
{
JS_ASSERT(CurrentThreadCanAccessRuntime(script->runtimeFromMainThread()));
#ifdef JS_ION
uint32_t *hint = script->baselineScript()->bytecodeTypeMap() + script->nTypeSets;
uint32_t *hint = script->baselineScript()->bytecodeTypeMap() + script->nTypeSets();
#else
uint32_t *hint = nullptr;
MOZ_CRASH();

View File

@ -1562,7 +1562,7 @@ js_NewGenerator(JSContext *cx, const FrameRegs &stackRegs)
(-1 + /* one Value included in JSGenerator */
vplen +
VALUES_PER_STACK_FRAME +
stackfp->script()->nslots) * sizeof(HeapValue);
stackfp->script()->nslots()) * sizeof(HeapValue);
JS_ASSERT(nbytes % sizeof(Value) == 0);
JS_STATIC_ASSERT(sizeof(StackFrame) % sizeof(HeapValue) == 0);

View File

@ -5442,8 +5442,8 @@ dumpValue(const Value &v)
}
if (fun->hasScript()) {
JSScript *script = fun->nonLazyScript();
fprintf(stderr, " (%s:%u)",
script->filename() ? script->filename() : "", script->lineno);
fprintf(stderr, " (%s:%d)",
script->filename() ? script->filename() : "", (int) script->lineno());
}
fprintf(stderr, " at %p>", (void *) fun);
} else if (v.isObject()) {
@ -5669,7 +5669,7 @@ js_DumpStackFrame(JSContext *cx, StackFrame *start)
fputc('\n', stderr);
fprintf(stderr, "file %s line %u\n",
i.script()->filename(), (unsigned) i.script()->lineno);
i.script()->filename(), (unsigned) i.script()->lineno());
if (jsbytecode *pc = i.pc()) {
fprintf(stderr, " pc = %p\n", pc);

View File

@ -437,11 +437,11 @@ class BytecodeParser
}
uint32_t numSlots() {
return 1 + (script_->function() ? script_->function()->nargs : 0) + script_->nfixed;
return 1 + (script_->function() ? script_->function()->nargs : 0) + script_->nfixed();
}
uint32_t maximumStackDepth() {
return script_->nslots - script_->nfixed;
return script_->nslots() - script_->nfixed();
}
Bytecode& getCode(uint32_t offset) {
@ -640,7 +640,7 @@ BytecodeParser::parse()
JSTryNote *tn = script_->trynotes()->vector;
JSTryNote *tnlimit = tn + script_->trynotes()->length;
for (; tn < tnlimit; tn++) {
uint32_t startOffset = script_->mainOffset + tn->start;
uint32_t startOffset = script_->mainOffset() + tn->start;
if (startOffset == offset + 1) {
uint32_t catchOffset = startOffset + tn->length;
if (tn->kind != JSTRY_ITER && tn->kind != JSTRY_LOOP) {
@ -730,7 +730,7 @@ js_DisassembleAtPC(JSContext *cx, JSScript *scriptArg, bool lines,
return false;
if (showAll)
Sprint(sp, "%s:%u\n", script->filename(), script->lineno);
Sprint(sp, "%s:%u\n", script->filename(), script->lineno());
if (pc != nullptr)
sp->put(" ");
@ -1601,8 +1601,8 @@ ExpressionDecompiler::decompilePC(jsbytecode *pc)
case JSOP_CALLLOCAL: {
unsigned i = GET_SLOTNO(pc);
JSAtom *atom;
if (i >= script->nfixed) {
i -= script->nfixed;
if (i >= script->nfixed()) {
i -= script->nfixed();
JS_ASSERT(i < unsigned(parser.stackDepthAtPC(pc)));
atom = findLetVar(pc, i);
if (!atom)
@ -2119,7 +2119,7 @@ js::GetPCCountScriptSummary(JSContext *cx, size_t index)
buf.append(str);
AppendJSONProperty(buf, "line");
NumberValueToStringBuffer(cx, Int32Value(script->lineno), buf);
NumberValueToStringBuffer(cx, Int32Value(script->lineno()), buf);
if (script->function()) {
JSAtom *atom = script->function()->displayAtom();
@ -2218,13 +2218,13 @@ GetPCCountJSON(JSContext *cx, const ScriptAndCounts &sac, StringBuffer &buf)
buf.append(str);
AppendJSONProperty(buf, "line");
NumberValueToStringBuffer(cx, Int32Value(script->lineno), buf);
NumberValueToStringBuffer(cx, Int32Value(script->lineno()), buf);
AppendJSONProperty(buf, "opcodes");
buf.append('[');
bool comma = false;
SrcNoteLineScanner scanner(script->notes(), script->lineno);
SrcNoteLineScanner scanner(script->notes(), script->lineno());
for (jsbytecode *pc = script->code(); pc < script->codeEnd(); pc += GetBytecodeLength(pc)) {
size_t offset = script->pcToOffset(pc);

View File

@ -167,7 +167,7 @@ Bindings::clone(JSContext *cx, InternalBindingsHandle self,
Bindings &src = srcScript->bindings;
ptrdiff_t off = (uint8_t *)src.bindingArray() - srcScript->data;
JS_ASSERT(off >= 0);
JS_ASSERT(size_t(off) <= srcScript->dataSize);
JS_ASSERT(size_t(off) <= srcScript->dataSize());
Binding *dstPackedBindings = (Binding *)(dstScriptData + off);
/*
@ -453,13 +453,13 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
return false;
if (mode == XDR_ENCODE) {
prologLength = script->mainOffset;
prologLength = script->mainOffset();
JS_ASSERT(script->getVersion() != JSVERSION_UNKNOWN);
version = (uint32_t)script->getVersion() | (script->nfixed << 16);
lineno = script->lineno;
nslots = (uint32_t)script->nslots;
nslots = (uint32_t)((script->staticLevel << 16) | script->nslots);
natoms = script->natoms;
version = (uint32_t)script->getVersion() | (script->nfixed() << 16);
lineno = script->lineno();
nslots = (uint32_t)script->nslots();
nslots = (uint32_t)((script->staticLevel() << 16) | script->nslots());
natoms = script->natoms();
nsrcnotes = script->numNotes();
@ -474,8 +474,8 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
if (script->hasBlockScopes())
nblockscopes = script->blockScopes()->length;
nTypeSets = script->nTypeSets;
funLength = script->funLength;
nTypeSets = script->nTypeSets();
funLength = script->funLength();
if (script->noScriptRval)
scriptBits |= (1 << NoScriptRval);
@ -590,11 +590,11 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
return false;
}
JS_ASSERT(!script->mainOffset);
script->mainOffset = prologLength;
JS_ASSERT(!script->mainOffset());
script->mainOffset_ = prologLength;
script->setLength(length);
script->nfixed = uint16_t(version >> 16);
script->funLength = funLength;
script->nfixed_ = uint16_t(version >> 16);
script->funLength_ = funLength;
scriptp.set(script);
@ -631,18 +631,18 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
if (!script->scriptSource()->performXDR<mode>(xdr))
return false;
}
if (!xdr->codeUint32(&script->sourceStart))
if (!xdr->codeUint32(&script->sourceStart_))
return false;
if (!xdr->codeUint32(&script->sourceEnd))
if (!xdr->codeUint32(&script->sourceEnd_))
return false;
if (!xdr->codeUint32(&lineno) || !xdr->codeUint32(&nslots))
return false;
if (mode == XDR_DECODE) {
script->lineno = lineno;
script->nslots = uint16_t(nslots);
script->staticLevel = uint16_t(nslots >> 16);
script->lineno_ = lineno;
script->nslots_ = uint16_t(nslots);
script->staticLevel_ = uint16_t(nslots >> 16);
}
jsbytecode *code = script->code();
@ -653,7 +653,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
return false;
code = ssd->data;
if (natoms != 0) {
script->natoms = natoms;
script->natoms_ = natoms;
script->atoms = ssd->atoms();
}
}
@ -1061,7 +1061,7 @@ JSFlatString *
JSScript::sourceData(JSContext *cx)
{
JS_ASSERT(scriptSource()->hasSourceData());
return scriptSource()->substring(cx, sourceStart, sourceEnd);
return scriptSource()->substring(cx, sourceStart(), sourceEnd());
}
SourceDataCache::AutoSuppressPurge::AutoSuppressPurge(JSContext *cx)
@ -1805,11 +1805,11 @@ JSScript::Create(ExclusiveContext *cx, HandleObject enclosingScope, bool savedCa
}
return nullptr;
}
script->staticLevel = uint16_t(staticLevel);
script->staticLevel_ = uint16_t(staticLevel);
script->setSourceObject(sourceObject);
script->sourceStart = bufStart;
script->sourceEnd = bufEnd;
script->sourceStart_ = bufStart;
script->sourceEnd_ = bufEnd;
return script;
}
@ -1836,10 +1836,10 @@ JSScript::partiallyInit(ExclusiveContext *cx, HandleScript script, uint32_t ncon
script->data = AllocScriptData(cx, size);
if (!script->data)
return false;
script->dataSize = size;
script->dataSize_ = size;
JS_ASSERT(nTypeSets <= UINT16_MAX);
script->nTypeSets = uint16_t(nTypeSets);
script->nTypeSets_ = uint16_t(nTypeSets);
uint8_t *cursor = script->data;
if (nconsts != 0) {
@ -1948,13 +1948,13 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
return false;
}
JS_ASSERT(script->mainOffset == 0);
script->mainOffset = prologLength;
JS_ASSERT(script->mainOffset() == 0);
script->mainOffset_ = prologLength;
script->lineno = bce->firstLine;
script->lineno_ = bce->firstLine;
script->setLength(prologLength + mainLength);
script->natoms = natoms;
script->natoms_ = natoms;
SharedScriptData *ssd = SharedScriptData::new_(cx, script->length(), nsrcnotes, natoms);
if (!ssd)
return false;
@ -1971,12 +1971,12 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
uint32_t nfixed = bce->sc->isFunctionBox() ? script->bindings.numVars() : 0;
JS_ASSERT(nfixed < SLOTNO_LIMIT);
script->nfixed = uint16_t(nfixed);
if (script->nfixed + bce->maxStackDepth >= JS_BIT(16)) {
script->nfixed_ = uint16_t(nfixed);
if (script->nfixed() + bce->maxStackDepth >= JS_BIT(16)) {
bce->reportError(nullptr, JSMSG_NEED_DIET, "script");
return false;
}
script->nslots = script->nfixed + bce->maxStackDepth;
script->nslots_ = script->nfixed() + bce->maxStackDepth;
FunctionBox *funbox = bce->sc->isFunctionBox() ? bce->sc->asFunctionBox() : nullptr;
@ -2007,7 +2007,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
JS_ASSERT(!funbox->definitelyNeedsArgsObj());
}
script->funLength = funbox->length;
script->funLength_ = funbox->length;
}
RootedFunction fun(cx, nullptr);
@ -2031,7 +2031,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
size_t
JSScript::computedSizeOfData() const
{
return dataSize;
return dataSize();
}
size_t
@ -2099,7 +2099,7 @@ js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun)
JS_ASSERT(!script->isActiveEval);
if (JSNewScriptHook hook = cx->runtime()->debugHooks.newScriptHook) {
AutoKeepAtoms keepAtoms(cx->perThreadData);
hook(cx, script->filename(), script->lineno, script, fun,
hook(cx, script->filename(), script->lineno(), script, fun,
cx->runtime()->debugHooks.newScriptHookData);
}
}
@ -2268,7 +2268,7 @@ js::PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp)
if (!pc)
return 0;
return PCToLineNumber(script->lineno, script->notes(), script->code(), pc, columnp);
return PCToLineNumber(script->lineno(), script->notes(), script->code(), pc, columnp);
}
/* The line number limit is the same as the jssrcnote offset limit. */
@ -2279,14 +2279,14 @@ js_LineNumberToPC(JSScript *script, unsigned target)
{
ptrdiff_t offset = 0;
ptrdiff_t best = -1;
unsigned lineno = script->lineno;
unsigned lineno = script->lineno();
unsigned bestdiff = SN_LINE_LIMIT;
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
/*
* Exact-match only if offset is not in the prolog; otherwise use
* nearest greater-or-equal line number match.
*/
if (lineno == target && offset >= ptrdiff_t(script->mainOffset))
if (lineno == target && offset >= ptrdiff_t(script->mainOffset()))
goto out;
if (lineno >= target) {
unsigned diff = lineno - target;
@ -2312,7 +2312,7 @@ out:
JS_FRIEND_API(unsigned)
js_GetScriptLineExtent(JSScript *script)
{
unsigned lineno = script->lineno;
unsigned lineno = script->lineno();
unsigned maxLineNo = lineno;
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
SrcNoteType type = (SrcNoteType) SN_TYPE(sn);
@ -2325,7 +2325,7 @@ js_GetScriptLineExtent(JSScript *script)
maxLineNo = lineno;
}
return 1 + maxLineNo - script->lineno;
return 1 + maxLineNo - script->lineno();
}
void
@ -2385,7 +2385,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
/* Script data */
size_t size = src->dataSize;
size_t size = src->dataSize();
uint8_t *data = AllocScriptData(cx, size);
if (!data)
return nullptr;
@ -2479,8 +2479,8 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
.setVersion(src->getVersion());
RootedScript dst(cx, JSScript::Create(cx, enclosingScope, src->savedCallerFun,
options, src->staticLevel,
sourceObject, src->sourceStart, src->sourceEnd));
options, src->staticLevel(),
sourceObject, src->sourceStart(), src->sourceEnd()));
if (!dst) {
js_free(data);
return nullptr;
@ -2490,7 +2490,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
/* This assignment must occur before all the Rebase calls. */
dst->data = data;
dst->dataSize = size;
dst->dataSize_ = size;
memcpy(data, src->data, size);
/* Script filenames, bytecodes and atoms are runtime-wide. */
@ -2498,13 +2498,13 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
dst->atoms = src->atoms;
dst->setLength(src->length());
dst->lineno = src->lineno;
dst->mainOffset = src->mainOffset;
dst->natoms = src->natoms;
dst->funLength = src->funLength;
dst->nfixed = src->nfixed;
dst->nTypeSets = src->nTypeSets;
dst->nslots = src->nslots;
dst->lineno_ = src->lineno();
dst->mainOffset_ = src->mainOffset();
dst->natoms_ = src->natoms();
dst->funLength_ = src->funLength();
dst->nfixed_ = src->nfixed();
dst->nTypeSets_ = src->nTypeSets();
dst->nslots_ = src->nslots();
if (src->argumentsHasVarBinding()) {
dst->setArgumentsHasVarBinding();
if (src->analyzedArgsUsage())
@ -2810,7 +2810,7 @@ JSScript::markChildren(JSTracer *trc)
JS_ASSERT_IF(trc->runtime->gcStrictCompartmentChecking, zone()->isCollecting());
for (uint32_t i = 0; i < natoms; ++i) {
for (uint32_t i = 0; i < natoms(); ++i) {
if (atoms[i])
MarkString(trc, &atoms[i], "atom");
}
@ -3118,7 +3118,7 @@ LazyScript::staticLevel(JSContext *cx) const
{
for (StaticScopeIter<NoGC> ssi(enclosingScope()); !ssi.done(); ssi++) {
if (ssi.type() == StaticScopeIter<NoGC>::FUNCTION)
return ssi.funScript()->staticLevel + 1;
return ssi.funScript()->staticLevel() + 1;
}
return 1;
}
@ -3178,7 +3178,7 @@ LazyScriptHashPolicy::hash(const Lookup &lookup, HashNumber hashes[3])
void
LazyScriptHashPolicy::hash(JSScript *script, HashNumber hashes[3])
{
LazyScriptHash(script->lineno, script->column, script->sourceStart, script->sourceEnd, hashes);
LazyScriptHash(script->lineno(), script->column(), script->sourceStart(), script->sourceEnd(), hashes);
}
bool
@ -3199,11 +3199,11 @@ LazyScriptHashPolicy::match(JSScript *script, const Lookup &lookup)
// original script can differ. If there is a match, these will be fixed
// up in the resulting clone by the caller.
if (script->lineno != lazy->lineno() ||
script->column != lazy->column() ||
if (script->lineno() != lazy->lineno() ||
script->column() != lazy->column() ||
script->getVersion() != lazy->version() ||
script->sourceStart != lazy->begin() ||
script->sourceEnd != lazy->end())
script->sourceStart() != lazy->begin() ||
script->sourceEnd() != lazy->end())
{
return false;
}
@ -3218,7 +3218,7 @@ LazyScriptHashPolicy::match(JSScript *script, const Lookup &lookup)
if (!lazyChars)
return false;
size_t begin = script->sourceStart;
size_t length = script->sourceEnd - begin;
size_t begin = script->sourceStart();
size_t length = script->sourceEnd() - begin;
return !memcmp(scriptChars + begin, lazyChars + begin, length);
}

View File

@ -487,6 +487,20 @@ GeneratorKindFromBits(unsigned val) {
return static_cast<GeneratorKind>(val);
}
/*
* NB: after a successful XDR_DECODE, XDRScript callers must do any required
* subsequent set-up of owning function or script object and then call
* js_CallNewScriptHook.
*/
template<XDRMode mode>
bool
XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enclosingScript,
HandleFunction fun, MutableHandleScript scriptp);
JSScript *
CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HandleScript script,
NewObjectKind newKind = GenericObject);
} /* namespace js */
class JSScript : public js::gc::BarrieredCell<JSScript>
@ -494,6 +508,16 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
static const uint32_t stepFlagMask = 0x80000000U;
static const uint32_t stepCountMask = 0x7fffffffU;
template <js::XDRMode mode>
friend
bool
js::XDRScript(js::XDRState<mode> *xdr, js::HandleObject enclosingScope, js::HandleScript enclosingScript,
js::HandleFunction fun, js::MutableHandleScript scriptp);
friend JSScript *
js::CloneScript(JSContext *cx, js::HandleObject enclosingScope, js::HandleFunction fun, js::HandleScript src,
js::NewObjectKind newKind);
public:
//
// We order fields according to their size in order to avoid wasting space
@ -551,22 +575,20 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
// 32-bit fields.
uint32_t length_; /* length of code vector */
public:
uint32_t dataSize; /* size of the used part of the data array */
uint32_t dataSize_; /* size of the used part of the data array */
uint32_t lineno; /* base line number of script */
uint32_t column; /* base column of script, optionally set */
uint32_t lineno_; /* base line number of script */
uint32_t column_; /* base column of script, optionally set */
uint32_t mainOffset; /* offset of main entry point from code, after
uint32_t mainOffset_;/* offset of main entry point from code, after
predef'ing prolog */
uint32_t natoms; /* length of atoms array */
uint32_t natoms_; /* length of atoms array */
/* Range of characters in scriptSource which contains this script's source. */
uint32_t sourceStart;
uint32_t sourceEnd;
uint32_t sourceStart_;
uint32_t sourceEnd_;
private:
uint32_t useCount; /* Number of times the script has been called
* or has had backedges taken. Reset if the
* script's JIT code is forcibly discarded. */
@ -575,27 +597,24 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
// Unique identifier within the compartment for this script, used for
// printing analysis information.
uint32_t id_;
private:
uint32_t idpad;
#endif
// 16-bit fields.
private:
uint16_t PADDING16;
uint16_t version; /* JS version under which script was compiled */
public:
uint16_t funLength; /* ES6 function length */
uint16_t funLength_; /* ES6 function length */
uint16_t nfixed; /* number of slots besides stack operands in
uint16_t nfixed_; /* number of slots besides stack operands in
slot array */
uint16_t nTypeSets; /* number of type sets used in this script for
uint16_t nTypeSets_; /* number of type sets used in this script for
dynamic type monitoring */
uint16_t nslots; /* vars plus maximum stack depth */
uint16_t staticLevel;/* static level for display maintenance */
uint16_t nslots_; /* vars plus maximum stack depth */
uint16_t staticLevel_;/* static level for display maintenance */
// Bit fields.
@ -748,6 +767,58 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
return code() + offset;
}
size_t mainOffset() const {
js::AutoThreadSafeAccess ts(this);
return mainOffset_;
}
size_t lineno() const {
js::AutoThreadSafeAccess ts(this);
return lineno_;
}
size_t column() const {
js::AutoThreadSafeAccess ts(this);
return column_;
}
void setColumn(size_t column) { column_ = column; }
size_t nfixed() const {
js::AutoThreadSafeAccess ts(this);
return nfixed_;
}
size_t nslots() const {
js::AutoThreadSafeAccess ts(this);
return nslots_;
}
size_t staticLevel() const {
js::AutoThreadSafeAccess ts(this);
return staticLevel_;
}
size_t nTypeSets() const {
js::AutoThreadSafeAccess ts(this);
return nTypeSets_;
}
size_t funLength() const {
js::AutoThreadSafeAccess ts(this);
return funLength_;
}
size_t sourceStart() const {
js::AutoThreadSafeAccess ts(this);
return sourceStart_;
}
size_t sourceEnd() const {
js::AutoThreadSafeAccess ts(this);
return sourceEnd_;
}
/* See ContextFlags::funArgumentsHasLocalBinding comment. */
bool argumentsHasVarBinding() const { return argsHasVarBinding_; }
jsbytecode *argumentsBytecode() const { JS_ASSERT(code()[0] == JSOP_ARGUMENTS); return code(); }
@ -973,7 +1044,7 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
void destroyScriptCounts(js::FreeOp *fop);
jsbytecode *main() {
return code() + mainOffset;
return code() + mainOffset();
}
/*
@ -1008,6 +1079,8 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
size_t trynotesOffset() { return OFF(regexpsOffset, hasRegexps, js::ObjectArray); }
size_t blockScopesOffset(){ return OFF(trynotesOffset, hasTrynotes, js::TryNoteArray); }
size_t dataSize() const { return dataSize_; }
js::ConstArray *consts() {
JS_ASSERT(hasConsts());
return reinterpret_cast<js::ConstArray *>(data + constsOffset());
@ -1035,8 +1108,10 @@ class JSScript : public js::gc::BarrieredCell<JSScript>
bool hasLoops();
size_t natoms() const { return natoms_; }
js::HeapPtrAtom &getAtom(size_t index) const {
JS_ASSERT(index < natoms);
JS_ASSERT(index < natoms());
return atoms[index];
}
@ -1563,10 +1638,6 @@ extern void
CurrentScriptFileLineOrigin(JSContext *cx, const char **file, unsigned *linenop,
JSPrincipals **origin, LineOption opt = NOT_CALLED_FROM_JSOP_EVAL);
extern JSScript *
CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HandleScript script,
NewObjectKind newKind = GenericObject);
bool
CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction clone,
NewObjectKind newKind = GenericObject);
@ -1584,16 +1655,6 @@ NormalizeOriginPrincipals(JSPrincipals *principals, JSPrincipals *originPrincipa
return originPrincipals ? originPrincipals : principals;
}
/*
* NB: after a successful XDR_DECODE, XDRScript callers must do any required
* subsequent set-up of owning function or script object and then call
* js_CallNewScriptHook.
*/
template<XDRMode mode>
bool
XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enclosingScript,
HandleFunction fun, MutableHandleScript scriptp);
} /* namespace js */
#endif /* jsscript_h */

View File

@ -1522,7 +1522,7 @@ TrapHandler(JSContext *cx, JSScript *, jsbytecode *pc, jsval *rvalArg,
if (!frame.evaluateUCInStackFrame(cx, chars, length,
script->filename(),
script->lineno,
script->lineno(),
&rval))
{
*rvalArg = rval;
@ -1706,7 +1706,7 @@ SrcNotes(JSContext *cx, HandleScript script, Sprinter *sp)
Sprint(sp, "---- ---- ----- ------ -------- ------\n");
unsigned offset = 0;
unsigned colspan = 0;
unsigned lineno = script->lineno;
unsigned lineno = script->lineno();
jssrcnote *notes = script->notes();
unsigned switchTableEnd = 0, switchTableStart = 0;
for (jssrcnote *sn = notes; !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {

View File

@ -2581,7 +2581,7 @@ class Debugger::ScriptQuery {
return;
}
if (hasLine) {
if (line < script->lineno || script->lineno + js_GetScriptLineExtent(script) < line)
if (line < script->lineno() || script->lineno() + js_GetScriptLineExtent(script) < line)
return;
}
if (innermost) {
@ -2601,7 +2601,7 @@ class Debugger::ScriptQuery {
if (p) {
/* Is our newly found script deeper than the last one we found? */
JSScript *incumbent = p->value();
if (script->staticLevel > incumbent->staticLevel)
if (script->staticLevel() > incumbent->staticLevel())
p->value() = script;
} else {
/*
@ -2884,7 +2884,7 @@ static bool
DebuggerScript_getStartLine(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get startLine)", args, obj, script);
args.rval().setNumber(script->lineno);
args.rval().setNumber(uint32_t(script->lineno()));
return true;
}
@ -2917,7 +2917,7 @@ static bool
DebuggerScript_getSourceStart(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get sourceStart)", args, obj, script);
args.rval().setNumber(script->sourceStart);
args.rval().setNumber(uint32_t(script->sourceStart()));
return true;
}
@ -2925,7 +2925,7 @@ static bool
DebuggerScript_getSourceLength(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get sourceEnd)", args, obj, script);
args.rval().setNumber(script->sourceEnd - script->sourceStart);
args.rval().setNumber(uint32_t(script->sourceEnd() - script->sourceStart()));
return true;
}
@ -2933,7 +2933,7 @@ static bool
DebuggerScript_getStaticLevel(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGSCRIPT_SCRIPT(cx, argc, vp, "(get staticLevel)", args, obj, script);
args.rval().setNumber(uint32_t(script->staticLevel));
args.rval().setNumber(uint32_t(script->staticLevel()));
return true;
}
@ -3037,7 +3037,7 @@ class BytecodeRangeWithPosition : private BytecodeRange
using BytecodeRange::frontOffset;
BytecodeRangeWithPosition(JSContext *cx, JSScript *script)
: BytecodeRange(cx, script), lineno(script->lineno), column(0),
: BytecodeRange(cx, script), lineno(script->lineno()), column(0),
sn(script->notes()), snpc(script->code())
{
if (!SN_IS_TERMINATOR(sn))
@ -3202,7 +3202,7 @@ class FlowGraphSummary {
for (size_t i = mainOffset + 1; i < script->length(); i++)
entries_[i] = Entry::createWithNoEdges();
size_t prevLineno = script->lineno;
size_t prevLineno = script->lineno();
size_t prevColumn = 0;
JSOp prevOp = JSOP_NOP;
for (BytecodeRangeWithPosition r(cx, script); !r.empty(); r.popFront()) {
@ -3582,7 +3582,7 @@ DebuggerScript_isInCatchScope(JSContext *cx, unsigned argc, Value* vp)
* Try note ranges are relative to the mainOffset of the script, so adjust
* offset accordingly.
*/
offset -= script->mainOffset;
offset -= script->mainOffset();
args.rval().setBoolean(false);
if (script->hasTrynotes()) {

View File

@ -699,12 +699,12 @@ js::ParallelDo::enqueueInitialScript(ExecutionStatus *status)
if (script->hasParallelIonScript()) {
if (!script->parallelIonScript()->hasUncompiledCallTarget()) {
Spew(SpewOps, "Script %p:%s:%d already compiled, no uncompiled callees",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return GreenLight;
}
Spew(SpewOps, "Script %p:%s:%d already compiled, may have uncompiled callees",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
}
// Otherwise, add to the worklist of scripts to process.
@ -765,7 +765,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
Spew(SpewCompile,
"Script %p:%s:%d has no baseline script, "
"but use count grew from %d to %d",
script.get(), script->filename(), script->lineno,
script.get(), script->filename(), script->lineno(),
previousUseCount, currentUseCount);
} else {
uint32_t stallCount = ++worklistData_[i].stallCount;
@ -776,7 +776,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
Spew(SpewCompile,
"Script %p:%s:%d has no baseline script, "
"and use count has %u stalls at %d",
script.get(), script->filename(), script->lineno,
script.get(), script->filename(), script->lineno(),
stallCount, previousUseCount);
}
continue;
@ -796,7 +796,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
Spew(SpewCompile,
"Script %p:%s:%d cannot be compiled, "
"falling back to sequential execution",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return sequentialExecution(true, status);
case Method_Skipped:
@ -805,7 +805,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
if (script->isParallelIonCompilingOffThread()) {
Spew(SpewCompile,
"Script %p:%s:%d compiling off-thread",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
offMainThreadCompilationsInProgress = true;
continue;
}
@ -814,7 +814,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
case Method_Compiled:
Spew(SpewCompile,
"Script %p:%s:%d compiled",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
JS_ASSERT(script->hasParallelIonScript());
break;
}
@ -863,7 +863,7 @@ js::ParallelDo::compileForParallelExecution(ExecutionStatus *status)
"Script %p:%s:%d is not stalled, "
"but no parallel ion script found, "
"restarting loop",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
}
}
}
@ -914,7 +914,7 @@ js::ParallelDo::appendCallTargetsToWorklist(uint32_t index,
target = ion->callTargetList()[i];
parallel::Spew(parallel::SpewCompile,
"Adding call target %s:%u",
target->filename(), target->lineno);
target->filename(), target->lineno());
if (appendCallTargetToWorklist(target, status) == RedLight)
return RedLight;
}
@ -934,7 +934,7 @@ js::ParallelDo::appendCallTargetToWorklist(HandleScript script,
// Fallback to sequential if disabled.
if (!script->canParallelIonCompile()) {
Spew(SpewCompile, "Skipping %p:%s:%u, canParallelIonCompile() is false",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return sequentialExecution(true, status);
}
@ -942,7 +942,7 @@ js::ParallelDo::appendCallTargetToWorklist(HandleScript script,
// Skip if the code is expected to result in a bailout.
if (script->parallelIonScript()->bailoutExpected()) {
Spew(SpewCompile, "Skipping %p:%s:%u, bailout expected",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return sequentialExecution(false, status);
}
}
@ -959,13 +959,13 @@ js::ParallelDo::addToWorklist(HandleScript script)
for (uint32_t i = 0; i < worklist_.length(); i++) {
if (worklist_[i] == script) {
Spew(SpewCompile, "Skipping %p:%s:%u, already in worklist",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
return true;
}
}
Spew(SpewCompile, "Enqueued %p:%s:%u",
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
// Note that we add all possibly compilable functions to the worklist,
// even if they're already compiled. This is so that we can return
@ -1115,7 +1115,7 @@ js::ParallelDo::invalidateBailedOutScripts()
"Bailout from thread %d: cause %d, topScript %p:%s:%d",
i,
bailoutRecords_[i].cause,
script.get(), script->filename(), script->lineno);
script.get(), script->filename(), script->lineno());
switch (bailoutRecords_[i].cause) {
// An interrupt is not the fault of the script, so don't
@ -1134,7 +1134,7 @@ js::ParallelDo::invalidateBailedOutScripts()
continue;
Spew(SpewBailouts, "Invalidating script %p:%s:%d due to cause %d",
script.get(), script->filename(), script->lineno,
script.get(), script->filename(), script->lineno(),
bailoutRecords_[i].cause);
types::RecompileInfo co = script->parallelIonScript()->recompileInfo();
@ -2069,7 +2069,7 @@ class ParallelSpewer
if (!active[SpewCompile])
return;
spew(SpewCompile, "COMPILE %p:%s:%u", script.get(), script->filename(), script->lineno);
spew(SpewCompile, "COMPILE %p:%s:%u", script.get(), script->filename(), script->lineno());
depth++;
}

View File

@ -1349,7 +1349,7 @@ Interpret(JSContext *cx, RunState &state)
if (JS_UNLIKELY(REGS.fp()->isGeneratorFrame())) {
JS_ASSERT(script->containsPC(REGS.pc));
JS_ASSERT(REGS.stackDepth() <= script->nslots);
JS_ASSERT(REGS.stackDepth() <= script->nslots());
/*
* To support generator_throw and to catch ignored exceptions,
@ -3231,7 +3231,7 @@ CASE(JSOP_ENTERLET2)
if (*REGS.pc == JSOP_ENTERBLOCK) {
JS_ASSERT(REGS.stackDepth() == blockObj.stackDepth());
JS_ASSERT(REGS.stackDepth() + blockObj.slotCount() <= script->nslots);
JS_ASSERT(REGS.stackDepth() + blockObj.slotCount() <= script->nslots());
Value *vp = REGS.sp + blockObj.slotCount();
SetValueRangeToUndefined(REGS.sp, vp);
REGS.sp = vp;
@ -3302,8 +3302,8 @@ CASE(JSOP_YIELD)
CASE(JSOP_ARRAYPUSH)
{
uint32_t slot = GET_UINT16(REGS.pc);
JS_ASSERT(script->nfixed <= slot);
JS_ASSERT(slot < script->nslots);
JS_ASSERT(script->nfixed() <= slot);
JS_ASSERT(slot < script->nslots());
RootedObject &obj = rootObject0;
obj = &REGS.fp()->unaliasedLocal(slot).toObject();
if (!js_NewbornArrayPush(cx, obj, REGS.sp[-1]))

View File

@ -410,7 +410,7 @@ JS_GetLinePCs(JSContext *cx, JSScript *script,
return false;
}
unsigned lineno = script->lineno;
unsigned lineno = script->lineno();
unsigned offset = 0;
unsigned i = 0;
for (jssrcnote *sn = script->notes(); !SN_IS_TERMINATOR(sn); sn = SN_NEXT(sn)) {
@ -578,7 +578,7 @@ JS_GetScriptSourceMap(JSContext *cx, JSScript *script)
JS_PUBLIC_API(unsigned)
JS_GetScriptBaseLineNumber(JSContext *cx, JSScript *script)
{
return script->lineno;
return script->lineno();
}
JS_PUBLIC_API(unsigned)
@ -837,10 +837,10 @@ JS_DumpBytecode(JSContext *cx, JSScript *scriptArg)
if (!sprinter.init())
return;
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), script->lineno);
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
js_Disassemble(cx, script, true, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), script->lineno);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
#endif
}
@ -854,10 +854,10 @@ JS_DumpPCCounts(JSContext *cx, JSScript *scriptArg)
if (!sprinter.init())
return;
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), script->lineno);
fprintf(stdout, "--- SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
js_DumpPCCounts(cx, script, &sprinter);
fputs(sprinter.string(), stdout);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), script->lineno);
fprintf(stdout, "--- END SCRIPT %s:%d ---\n", script->filename(), (int) script->lineno());
}
namespace {

View File

@ -89,7 +89,7 @@ probes::StartExecution(JSScript *script)
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_START_ENABLED())
JAVASCRIPT_EXECUTE_START((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
script->lineno());
#endif
return ok;
@ -103,7 +103,7 @@ probes::StopExecution(JSScript *script)
#ifdef INCLUDE_MOZILLA_DTRACE
if (JAVASCRIPT_EXECUTE_DONE_ENABLED())
JAVASCRIPT_EXECUTE_DONE((script->filename() ? (char *)script->filename() : nullName),
script->lineno);
script->lineno());
#endif
return ok;

View File

@ -228,7 +228,7 @@ SPSProfiler::allocProfileString(JSContext *cx, JSScript *script, JSFunction *may
}
if (!buf.append(":"))
return nullptr;
if (!NumberValueToStringBuffer(cx, NumberValue(script->lineno), buf))
if (!NumberValueToStringBuffer(cx, NumberValue(script->lineno()), buf))
return nullptr;
if (hasAtom && !buf.append(")"))
return nullptr;

View File

@ -610,7 +610,7 @@ ClonedBlockObject::create(JSContext *cx, Handle<StaticBlockObject *> block, Abst
* any fixup since the initial value is 'undefined'.
*/
unsigned nslots = block->slotCount();
unsigned base = frame.script()->nfixed + block->stackDepth();
unsigned base = frame.script()->nfixed() + block->stackDepth();
for (unsigned i = 0; i < nslots; ++i) {
if (block->isAliased(i))
obj->as<ClonedBlockObject>().setVar(i, frame.unaliasedLocal(base + i));
@ -625,7 +625,7 @@ void
ClonedBlockObject::copyUnaliasedValues(AbstractFramePtr frame)
{
StaticBlockObject &block = staticBlock();
unsigned base = frame.script()->nfixed + block.stackDepth();
unsigned base = frame.script()->nfixed() + block.stackDepth();
for (unsigned i = 0; i < slotCount(); ++i) {
if (!block.isAliased(i))
setVar(i, frame.unaliasedLocal(base + i), DONT_CHECK_ALIASING);
@ -2241,14 +2241,14 @@ AnalyzeEntrainedVariablesInScript(JSContext *cx, HandleScript script, HandleScri
buf.printf(" ");
}
buf.printf("(%s:%d) has variables entrained by ", script->filename(), script->lineno);
buf.printf("(%s:%d) has variables entrained by ", script->filename(), script->lineno());
if (JSAtom *name = innerScript->function()->displayAtom()) {
buf.putString(name);
buf.printf(" ");
}
buf.printf("(%s:%d) ::", innerScript->filename(), innerScript->lineno);
buf.printf("(%s:%d) ::", innerScript->filename(), innerScript->lineno());
for (PropertyNameSet::Range r = remainingNames.all(); !r.empty(); r.popFront()) {
buf.printf(" ");

View File

@ -95,14 +95,14 @@ StackFrame::initCallFrame(JSContext *cx, StackFrame *prev, jsbytecode *prevpc, V
inline void
StackFrame::initVarsToUndefined()
{
SetValueRangeToUndefined(slots(), script()->nfixed);
SetValueRangeToUndefined(slots(), script()->nfixed());
}
inline Value &
StackFrame::unaliasedVar(unsigned i, MaybeCheckAliasing checkAliasing)
{
JS_ASSERT_IF(checkAliasing, !script()->varIsAliased(i));
JS_ASSERT(i < script()->nfixed);
JS_ASSERT(i < script()->nfixed());
return slots()[i];
}
@ -256,7 +256,7 @@ InterpreterStack::getCallFrame(JSContext *cx, const CallArgs &args, HandleScript
JS_ASSERT(fun->nonLazyScript() == script);
unsigned nformal = fun->nargs;
unsigned nvals = script->nslots;
unsigned nvals = script->nslots();
if (args.length() >= nformal) {
*pargv = args.array();

View File

@ -99,7 +99,7 @@ StackFrame::copyFrameAndValues(JSContext *cx, Value *vp, StackFrame *otherfp,
{
JS_ASSERT(othervp == otherfp->generatorArgsSnapshotBegin());
JS_ASSERT(othersp >= otherfp->slots());
JS_ASSERT(othersp <= otherfp->generatorSlotsSnapshotBegin() + otherfp->script()->nslots);
JS_ASSERT(othersp <= otherfp->generatorSlotsSnapshotBegin() + otherfp->script()->nslots());
/* Copy args, StackFrame, and slots. */
const Value *srcend = otherfp->generatorArgsSnapshotEnd();
@ -179,10 +179,10 @@ StackFrame::maybeSuspendedGenerator(JSRuntime *rt)
bool
StackFrame::copyRawFrameSlots(AutoValueVector *vec)
{
if (!vec->resize(numFormalArgs() + script()->nfixed))
if (!vec->resize(numFormalArgs() + script()->nfixed()))
return false;
PodCopy(vec->begin(), argv(), numFormalArgs());
PodCopy(vec->begin() + numFormalArgs(), slots(), script()->nfixed);
PodCopy(vec->begin() + numFormalArgs(), slots(), script()->nfixed());
return true;
}
@ -497,7 +497,7 @@ InterpreterStack::pushExecuteFrame(JSContext *cx, HandleScript script, const Val
{
LifoAlloc::Mark mark = allocator_.mark();
unsigned nvars = 2 /* callee, this */ + script->nslots;
unsigned nvars = 2 /* callee, this */ + script->nslots();
uint8_t *buffer = allocateFrame(cx, sizeof(StackFrame) + nvars * sizeof(Value));
if (!buffer)
return nullptr;
@ -1206,9 +1206,9 @@ ScriptFrameIter::numFrameSlots() const
case JIT: {
#ifdef JS_ION
if (data_.ionFrames_.isOptimizedJS())
return ionInlineFrames_.snapshotIterator().slots() - ionInlineFrames_.script()->nfixed;
return ionInlineFrames_.snapshotIterator().slots() - ionInlineFrames_.script()->nfixed();
jit::BaselineFrame *frame = data_.ionFrames_.baselineFrame();
return frame->numValueSlots() - data_.ionFrames_.script()->nfixed;
return frame->numValueSlots() - data_.ionFrames_.script()->nfixed();
#else
break;
#endif
@ -1230,11 +1230,11 @@ ScriptFrameIter::frameSlotValue(size_t index) const
#ifdef JS_ION
if (data_.ionFrames_.isOptimizedJS()) {
jit::SnapshotIterator si(ionInlineFrames_.snapshotIterator());
index += ionInlineFrames_.script()->nfixed;
index += ionInlineFrames_.script()->nfixed();
return si.maybeReadSlotByIndex(index);
}
index += data_.ionFrames_.script()->nfixed;
index += data_.ionFrames_.script()->nfixed();
return *data_.ionFrames_.baselineFrame()->valueSlot(index);
#else
break;
@ -1290,11 +1290,11 @@ js::CheckLocalUnaliased(MaybeCheckAliasing checkAliasing, JSScript *script,
if (!checkAliasing)
return;
JS_ASSERT(i < script->nslots);
if (i < script->nfixed) {
JS_ASSERT(i < script->nslots());
if (i < script->nfixed()) {
JS_ASSERT(!script->varIsAliased(i));
} else {
unsigned depth = i - script->nfixed;
unsigned depth = i - script->nfixed();
for (StaticBlockObject *b = maybeBlock; b; b = b->enclosingBlock()) {
if (b->containsVarAtDepth(depth)) {
JS_ASSERT(!b->isAliased(depth - b->stackDepth()));

View File

@ -380,7 +380,7 @@ class StackFrame
*/
public:
Value *slots() const { return (Value *)(this + 1); }
Value *base() const { return slots() + script()->nfixed; }
Value *base() const { return slots() + script()->nfixed(); }
Value *argv() const { return argv_; }
private:
@ -483,7 +483,7 @@ class StackFrame
}
bool isDirectEvalFrame() const {
return isEvalFrame() && script()->staticLevel > 0;
return isEvalFrame() && script()->staticLevel() > 0;
}
bool isNonStrictDirectEvalFrame() const {
@ -1021,7 +1021,7 @@ class FrameRegs
}
Value *spForStackDepth(unsigned depth) const {
JS_ASSERT(fp_->script()->nfixed + depth <= fp_->script()->nslots);
JS_ASSERT(fp_->script()->nfixed() + depth <= fp_->script()->nslots());
return fp_->base() + depth;
}
@ -1041,7 +1041,7 @@ class FrameRegs
}
void prepareToRun(StackFrame &fp, JSScript *script) {
pc = script->code();
sp = fp.slots() + script->nfixed;
sp = fp.slots() + script->nfixed();
fp_ = &fp;
}