From 05bb64b19d4f9bf782de497435c309392de1cd93 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Tue, 30 Apr 2013 15:40:40 -0700 Subject: [PATCH] Bug 867426 - Remove RawScript typedef; r=jonco --HG-- extra : rebase_source : c32ce48bca7fea1dfdafbf9395835613d8a57276 --- js/public/RootingAPI.h | 1 - js/src/builtin/Eval.cpp | 8 ++-- js/src/frontend/BytecodeCompiler.cpp | 4 +- js/src/frontend/BytecodeCompiler.h | 2 +- js/src/gc/Marking.cpp | 14 +++---- js/src/ion/Bailouts.cpp | 8 ++-- js/src/ion/BaselineIC.cpp | 6 +-- js/src/ion/BaselineInspector.h | 2 +- js/src/ion/BaselineJIT.cpp | 4 +- js/src/ion/BaselineJIT.h | 4 +- js/src/ion/CodeGenerator.cpp | 6 +-- js/src/ion/CompileInfo.h | 8 ++-- js/src/ion/ExecutionModeInlines.h | 10 ++--- js/src/ion/Ion.cpp | 42 ++++++++++---------- js/src/ion/Ion.h | 18 ++++----- js/src/ion/IonCaches.cpp | 2 +- js/src/ion/IonCaches.h | 2 +- js/src/ion/IonCode.h | 2 +- js/src/ion/IonCompartment.h | 2 +- js/src/ion/IonFrameIterator-inl.h | 2 +- js/src/ion/IonFrameIterator.h | 6 +-- js/src/ion/IonFrames-inl.h | 4 +- js/src/ion/IonFrames.cpp | 14 +++---- js/src/ion/IonFrames.h | 10 ++--- js/src/ion/IonMacroAssembler.h | 2 +- js/src/ion/JSONSpewer.cpp | 2 +- js/src/ion/JSONSpewer.h | 2 +- js/src/ion/LIR-Common.h | 2 +- js/src/ion/MIR.cpp | 2 +- js/src/ion/MIR.h | 12 +++--- js/src/ion/MIRGraph.h | 8 ++-- js/src/ion/ParallelArrayAnalysis.h | 2 +- js/src/ion/PcScriptCache.h | 4 +- js/src/ion/SnapshotWriter.h | 2 +- js/src/ion/Snapshots.cpp | 4 +- js/src/ion/VMFunctions.h | 2 +- js/src/ion/shared/CodeGenerator-shared.h | 4 +- js/src/jsanalyze.cpp | 4 +- js/src/jsanalyze.h | 26 ++++++------ js/src/jsapi.cpp | 2 +- js/src/jsarray.cpp | 2 +- js/src/jscntxt.cpp | 2 +- js/src/jsdbgapi.cpp | 4 +- js/src/jsdbgapi.h | 4 +- js/src/jsfriendapi.h | 2 +- js/src/jsfun.cpp | 4 +- js/src/jsfun.h | 6 +-- js/src/jsgc.cpp | 2 +- js/src/jsinfer.cpp | 50 ++++++++++++------------ js/src/jsinfer.h | 20 +++++----- js/src/jsinferinlines.h | 20 +++++----- js/src/jsinterp.cpp | 2 +- js/src/jsinterpinlines.h | 2 +- js/src/jsobj.cpp | 14 +++---- js/src/jsprobes.cpp | 8 ++-- js/src/jsprobes.h | 22 +++++------ js/src/jsscript.cpp | 26 ++++++------ js/src/jsscript.h | 34 ++++++++-------- js/src/jsscriptinlines.h | 8 ++-- js/src/jsstr.cpp | 2 +- js/src/methodjit/MonoIC.cpp | 4 +- js/src/methodjit/PolyIC.cpp | 2 +- js/src/methodjit/StubCalls.cpp | 4 +- js/src/shell/js.cpp | 6 +-- js/src/vm/ArgumentsObject.cpp | 4 +- js/src/vm/Debugger.cpp | 4 +- js/src/vm/SPSProfiler.cpp | 20 +++++----- js/src/vm/SPSProfiler.h | 30 +++++++------- js/src/vm/ScopeObject.cpp | 4 +- js/src/vm/ScopeObject.h | 2 +- js/src/vm/SelfHosting.cpp | 2 +- js/src/vm/Stack-inl.h | 10 ++--- js/src/vm/Stack.cpp | 4 +- js/src/vm/Stack.h | 20 +++++----- 74 files changed, 304 insertions(+), 307 deletions(-) diff --git a/js/public/RootingAPI.h b/js/public/RootingAPI.h index a52b77297ccb..86bf7c363255 100644 --- a/js/public/RootingAPI.h +++ b/js/public/RootingAPI.h @@ -824,7 +824,6 @@ class CompilerRootNode } /* namespace js */ -ForwardDeclareJS(Script); ForwardDeclareJS(Object); #endif /* jsgc_root_h___ */ diff --git a/js/src/builtin/Eval.cpp b/js/src/builtin/Eval.cpp index 8cfa654444eb..4db9b7b02955 100644 --- a/js/src/builtin/Eval.cpp +++ b/js/src/builtin/Eval.cpp @@ -34,7 +34,7 @@ AssertInnerizedScopeChain(JSContext *cx, JSObject &scopeobj) } static bool -IsEvalCacheCandidate(RawScript script) +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 @@ -123,7 +123,7 @@ class EvalScriptGuard } } - void setNewScript(RawScript script) { + void setNewScript(JSScript *script) { // JSScript::initFromEmitter has already called js_CallNewScriptHook. JS_ASSERT(!script_ && script); script_ = script; @@ -289,7 +289,7 @@ EvalKernel(JSContext *cx, const CallArgs &args, EvalType evalType, AbstractFrame .setNoScriptRval(false) .setPrincipals(principals) .setOriginPrincipals(originPrincipals); - RawScript compiled = frontend::CompileScript(cx, scopeobj, callerScript, options, + JSScript *compiled = frontend::CompileScript(cx, scopeobj, callerScript, options, chars.get(), length, stableStr, staticLevel); if (!compiled) return false; @@ -350,7 +350,7 @@ js::DirectEvalFromIon(JSContext *cx, .setNoScriptRval(false) .setPrincipals(principals) .setOriginPrincipals(originPrincipals); - RawScript compiled = frontend::CompileScript(cx, scopeobj, callerScript, options, + JSScript *compiled = frontend::CompileScript(cx, scopeobj, callerScript, options, chars.get(), length, stableStr, staticLevel); if (!compiled) return false; diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp index 470444c9e33a..e99c28fea7ff 100644 --- a/js/src/frontend/BytecodeCompiler.cpp +++ b/js/src/frontend/BytecodeCompiler.cpp @@ -38,7 +38,7 @@ CheckLength(JSContext *cx, size_t length) } static bool -SetSourceMap(JSContext *cx, TokenStream &tokenStream, ScriptSource *ss, RawScript script) +SetSourceMap(JSContext *cx, TokenStream &tokenStream, ScriptSource *ss, JSScript *script) { if (tokenStream.hasSourceMap()) { if (!ss->setSourceMap(cx, tokenStream.releaseSourceMap(), script->filename())) @@ -74,7 +74,7 @@ CheckArgumentsWithinEval(JSContext *cx, Parser &parser, Handle return true; } -RawScript +JSScript * frontend::CompileScript(JSContext *cx, HandleObject scopeChain, HandleScript evalCaller, const CompileOptions &options, diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h index 9f1164e69400..42dc1d5e32d6 100644 --- a/js/src/frontend/BytecodeCompiler.h +++ b/js/src/frontend/BytecodeCompiler.h @@ -12,7 +12,7 @@ namespace js { namespace frontend { -RawScript +JSScript * CompileScript(JSContext *cx, HandleObject scopeChain, HandleScript evalCaller, const CompileOptions &options, const jschar *chars, size_t length, JSString *source_ = NULL, unsigned staticLevel = 0, diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index 05b3330d4ef1..c6832964be6a 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -66,7 +66,7 @@ static inline void PushMarkStack(GCMarker *gcmarker, JSFunction *thing); static inline void -PushMarkStack(GCMarker *gcmarker, RawScript thing); +PushMarkStack(GCMarker *gcmarker, JSScript *thing); static inline void PushMarkStack(GCMarker *gcmarker, Shape *thing); @@ -81,7 +81,7 @@ namespace js { namespace gc { static void MarkChildren(JSTracer *trc, JSString *str); -static void MarkChildren(JSTracer *trc, RawScript script); +static void MarkChildren(JSTracer *trc, JSScript *script); static void MarkChildren(JSTracer *trc, Shape *shape); static void MarkChildren(JSTracer *trc, BaseShape *base); static void MarkChildren(JSTracer *trc, types::TypeObject *type); @@ -389,7 +389,7 @@ gc::MarkKind(JSTracer *trc, void **thingp, JSGCTraceKind kind) MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_SCRIPT: - MarkInternal(trc, reinterpret_cast(thingp)); + MarkInternal(trc, reinterpret_cast(thingp)); break; case JSTRACE_SHAPE: MarkInternal(trc, reinterpret_cast(thingp)); @@ -714,7 +714,7 @@ gc::MarkCrossCompartmentSlot(JSTracer *trc, RawObject src, HeapSlot *dst, const /*** Special Marking ***/ void -gc::MarkObject(JSTracer *trc, HeapPtr *thingp, const char *name) +gc::MarkObject(JSTracer *trc, HeapPtr *thingp, const char *name) { JS_SET_TRACING_NAME(trc, name); MarkInternal(trc, thingp->unsafeGet()); @@ -779,7 +779,7 @@ PushMarkStack(GCMarker *gcmarker, types::TypeObject *thing) } static void -PushMarkStack(GCMarker *gcmarker, RawScript thing) +PushMarkStack(GCMarker *gcmarker, JSScript *thing) { JS_COMPARTMENT_ASSERT(gcmarker->runtime, thing); JS_ASSERT(!IsInsideNursery(thing->runtime(), thing)); @@ -993,7 +993,7 @@ gc::MarkChildren(JSTracer *trc, JSString *str) } static void -gc::MarkChildren(JSTracer *trc, RawScript script) +gc::MarkChildren(JSTracer *trc, JSScript *script) { script->markChildren(trc); } @@ -1499,7 +1499,7 @@ js::TraceChildren(JSTracer *trc, void *thing, JSGCTraceKind kind) break; case JSTRACE_SCRIPT: - MarkChildren(trc, static_cast(thing)); + MarkChildren(trc, static_cast(thing)); break; case JSTRACE_SHAPE: diff --git a/js/src/ion/Bailouts.cpp b/js/src/ion/Bailouts.cpp index 842e545350ce..c9af06e95229 100644 --- a/js/src/ion/Bailouts.cpp +++ b/js/src/ion/Bailouts.cpp @@ -62,7 +62,7 @@ IonBailoutIterator::dump() const } } -static RawScript +static JSScript * GetBailedJSScript(JSContext *cx) { // Just after the frame conversion, we can safely interpret the ionTop as JS @@ -530,7 +530,7 @@ uint32_t ion::BoundsCheckFailure() { JSContext *cx = GetIonContext()->cx; - RawScript script = GetBailedJSScript(cx); + JSScript *script = GetBailedJSScript(cx); IonSpew(IonSpew_Bailouts, "Bounds check failure %s:%d", script->filename(), script->lineno); @@ -551,7 +551,7 @@ uint32_t ion::ShapeGuardFailure() { JSContext *cx = GetIonContext()->cx; - RawScript script = GetBailedJSScript(cx); + JSScript *script = GetBailedJSScript(cx); JS_ASSERT(!script->ionScript()->invalidated()); @@ -566,7 +566,7 @@ uint32_t ion::CachedShapeGuardFailure() { JSContext *cx = GetIonContext()->cx; - RawScript script = GetBailedJSScript(cx); + JSScript *script = GetBailedJSScript(cx); JS_ASSERT(!script->ionScript()->invalidated()); diff --git a/js/src/ion/BaselineIC.cpp b/js/src/ion/BaselineIC.cpp index 2c96e4d3ad2b..6b4c27a7c807 100644 --- a/js/src/ion/BaselineIC.cpp +++ b/js/src/ion/BaselineIC.cpp @@ -781,7 +781,7 @@ PrepareOsrTempData(JSContext *cx, ICUseCount_Fallback *stub, BaselineFrame *fram *((JSFunction **) (stackFrame + StackFrame::offsetOfExec())) = frame->fun(); *((uint32_t *) (stackFrame + StackFrame::offsetOfFlags())) = StackFrame::FUNCTION; } else { - *((RawScript *) (stackFrame + StackFrame::offsetOfExec())) = frame->script(); + *((JSScript **) (stackFrame + StackFrame::offsetOfExec())) = frame->script(); *((uint32_t *) (stackFrame + StackFrame::offsetOfFlags())) = 0; } @@ -1659,7 +1659,7 @@ DoCompareFallback(JSContext *cx, BaselineFrame *frame, ICCompare_Fallback *stub, return true; } - RawScript script = frame->script(); + JSScript *script = frame->script(); // Try to generate new stubs. if (lhs.isInt32() && rhs.isInt32()) { @@ -2070,7 +2070,7 @@ DoToBoolFallback(JSContext *cx, BaselineFrame *frame, ICToBool_Fallback *stub, H JS_ASSERT(!arg.isBoolean()); - RawScript script = frame->script(); + JSScript *script = frame->script(); // Try to generate new stubs. if (arg.isInt32()) { diff --git a/js/src/ion/BaselineInspector.h b/js/src/ion/BaselineInspector.h index 9be277aa4301..70aa3edd81a2 100644 --- a/js/src/ion/BaselineInspector.h +++ b/js/src/ion/BaselineInspector.h @@ -49,7 +49,7 @@ class BaselineInspector ICEntry *prevLookedUpEntry; public: - BaselineInspector(JSContext *cx, RawScript rawScript) + BaselineInspector(JSContext *cx, JSScript *rawScript) : script(cx, rawScript), prevLookedUpEntry(NULL) { JS_ASSERT(script); diff --git a/js/src/ion/BaselineJIT.cpp b/js/src/ion/BaselineJIT.cpp index c808f3ab9774..b475cedc03e2 100644 --- a/js/src/ion/BaselineJIT.cpp +++ b/js/src/ion/BaselineJIT.cpp @@ -659,7 +659,7 @@ BaselineScript::pcForReturnAddress(JSScript *script, uint8_t *nativeAddress) } void -BaselineScript::toggleDebugTraps(RawScript script, jsbytecode *pc) +BaselineScript::toggleDebugTraps(JSScript *script, jsbytecode *pc) { JS_ASSERT(script->baselineScript() == this); @@ -779,7 +779,7 @@ BaselineScript::purgeOptimizedStubs(Zone *zone) } void -ion::FinishDiscardBaselineScript(FreeOp *fop, RawScript script) +ion::FinishDiscardBaselineScript(FreeOp *fop, JSScript *script) { if (!script->hasBaselineScript()) return; diff --git a/js/src/ion/BaselineJIT.h b/js/src/ion/BaselineJIT.h index 545cab7bf0d9..ad75a57ce8ec 100644 --- a/js/src/ion/BaselineJIT.h +++ b/js/src/ion/BaselineJIT.h @@ -243,7 +243,7 @@ struct BaselineScript // Toggle debug traps (used for breakpoints and step mode) in the script. // If |pc| is NULL, toggle traps for all ops in the script. Else, only // toggle traps at |pc|. - void toggleDebugTraps(RawScript script, jsbytecode *pc); + void toggleDebugTraps(JSScript *script, jsbytecode *pc); void toggleSPS(bool enable); @@ -268,7 +268,7 @@ IonExecStatus EnterBaselineAtBranch(JSContext *cx, StackFrame *fp, jsbytecode *pc); void -FinishDiscardBaselineScript(FreeOp *fop, RawScript script); +FinishDiscardBaselineScript(FreeOp *fop, JSScript *script); void SizeOfBaselineData(JSScript *script, JSMallocSizeOfFun mallocSizeOf, size_t *data, diff --git a/js/src/ion/CodeGenerator.cpp b/js/src/ion/CodeGenerator.cpp index 858ba4dd987c..57ab235373f2 100644 --- a/js/src/ion/CodeGenerator.cpp +++ b/js/src/ion/CodeGenerator.cpp @@ -1545,7 +1545,7 @@ CodeGenerator::visitCallKnown(LCallKnown *call) // If the function is known to be uncompilable, just emit the call to // Invoke in sequential mode, else mark as cannot compile. JS_ASSERT(call->mir()->hasRootedScript()); - RawScript targetScript = target->nonLazyScript(); + JSScript *targetScript = target->nonLazyScript(); if (GetIonScript(targetScript, executionMode) == ION_DISABLED_SCRIPT) { if (executionMode == ParallelExecution) return false; @@ -2220,7 +2220,7 @@ CodeGenerator::maybeCreateScriptCounts() IonScriptCounts *counts = NULL; CompileInfo *outerInfo = &gen->info(); - RawScript script = outerInfo->script(); + JSScript *script = outerInfo->script(); if (cx->runtime->profilingScripts) { if (script && !script->hasScriptCounts && !script->initScriptCounts(cx)) @@ -4929,7 +4929,7 @@ CodeGenerator::link() // We encode safepoints after the OSI-point offsets have been determined. encodeSafepoints(); - RawScript script = gen->info().script(); + JSScript *script = gen->info().script(); ExecutionMode executionMode = gen->info().executionMode(); JS_ASSERT(!HasIonScript(script, executionMode)); diff --git a/js/src/ion/CompileInfo.h b/js/src/ion/CompileInfo.h index 7504219b19bb..710ad1dc13fb 100644 --- a/js/src/ion/CompileInfo.h +++ b/js/src/ion/CompileInfo.h @@ -13,7 +13,7 @@ namespace js { namespace ion { inline unsigned -StartArgSlot(RawScript script, JSFunction *fun) +StartArgSlot(JSScript *script, JSFunction *fun) { // First slot is for scope chain. // Second one may be for arguments object. @@ -21,7 +21,7 @@ StartArgSlot(RawScript script, JSFunction *fun) } inline unsigned -CountArgSlots(RawScript script, JSFunction *fun) +CountArgSlots(JSScript *script, JSFunction *fun) { return StartArgSlot(script, fun) + (fun ? fun->nargs + 1 : 0); } @@ -39,7 +39,7 @@ enum ExecutionMode { class CompileInfo { public: - CompileInfo(RawScript script, JSFunction *fun, jsbytecode *osrPc, bool constructing, + CompileInfo(JSScript *script, JSFunction *fun, jsbytecode *osrPc, bool constructing, ExecutionMode executionMode) : script_(script), fun_(fun), osrPc_(osrPc), constructing_(constructing), executionMode_(executionMode) @@ -63,7 +63,7 @@ class CompileInfo nslots_ = nlocals_ + nstack_; } - RawScript script() const { + JSScript *script() const { return script_; } JSFunction *fun() const { diff --git a/js/src/ion/ExecutionModeInlines.h b/js/src/ion/ExecutionModeInlines.h index f13956a564b7..be37a412d099 100644 --- a/js/src/ion/ExecutionModeInlines.h +++ b/js/src/ion/ExecutionModeInlines.h @@ -11,7 +11,7 @@ namespace js { namespace ion { static inline bool -HasIonScript(RawScript script, ExecutionMode cmode) +HasIonScript(JSScript *script, ExecutionMode cmode) { switch (cmode) { case SequentialExecution: return script->hasIonScript(); @@ -22,7 +22,7 @@ HasIonScript(RawScript script, ExecutionMode cmode) } static inline IonScript * -GetIonScript(RawScript script, ExecutionMode cmode) +GetIonScript(JSScript *script, ExecutionMode cmode) { switch (cmode) { case SequentialExecution: return script->maybeIonScript(); @@ -33,7 +33,7 @@ GetIonScript(RawScript script, ExecutionMode cmode) } static inline void -SetIonScript(RawScript script, ExecutionMode cmode, IonScript *ionScript) +SetIonScript(JSScript *script, ExecutionMode cmode, IonScript *ionScript) { switch (cmode) { case SequentialExecution: script->setIonScript(ionScript); return; @@ -53,7 +53,7 @@ OffsetOfIonInJSScript(ExecutionMode cmode) } static inline bool -CanIonCompile(RawScript script, ExecutionMode cmode) +CanIonCompile(JSScript *script, ExecutionMode cmode) { switch (cmode) { case SequentialExecution: return script->canIonCompile(); @@ -70,7 +70,7 @@ CanIonCompile(JSFunction *fun, ExecutionMode cmode) } static inline bool -CompilingOffThread(RawScript script, ExecutionMode cmode) +CompilingOffThread(JSScript *script, ExecutionMode cmode) { switch (cmode) { case SequentialExecution: return script->isIonCompilingOffThread(); diff --git a/js/src/ion/Ion.cpp b/js/src/ion/Ion.cpp index 6d79bdeadb25..5cc48eb8064c 100644 --- a/js/src/ion/Ion.cpp +++ b/js/src/ion/Ion.cpp @@ -609,8 +609,8 @@ IonScript::New(JSContext *cx, uint32_t frameSlots, uint32_t frameSize, size_t sn size_t paddedCacheEntriesSize = AlignBytes(cacheEntries * sizeof(uint32_t), DataAlignment); size_t paddedRuntimeSize = AlignBytes(runtimeSize, DataAlignment); size_t paddedSafepointSize = AlignBytes(safepointsSize, DataAlignment); - size_t paddedScriptSize = AlignBytes(scriptEntries * sizeof(RawScript), DataAlignment); - size_t paddedCallTargetSize = AlignBytes(callTargetEntries * sizeof(RawScript), DataAlignment); + size_t paddedScriptSize = AlignBytes(scriptEntries * sizeof(JSScript *), DataAlignment); + size_t paddedCallTargetSize = AlignBytes(callTargetEntries * sizeof(JSScript *), DataAlignment); size_t bytes = paddedSnapshotsSize + paddedBailoutSize + paddedConstantsSize + @@ -904,7 +904,7 @@ ion::ToggleBarriers(JS::Zone *zone, bool needs) AutoFlushCache afc("ToggleBarriers", zone->rt->ionRuntime()); for (gc::CellIterUnderGC i(zone, gc::FINALIZE_SCRIPT); !i.done(); i.next()) { - RawScript script = i.get(); + JSScript *script = i.get(); if (script->hasIonScript()) script->ionScript()->toggleBarriers(needs); if (script->hasBaselineScript()) @@ -1241,7 +1241,7 @@ public: return SequentialExecution; } - MethodStatus checkScriptSize(JSContext *cx, RawScript script); + MethodStatus checkScriptSize(JSContext *cx, JSScript *script); AbortReason compile(IonBuilder *builder, MIRGraph *graph, ScopedJSDeletePtr &autoDelete); }; @@ -1473,7 +1473,7 @@ CheckFrame(AbstractFramePtr fp) } static bool -CheckScript(RawScript script, bool osr) +CheckScript(JSScript *script, bool osr) { if (osr && script->needsArgsObj()) { // OSR-ing into functions with arguments objects is not supported. @@ -1490,7 +1490,7 @@ CheckScript(RawScript script, bool osr) } MethodStatus -SequentialCompileContext::checkScriptSize(JSContext *cx, RawScript script) +SequentialCompileContext::checkScriptSize(JSContext *cx, JSScript *script) { if (!js_IonOptions.limitScriptSize) return Method_Compiled; @@ -1742,7 +1742,7 @@ ion::CompileFunctionForBaseline(JSContext *cx, HandleScript script, AbstractFram } MethodStatus -ParallelCompileContext::checkScriptSize(JSContext *cx, RawScript script) +ParallelCompileContext::checkScriptSize(JSContext *cx, JSScript *script) { if (!js_IonOptions.limitScriptSize) return Method_Compiled; @@ -2155,7 +2155,7 @@ InvalidateActivation(FreeOp *fop, uint8_t *ionTop, bool invalidateAll) 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, - it.maybeCallee(), (RawScript)it.script(), it.returnAddressToFp()); + it.maybeCallee(), (JSScript *)it.script(), it.returnAddressToFp()); break; } case IonFrame_BaselineStub: @@ -2187,7 +2187,7 @@ InvalidateActivation(FreeOp *fop, uint8_t *ionTop, bool invalidateAll) if (it.checkInvalidation()) continue; - RawScript script = it.script(); + JSScript *script = it.script(); if (!script->hasIonScript()) continue; @@ -2333,7 +2333,7 @@ ion::Invalidate(types::TypeCompartment &types, FreeOp *fop, break; } JS_ASSERT(co.isValid()); - RawScript script = co.script; + JSScript *script = co.script; IonScript *ionScript = GetIonScript(script, executionMode); Zone *zone = script->zone(); @@ -2372,7 +2372,7 @@ ion::Invalidate(JSContext *cx, const Vector &invalid, bool } bool -ion::Invalidate(JSContext *cx, RawScript script, ExecutionMode mode, bool resetUses) +ion::Invalidate(JSContext *cx, JSScript *script, ExecutionMode mode, bool resetUses) { JS_ASSERT(script->hasIonScript()); @@ -2396,13 +2396,13 @@ ion::Invalidate(JSContext *cx, RawScript script, ExecutionMode mode, bool resetU } bool -ion::Invalidate(JSContext *cx, RawScript script, bool resetUses) +ion::Invalidate(JSContext *cx, JSScript *script, bool resetUses) { return Invalidate(cx, script, SequentialExecution, resetUses); } static void -FinishInvalidationOf(FreeOp *fop, RawScript script, IonScript *ionScript, bool parallel) +FinishInvalidationOf(FreeOp *fop, JSScript *script, IonScript *ionScript, bool parallel) { // If this script has Ion code on the stack, invalidation() will return // true. In this case we have to wait until destroying it. @@ -2422,7 +2422,7 @@ FinishInvalidationOf(FreeOp *fop, RawScript script, IonScript *ionScript, bool p } void -ion::FinishInvalidation(FreeOp *fop, RawScript script) +ion::FinishInvalidation(FreeOp *fop, JSScript *script) { if (script->hasIonScript()) FinishInvalidationOf(fop, script, script->ionScript(), false); @@ -2444,13 +2444,13 @@ ion::MarkShapeFromIon(JSRuntime *rt, Shape **shapep) } void -ion::ForbidCompilation(JSContext *cx, RawScript script) +ion::ForbidCompilation(JSContext *cx, JSScript *script) { ForbidCompilation(cx, script, SequentialExecution); } void -ion::ForbidCompilation(JSContext *cx, RawScript script, ExecutionMode mode) +ion::ForbidCompilation(JSContext *cx, JSScript *script, ExecutionMode mode) { IonSpew(IonSpew_Abort, "Disabling Ion mode %d compilation of script %s:%d", mode, script->filename(), script->lineno); @@ -2486,7 +2486,7 @@ ion::ForbidCompilation(JSContext *cx, RawScript script, ExecutionMode mode) } uint32_t -ion::UsesBeforeIonRecompile(RawScript script, jsbytecode *pc) +ion::UsesBeforeIonRecompile(JSScript *script, jsbytecode *pc) { JS_ASSERT(pc == script->code || JSOp(*pc) == JSOP_LOOPENTRY); @@ -2564,7 +2564,7 @@ AutoFlushInhibitor::~AutoFlushInhibitor() int js::ion::LabelBase::id_count = 0; void -ion::PurgeCaches(RawScript script, Zone *zone) +ion::PurgeCaches(JSScript *script, Zone *zone) { if (script->hasIonScript()) script->ionScript()->purgeCaches(zone); @@ -2574,7 +2574,7 @@ ion::PurgeCaches(RawScript script, Zone *zone) } size_t -ion::SizeOfIonData(RawScript script, JSMallocSizeOfFun mallocSizeOf) +ion::SizeOfIonData(JSScript *script, JSMallocSizeOfFun mallocSizeOf) { size_t result = 0; @@ -2588,7 +2588,7 @@ ion::SizeOfIonData(RawScript script, JSMallocSizeOfFun mallocSizeOf) } void -ion::DestroyIonScripts(FreeOp *fop, RawScript script) +ion::DestroyIonScripts(FreeOp *fop, JSScript *script) { if (script->hasIonScript()) ion::IonScript::Destroy(fop, script->ionScript()); @@ -2601,7 +2601,7 @@ ion::DestroyIonScripts(FreeOp *fop, RawScript script) } void -ion::TraceIonScripts(JSTracer* trc, RawScript script) +ion::TraceIonScripts(JSTracer* trc, JSScript *script) { if (script->hasIonScript()) ion::IonScript::Trace(trc, script->ionScript()); diff --git a/js/src/ion/Ion.h b/js/src/ion/Ion.h index 8c305a687d68..d6dd256a4473 100644 --- a/js/src/ion/Ion.h +++ b/js/src/ion/Ion.h @@ -318,8 +318,8 @@ IonExecStatus FastInvoke(JSContext *cx, HandleFunction fun, CallArgsList &args); void Invalidate(types::TypeCompartment &types, FreeOp *fop, const Vector &invalid, bool resetUses = true); void Invalidate(JSContext *cx, const Vector &invalid, bool resetUses = true); -bool Invalidate(JSContext *cx, RawScript script, ExecutionMode mode, bool resetUses = true); -bool Invalidate(JSContext *cx, RawScript script, bool resetUses = true); +bool Invalidate(JSContext *cx, JSScript *script, ExecutionMode mode, bool resetUses = true); +bool Invalidate(JSContext *cx, JSScript *script, bool resetUses = true); void MarkValueFromIon(JSRuntime *rt, Value *vp); void MarkShapeFromIon(JSRuntime *rt, Shape **shapep); @@ -344,14 +344,14 @@ static inline bool IsEnabled(JSContext *cx) return cx->hasOption(JSOPTION_ION) && cx->typeInferenceEnabled(); } -void ForbidCompilation(JSContext *cx, RawScript script); -void ForbidCompilation(JSContext *cx, RawScript script, ExecutionMode mode); -uint32_t UsesBeforeIonRecompile(RawScript script, jsbytecode *pc); +void ForbidCompilation(JSContext *cx, JSScript *script); +void ForbidCompilation(JSContext *cx, JSScript *script, ExecutionMode mode); +uint32_t UsesBeforeIonRecompile(JSScript *script, jsbytecode *pc); -void PurgeCaches(RawScript script, JS::Zone *zone); -size_t SizeOfIonData(RawScript script, JSMallocSizeOfFun mallocSizeOf); -void DestroyIonScripts(FreeOp *fop, RawScript script); -void TraceIonScripts(JSTracer* trc, RawScript script); +void PurgeCaches(JSScript *script, JS::Zone *zone); +size_t SizeOfIonData(JSScript *script, JSMallocSizeOfFun mallocSizeOf); +void DestroyIonScripts(FreeOp *fop, JSScript *script); +void TraceIonScripts(JSTracer* trc, JSScript *script); } // namespace ion } // namespace js diff --git a/js/src/ion/IonCaches.cpp b/js/src/ion/IonCaches.cpp index b8832b782aba..0bae9eeebdcb 100644 --- a/js/src/ion/IonCaches.cpp +++ b/js/src/ion/IonCaches.cpp @@ -2225,7 +2225,7 @@ GenerateScopeChainGuard(MacroAssembler &masm, JSObject *scopeObj, CallObject *callObj = &scopeObj->asCall(); if (!callObj->isForEval()) { JSFunction *fun = &callObj->callee(); - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); if (!script->funHasExtensibleScope) return; } diff --git a/js/src/ion/IonCaches.h b/js/src/ion/IonCaches.h index 1efb2604d984..0e8118977b3b 100644 --- a/js/src/ion/IonCaches.h +++ b/js/src/ion/IonCaches.h @@ -251,7 +251,7 @@ class IonCache idempotent_ = true; } - void setScriptedLocation(RawScript script, jsbytecode *pc) { + void setScriptedLocation(JSScript *script, jsbytecode *pc) { JS_ASSERT(!idempotent_); this->script = script; this->pc = pc; diff --git a/js/src/ion/IonCode.h b/js/src/ion/IonCode.h index df32ae4c6b0b..b9ec7b1cb299 100644 --- a/js/src/ion/IonCode.h +++ b/js/src/ion/IonCode.h @@ -381,7 +381,7 @@ struct IonScript size_t safepointsSize() const { return safepointsSize_; } - RawScript getScript(size_t i) const { + JSScript *getScript(size_t i) const { JS_ASSERT(i < scriptEntries_); return scriptList()[i]; } diff --git a/js/src/ion/IonCompartment.h b/js/src/ion/IonCompartment.h index 16ebaaf122f0..b50573bb48a0 100644 --- a/js/src/ion/IonCompartment.h +++ b/js/src/ion/IonCompartment.h @@ -389,7 +389,7 @@ class IonActivation // Called from JSCompartment::discardJitCode(). void InvalidateAll(FreeOp *fop, JS::Zone *zone); -void FinishInvalidation(FreeOp *fop, RawScript script); +void FinishInvalidation(FreeOp *fop, JSScript *script); } // namespace ion } // namespace js diff --git a/js/src/ion/IonFrameIterator-inl.h b/js/src/ion/IonFrameIterator-inl.h index 73bc2604eff2..ec0d35a16d1c 100644 --- a/js/src/ion/IonFrameIterator-inl.h +++ b/js/src/ion/IonFrameIterator-inl.h @@ -19,7 +19,7 @@ template inline void SnapshotIterator::readFrameArgs(Op &op, const Value *argv, Value *scopeChain, Value *thisv, unsigned start, unsigned formalEnd, unsigned iterEnd, - RawScript script) + JSScript *script) { if (scopeChain) *scopeChain = read(); diff --git a/js/src/ion/IonFrameIterator.h b/js/src/ion/IonFrameIterator.h index 42c6cda6fc80..c9372acdcaed 100644 --- a/js/src/ion/IonFrameIterator.h +++ b/js/src/ion/IonFrameIterator.h @@ -153,7 +153,7 @@ class IonFrameIterator JSFunction *callee() const; JSFunction *maybeCallee() const; unsigned numActualArgs() const; - RawScript script() const; + JSScript *script() const; void baselineScriptAndPc(JSScript **scriptRes, jsbytecode **pcRes) const; Value *nativeVp() const; Value *actualArgs() const; @@ -270,7 +270,7 @@ class SnapshotIterator : public SnapshotReader template inline void readFrameArgs(Op &op, const Value *argv, Value *scopeChain, Value *thisv, unsigned start, unsigned formalEnd, unsigned iterEnd, - RawScript script); + JSScript *script); Value maybeReadSlotByIndex(size_t index) { while (index--) { @@ -324,7 +324,7 @@ class InlineFrameIteratorMaybeGC template inline void forEachCanonicalActualArg(JSContext *cx, Op op, unsigned start, unsigned count) const; - RawScript script() const { + JSScript *script() const { return script_; } jsbytecode *pc() const { diff --git a/js/src/ion/IonFrames-inl.h b/js/src/ion/IonFrames-inl.h index a1fa889785c8..7baa1d536ede 100644 --- a/js/src/ion/IonFrames-inl.h +++ b/js/src/ion/IonFrames-inl.h @@ -101,7 +101,7 @@ IonFrameIterator::frameSize() const } // Returns the JSScript associated with the topmost Ion frame. -inline RawScript +inline JSScript * GetTopIonJSScript(PerThreadData *pt, const SafepointIndex **safepointIndexOut, void **returnAddrOut) { IonFrameIterator iter(pt->ionTop); @@ -126,7 +126,7 @@ GetTopIonJSScript(PerThreadData *pt, const SafepointIndex **safepointIndexOut, v } -inline RawScript +inline JSScript * GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut, void **returnAddrOut) { return GetTopIonJSScript(&cx->mainThread(), safepointIndexOut, returnAddrOut); diff --git a/js/src/ion/IonFrames.cpp b/js/src/ion/IonFrames.cpp index efa67b9d884c..f501954f9c06 100644 --- a/js/src/ion/IonFrames.cpp +++ b/js/src/ion/IonFrames.cpp @@ -59,7 +59,7 @@ bool IonFrameIterator::checkInvalidation(IonScript **ionScriptOut) const { uint8_t *returnAddr = returnAddressToFp(); - RawScript script = this->script(); + JSScript *script = this->script(); // N.B. the current IonScript is not the same as the frame's // IonScript if the frame has since been invalidated. bool invalidated; @@ -174,13 +174,13 @@ IonFrameIterator::isEntryJSFrame() const return true; } -RawScript +JSScript * IonFrameIterator::script() const { JS_ASSERT(isScripted()); if (isBaselineJS()) return baselineFrame()->script(); - RawScript script = ScriptFromCalleeToken(calleeToken()); + JSScript *script = ScriptFromCalleeToken(calleeToken()); JS_ASSERT(script); return script; } @@ -189,7 +189,7 @@ void IonFrameIterator::baselineScriptAndPc(JSScript **scriptRes, jsbytecode **pcRes) const { JS_ASSERT(isBaselineJS()); - RawScript script = this->script(); + JSScript *script = this->script(); if (scriptRes) *scriptRes = script; uint8_t *retAddr = returnAddressToFp(); @@ -474,7 +474,7 @@ HandleException(ResumeFromException *rfe) // When profiling, each frame popped needs a notification that // the function has exited, so invoke the probe that a function // is exiting. - RawScript script = frames.script(); + JSScript *script = frames.script(); Probes::exitScript(cx, script, script->function(), NULL); if (!frames.more()) break; @@ -494,7 +494,7 @@ HandleException(ResumeFromException *rfe) return; // Unwind profiler pseudo-stack - RawScript script = iter.script(); + JSScript *script = iter.script(); Probes::exitScript(cx, script, script->function(), NULL); if (cx->compartment->debugMode() && !calledDebugEpilogue) { @@ -633,7 +633,7 @@ MarkCalleeToken(JSTracer *trc, CalleeToken token) } case CalleeToken_Script: { - RawScript script = CalleeTokenToScript(token); + JSScript *script = CalleeTokenToScript(token); MarkScriptRoot(trc, &script, "ion-entry"); JS_ASSERT(script == CalleeTokenToScript(token)); break; diff --git a/js/src/ion/IonFrames.h b/js/src/ion/IonFrames.h index 9978c1d9f4a7..dc6da3678cf4 100644 --- a/js/src/ion/IonFrames.h +++ b/js/src/ion/IonFrames.h @@ -49,7 +49,7 @@ CalleeToParallelToken(JSFunction *fun) return CalleeToken(uintptr_t(fun) | uintptr_t(CalleeToken_ParallelFunction)); } static inline CalleeToken -CalleeToToken(RawScript script) +CalleeToToken(JSScript *script) { return CalleeToken(uintptr_t(script) | uintptr_t(CalleeToken_Script)); } @@ -70,14 +70,14 @@ CalleeTokenToParallelFunction(CalleeToken token) JS_ASSERT(GetCalleeTokenTag(token) == CalleeToken_ParallelFunction); return (JSFunction *)(uintptr_t(token) & ~uintptr_t(0x3)); } -static inline RawScript +static inline JSScript * CalleeTokenToScript(CalleeToken token) { JS_ASSERT(GetCalleeTokenTag(token) == CalleeToken_Script); - return (RawScript)(uintptr_t(token) & ~uintptr_t(0x3)); + return (JSScript *)(uintptr_t(token) & ~uintptr_t(0x3)); } -static inline RawScript +static inline JSScript * ScriptFromCalleeToken(CalleeToken token) { switch (GetCalleeTokenTag(token)) { @@ -293,7 +293,7 @@ MakeFrameDescriptor(uint32_t frameSize, FrameType type) namespace js { namespace ion { -RawScript +JSScript * GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut = NULL, void **returnAddrOut = NULL); diff --git a/js/src/ion/IonMacroAssembler.h b/js/src/ion/IonMacroAssembler.h index 596f1c0947a5..2c5dae6710b4 100644 --- a/js/src/ion/IonMacroAssembler.h +++ b/js/src/ion/IonMacroAssembler.h @@ -763,7 +763,7 @@ class MacroAssembler : public MacroAssemblerSpecific bind(&stackFull); } - void spsPushFrame(SPSProfiler *p, const char *str, RawScript s, Register temp) { + void spsPushFrame(SPSProfiler *p, const char *str, JSScript *s, Register temp) { Label stackFull; spsProfileEntryAddress(p, 0, temp, &stackFull); diff --git a/js/src/ion/JSONSpewer.cpp b/js/src/ion/JSONSpewer.cpp index bc8689e58914..b84453145991 100644 --- a/js/src/ion/JSONSpewer.cpp +++ b/js/src/ion/JSONSpewer.cpp @@ -176,7 +176,7 @@ JSONSpewer::init(const char *path) } void -JSONSpewer::beginFunction(RawScript script) +JSONSpewer::beginFunction(JSScript *script) { if (inFunction_) endFunction(); diff --git a/js/src/ion/JSONSpewer.h b/js/src/ion/JSONSpewer.h index 556faa9081bb..c4fb5f4d00c3 100644 --- a/js/src/ion/JSONSpewer.h +++ b/js/src/ion/JSONSpewer.h @@ -60,7 +60,7 @@ class JSONSpewer ~JSONSpewer(); bool init(const char *path); - void beginFunction(RawScript script); + void beginFunction(JSScript *script); void beginPass(const char * pass); void spewMDef(MDefinition *def); void spewMResumePoint(MResumePoint *rp); diff --git a/js/src/ion/LIR-Common.h b/js/src/ion/LIR-Common.h index d38dbe888998..de91e5b4e024 100644 --- a/js/src/ion/LIR-Common.h +++ b/js/src/ion/LIR-Common.h @@ -4354,7 +4354,7 @@ class LFunctionBoundary : public LInstructionHelper<0, 0, 1> return getTemp(0); } - RawScript script() { + JSScript *script() { return mir_->toFunctionBoundary()->script(); } diff --git a/js/src/ion/MIR.cpp b/js/src/ion/MIR.cpp index bea4b229f850..906422906a18 100644 --- a/js/src/ion/MIR.cpp +++ b/js/src/ion/MIR.cpp @@ -395,7 +395,7 @@ MConstant::printOpcode(FILE *fp) fputs("unnamed function", fp); } if (fun->hasScript()) { - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); fprintf(fp, " (%s:%u)", script->filename() ? script->filename() : "", script->lineno); } diff --git a/js/src/ion/MIR.h b/js/src/ion/MIR.h index 181859ab25f0..3ca7d778c15c 100644 --- a/js/src/ion/MIR.h +++ b/js/src/ion/MIR.h @@ -5849,7 +5849,7 @@ class MBindNameCache CompilerRootScript script_; jsbytecode *pc_; - MBindNameCache(MDefinition *scopeChain, PropertyName *name, RawScript script, jsbytecode *pc) + MBindNameCache(MDefinition *scopeChain, PropertyName *name, JSScript *script, jsbytecode *pc) : MUnaryInstruction(scopeChain), name_(name), script_(script), pc_(pc) { setResultType(MIRType_Object); @@ -5858,7 +5858,7 @@ class MBindNameCache public: INSTRUCTION_HEADER(BindNameCache) - static MBindNameCache *New(MDefinition *scopeChain, PropertyName *name, RawScript script, + static MBindNameCache *New(MDefinition *scopeChain, PropertyName *name, JSScript *script, jsbytecode *pc) { return new MBindNameCache(scopeChain, name, script, pc); } @@ -5872,7 +5872,7 @@ class MBindNameCache PropertyName *name() const { return name_; } - RawScript script() const { + JSScript *script() const { return script_; } jsbytecode *pc() const { @@ -7334,7 +7334,7 @@ class MFunctionBoundary : public MNullaryInstruction Type type_; unsigned inlineLevel_; - MFunctionBoundary(RawScript script, Type type, unsigned inlineLevel) + MFunctionBoundary(JSScript *script, Type type, unsigned inlineLevel) : script_(script), type_(type), inlineLevel_(inlineLevel) { JS_ASSERT_IF(type != Inline_Exit, script != NULL); @@ -7345,12 +7345,12 @@ class MFunctionBoundary : public MNullaryInstruction public: INSTRUCTION_HEADER(FunctionBoundary) - static MFunctionBoundary *New(RawScript script, Type type, + static MFunctionBoundary *New(JSScript *script, Type type, unsigned inlineLevel = 0) { return new MFunctionBoundary(script, type, inlineLevel); } - RawScript script() { + JSScript *script() { return script_; } diff --git a/js/src/ion/MIRGraph.h b/js/src/ion/MIRGraph.h index 070588f6b3e2..b8de884ea2dd 100644 --- a/js/src/ion/MIRGraph.h +++ b/js/src/ion/MIRGraph.h @@ -510,11 +510,11 @@ class MIRGraph MStart *osrStart_; // List of compiled/inlined scripts. - Vector scripts_; + Vector scripts_; // List of possible scripts that this graph may call. Currently this is // only tracked when compiling for parallel execution. - Vector callTargets_; + Vector callTargets_; size_t numBlocks_; @@ -634,7 +634,7 @@ class MIRGraph MStart *osrStart() { return osrStart_; } - bool addScript(RawScript script) { + bool addScript(JSScript *script) { // The same script may be inlined multiple times, add it only once. for (size_t i = 0; i < scripts_.length(); i++) { if (scripts_[i] == script) @@ -648,7 +648,7 @@ class MIRGraph JSScript **scripts() { return scripts_.begin(); } - bool addCallTarget(RawScript script) { + bool addCallTarget(JSScript *script) { for (size_t i = 0; i < callTargets_.length(); i++) { if (callTargets_[i] == script) return true; diff --git a/js/src/ion/ParallelArrayAnalysis.h b/js/src/ion/ParallelArrayAnalysis.h index 2c2eba228b37..3fb0c45ef6e0 100644 --- a/js/src/ion/ParallelArrayAnalysis.h +++ b/js/src/ion/ParallelArrayAnalysis.h @@ -47,7 +47,7 @@ class ParallelCompileContext } // Defined in Ion.cpp, so that they can make use of static fns defined there - MethodStatus checkScriptSize(JSContext *cx, RawScript script); + MethodStatus checkScriptSize(JSContext *cx, JSScript *script); MethodStatus compileTransitively(); AbortReason compile(IonBuilder *builder, MIRGraph *graph, ScopedJSDeletePtr &autoDelete); diff --git a/js/src/ion/PcScriptCache.h b/js/src/ion/PcScriptCache.h index 9f9a3d79c87c..092e96c37750 100644 --- a/js/src/ion/PcScriptCache.h +++ b/js/src/ion/PcScriptCache.h @@ -19,7 +19,7 @@ struct PcScriptCacheEntry { uint8_t *returnAddress; // Key into the hash table. jsbytecode *pc; // Cached PC. - RawScript script; // Cached script. + JSScript *script; // Cached script. }; struct PcScriptCache @@ -45,7 +45,7 @@ struct PcScriptCache bool get(JSRuntime *rt, uint32_t hash, uint8_t *addr, JSScript **scriptRes, jsbytecode **pcRes); - void add(uint32_t hash, uint8_t *addr, jsbytecode *pc, RawScript script) { + void add(uint32_t hash, uint8_t *addr, jsbytecode *pc, JSScript *script) { entries[hash].returnAddress = addr; entries[hash].pc = pc; entries[hash].script = script; diff --git a/js/src/ion/SnapshotWriter.h b/js/src/ion/SnapshotWriter.h index 9c90e6a7a757..3c2394c9a47c 100644 --- a/js/src/ion/SnapshotWriter.h +++ b/js/src/ion/SnapshotWriter.h @@ -33,7 +33,7 @@ class SnapshotWriter public: SnapshotOffset startSnapshot(uint32_t frameCount, BailoutKind kind, bool resumeAfter); - void startFrame(JSFunction *fun, RawScript script, jsbytecode *pc, uint32_t exprStack); + void startFrame(JSFunction *fun, JSScript *script, jsbytecode *pc, uint32_t exprStack); #ifdef TRACK_SNAPSHOTS void trackFrame(uint32_t pcOpcode, uint32_t mirOpcode, uint32_t mirId, uint32_t lirOpcode, uint32_t lirId); diff --git a/js/src/ion/Snapshots.cpp b/js/src/ion/Snapshots.cpp index 074669bb5774..d46a0c2333b4 100644 --- a/js/src/ion/Snapshots.cpp +++ b/js/src/ion/Snapshots.cpp @@ -30,7 +30,7 @@ using namespace js::ion; // Snapshot body, repeated "frame count" times, from oldest frame to newest frame. // Note that the first frame doesn't have the "parent PC" field. // -// [ptr] Debug only: RawScript +// [ptr] Debug only: JSScript * // [vwu] pc offset // [vwu] # of slots, including nargs // [slot*] N slot entries, where N = nargs + nfixed + stackDepth @@ -296,7 +296,7 @@ SnapshotWriter::startSnapshot(uint32_t frameCount, BailoutKind kind, bool resume } void -SnapshotWriter::startFrame(JSFunction *fun, RawScript script, jsbytecode *pc, uint32_t exprStack) +SnapshotWriter::startFrame(JSFunction *fun, JSScript *script, jsbytecode *pc, uint32_t exprStack) { JS_ASSERT(CountArgSlots(script, fun) < SNAPSHOT_MAX_NARGS); diff --git a/js/src/ion/VMFunctions.h b/js/src/ion/VMFunctions.h index 13be91aea586..7b4302a25f19 100644 --- a/js/src/ion/VMFunctions.h +++ b/js/src/ion/VMFunctions.h @@ -254,7 +254,7 @@ template <> struct TypeToArgProperties > { static const uint32_t result = TypeToArgProperties::result | VMFunction::ByRef; }; template <> struct TypeToArgProperties { - static const uint32_t result = TypeToArgProperties::result | VMFunction::ByRef; + static const uint32_t result = TypeToArgProperties::result | VMFunction::ByRef; }; template <> struct TypeToArgProperties { static const uint32_t result = TypeToArgProperties::result | VMFunction::ByRef; diff --git a/js/src/ion/shared/CodeGenerator-shared.h b/js/src/ion/shared/CodeGenerator-shared.h index a99934e46968..882c6a5dcc76 100644 --- a/js/src/ion/shared/CodeGenerator-shared.h +++ b/js/src/ion/shared/CodeGenerator-shared.h @@ -374,14 +374,14 @@ class OutOfLineCode : public TempObject uint32_t framePushed() const { return framePushed_; } - void setSource(RawScript script, jsbytecode *pc) { + void setSource(JSScript *script, jsbytecode *pc) { script_ = script; pc_ = pc; } jsbytecode *pc() { return pc_; } - RawScript script() { + JSScript *script() { return script_; } }; diff --git a/js/src/jsanalyze.cpp b/js/src/jsanalyze.cpp index 4c1e2e1f2c23..e1955baaf50e 100644 --- a/js/src/jsanalyze.cpp +++ b/js/src/jsanalyze.cpp @@ -1958,7 +1958,7 @@ CrossScriptSSA::foldValue(const CrossSSAValue &cv) const Frame &frame = getFrame(cv.frame); const SSAValue &v = cv.v; - RawScript parentScript = NULL; + JSScript *parentScript = NULL; ScriptAnalysis *parentAnalysis = NULL; if (frame.parent != INVALID_FRAME) { parentScript = getFrame(frame.parent).script; @@ -1991,7 +1991,7 @@ CrossScriptSSA::foldValue(const CrossSSAValue &cv) * If there is a single inline callee with a single return site, * propagate back to that. */ - RawScript callee = NULL; + JSScript *callee = NULL; uint32_t calleeFrame = INVALID_FRAME; for (unsigned i = 0; i < numFrames(); i++) { if (iterFrame(i).parent == cv.frame && iterFrame(i).parentpc == pc) { diff --git a/js/src/jsanalyze.h b/js/src/jsanalyze.h index e1b60575aaed..41d4ca66f6d5 100644 --- a/js/src/jsanalyze.h +++ b/js/src/jsanalyze.h @@ -172,7 +172,7 @@ class Bytecode }; static inline unsigned -GetDefCount(RawScript script, unsigned offset) +GetDefCount(JSScript *script, unsigned offset) { JS_ASSERT(offset < script->length); jsbytecode *pc = script->code + offset; @@ -199,7 +199,7 @@ GetDefCount(RawScript script, unsigned offset) } static inline unsigned -GetUseCount(RawScript script, unsigned offset) +GetUseCount(JSScript *script, unsigned offset) { JS_ASSERT(offset < script->length); jsbytecode *pc = script->code + offset; @@ -326,7 +326,7 @@ NegateCompareOp(JSOp op) } static inline unsigned -FollowBranch(JSContext *cx, RawScript script, unsigned offset) +FollowBranch(JSContext *cx, JSScript *script, unsigned offset) { /* * Get the target offset of a branch. For GOTO opcodes implementing @@ -354,18 +354,18 @@ static inline uint32_t ThisSlot() { static inline uint32_t ArgSlot(uint32_t arg) { return 2 + arg; } -static inline uint32_t LocalSlot(RawScript script, uint32_t local) { +static inline uint32_t LocalSlot(JSScript *script, uint32_t local) { return 2 + (script->function() ? script->function()->nargs : 0) + local; } -static inline uint32_t TotalSlots(RawScript script) { +static inline uint32_t TotalSlots(JSScript *script) { return LocalSlot(script, 0) + script->nfixed; } -static inline uint32_t StackSlot(RawScript script, uint32_t index) { +static inline uint32_t StackSlot(JSScript *script, uint32_t index) { return TotalSlots(script) + index; } -static inline uint32_t GetBytecodeSlot(RawScript script, jsbytecode *pc) +static inline uint32_t GetBytecodeSlot(JSScript *script, jsbytecode *pc) { switch (JSOp(*pc)) { @@ -541,7 +541,7 @@ struct LifetimeVariable } /* Return true if the variable cannot decrease during the body of a loop. */ - bool nonDecreasing(RawScript script, LoopAnalysis *loop) const { + bool nonDecreasing(JSScript *script, LoopAnalysis *loop) const { Lifetime *segment = lifetime ? lifetime : saved; while (segment && segment->start <= loop->backedge) { if (segment->start >= loop->head && segment->write) { @@ -858,7 +858,7 @@ class ScriptAnalysis public: - ScriptAnalysis(RawScript script) { + ScriptAnalysis(JSScript *script) { mozilla::PodZero(this); this->script_ = script; #ifdef DEBUG @@ -1231,7 +1231,7 @@ class CrossScriptSSA uint32_t parent; jsbytecode *parentpc; - Frame(uint32_t index, RawScript script, uint32_t depth, uint32_t parent, + Frame(uint32_t index, JSScript *script, uint32_t depth, uint32_t parent, jsbytecode *parentpc) : index(index), script(script), depth(depth), parent(parent), parentpc(parentpc) {} @@ -1250,7 +1250,7 @@ class CrossScriptSSA return inlineFrames[i - 1]; } - RawScript outerScript() { return outerFrame.script; } + JSScript *outerScript() { return outerFrame.script; } /* Total length of scripts preceding a frame. */ size_t frameLength(uint32_t index) { @@ -1266,14 +1266,14 @@ class CrossScriptSSA return getFrame(cv.frame).script->analysis()->getValueTypes(cv.v); } - bool addInlineFrame(RawScript script, uint32_t depth, uint32_t parent, + bool addInlineFrame(JSScript *script, uint32_t depth, uint32_t parent, jsbytecode *parentpc) { uint32_t index = inlineFrames.length(); return inlineFrames.append(Frame(index, script, depth, parent, parentpc)); } - CrossScriptSSA(JSContext *cx, RawScript outer) + CrossScriptSSA(JSContext *cx, JSScript *outer) : outerFrame(OUTER_FRAME, outer, 0, INVALID_FRAME, NULL), inlineFrames(cx) {} diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 750b9163f2dc..7e4ca867bd96 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -7198,7 +7198,7 @@ JS::AssertArgumentsAreSane(JSContext *cx, const JS::Value &value) #endif /* DEBUG */ JS_PUBLIC_API(void *) -JS_EncodeScript(JSContext *cx, RawScript scriptArg, uint32_t *lengthp) +JS_EncodeScript(JSContext *cx, JSScript *scriptArg, uint32_t *lengthp) { XDREncoder encoder(cx); RootedScript script(cx, scriptArg); diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp index fe09174dab9e..70ce3ba91b87 100644 --- a/js/src/jsarray.cpp +++ b/js/src/jsarray.cpp @@ -1552,7 +1552,7 @@ MatchNumericComparator(const Value &v) if (!fun->hasScript()) return Match_None; - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); jsbytecode *pc = script->code; uint16_t arg0, arg1; diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp index e190820744b9..39759c8f400c 100644 --- a/js/src/jscntxt.cpp +++ b/js/src/jscntxt.cpp @@ -565,7 +565,7 @@ checkReportFlags(JSContext *cx, unsigned *flags) * We assume that if the top frame is a native, then it is strict if * the nearest scripted frame is strict, see bug 536306. */ - RawScript script = cx->stack.currentScript(); + JSScript *script = cx->stack.currentScript(); if (script && script->strict) *flags &= ~JSREPORT_WARNING; else if (cx->hasStrictOption()) diff --git a/js/src/jsdbgapi.cpp b/js/src/jsdbgapi.cpp index 857642c857c8..a0d23902170d 100644 --- a/js/src/jsdbgapi.cpp +++ b/js/src/jsdbgapi.cpp @@ -383,7 +383,7 @@ JS_ClearAllWatchPoints(JSContext *cx) /************************************************************************/ JS_PUBLIC_API(unsigned) -JS_PCToLineNumber(JSContext *cx, RawScript script, jsbytecode *pc) +JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc) { return js::PCToLineNumber(script, pc); } @@ -517,7 +517,7 @@ JS_GetFunctionScript(JSContext *cx, JSFunction *fun) if (fun->isInterpretedLazy()) { RootedFunction rootedFun(cx, fun); AutoCompartment funCompartment(cx, rootedFun); - RawScript script = rootedFun->getOrCreateScript(cx); + JSScript *script = rootedFun->getOrCreateScript(cx); if (!script) MOZ_CRASH(); return script; diff --git a/js/src/jsdbgapi.h b/js/src/jsdbgapi.h index b128bad1fbe9..4907d913a08b 100644 --- a/js/src/jsdbgapi.h +++ b/js/src/jsdbgapi.h @@ -140,9 +140,9 @@ JS_ClearAllWatchPoints(JSContext *cx); /************************************************************************/ -// RawScript because this needs to be callable from a signal handler +// Raw JSScript* because this needs to be callable from a signal handler. extern JS_PUBLIC_API(unsigned) -JS_PCToLineNumber(JSContext *cx, js::RawScript script, jsbytecode *pc); +JS_PCToLineNumber(JSContext *cx, JSScript *script, jsbytecode *pc); extern JS_PUBLIC_API(jsbytecode *) JS_LineNumberToPC(JSContext *cx, JSScript *script, unsigned lineno); diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index c4ba810ab2c0..d52a2262dff8 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -720,7 +720,7 @@ JS_FRIEND_API(void) EnableRuntimeProfilingStack(JSRuntime *rt, bool enabled); JS_FRIEND_API(jsbytecode*) -ProfilingGetPC(JSRuntime *rt, RawScript script, void *ip); +ProfilingGetPC(JSRuntime *rt, JSScript *script, void *ip); #ifdef JS_THREADSAFE JS_FRIEND_API(void *) diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 8ccaa0dec09c..b138ae5fb502 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -126,7 +126,7 @@ fun_getProperty(JSContext *cx, HandleObject obj_, HandleId id, MutableHandleValu // IonMonkey does not guarantee |f.arguments| can be // fully recovered, so we try to mitigate observing this behavior by // detecting its use early. - RawScript script = iter.script(); + JSScript *script = iter.script(); ion::ForbidCompilation(cx, script); #endif @@ -1164,7 +1164,7 @@ fun_isGenerator(JSContext *cx, unsigned argc, Value *vp) bool result = false; if (fun->hasScript()) { - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); JS_ASSERT(script->length != 0); result = script->isGenerator; } diff --git a/js/src/jsfun.h b/js/src/jsfun.h index 299064ce5944..4032207f6ae4 100644 --- a/js/src/jsfun.h +++ b/js/src/jsfun.h @@ -208,7 +208,7 @@ class JSFunction : public JSObject bool initializeLazyScript(JSContext *cx); - js::RawScript getOrCreateScript(JSContext *cx) { + JSScript *getOrCreateScript(JSContext *cx) { JS_ASSERT(isInterpreted()); JS_ASSERT(cx); if (isInterpretedLazy()) { @@ -233,12 +233,12 @@ class JSFunction : public JSObject return fun->hasScript(); } - js::RawScript nonLazyScript() const { + JSScript *nonLazyScript() const { JS_ASSERT(hasScript()); return JS::HandleScript::fromMarkedLocation(&u.i.script_); } - js::RawScript maybeNonLazyScript() const { + JSScript *maybeNonLazyScript() const { return isInterpreted() ? nonLazyScript() : NULL; } diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 55f238ba34b2..688aca43eeba 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -4945,7 +4945,7 @@ js::StopPCCountProfiling(JSContext *cx) for (ZonesIter zone(rt); !zone.done(); zone.next()) { for (CellIter i(zone, FINALIZE_SCRIPT); !i.done(); i.next()) { - RawScript script = i.get(); + JSScript *script = i.get(); if (script->hasScriptCounts && script->types) { ScriptAndCounts sac; sac.script = script; diff --git a/js/src/jsinfer.cpp b/js/src/jsinfer.cpp index 51fb7458d103..f6deca8ad90b 100644 --- a/js/src/jsinfer.cpp +++ b/js/src/jsinfer.cpp @@ -671,7 +671,7 @@ enum PropertyAccessKind { template class TypeConstraintProp : public TypeConstraint { - RawScript script_; + JSScript *script_; public: jsbytecode *pc; @@ -685,7 +685,7 @@ class TypeConstraintProp : public TypeConstraint /* Property being accessed. This is unrooted. */ RawId id; - TypeConstraintProp(RawScript script, jsbytecode *pc, StackTypeSet *target, RawId id) + TypeConstraintProp(JSScript *script, jsbytecode *pc, StackTypeSet *target, RawId id) : script_(script), pc(pc), target(target), id(id) { JS_ASSERT(script && pc && target); @@ -738,7 +738,7 @@ HeapTypeSet::addGetProperty(JSContext *cx, JSScript *script, jsbytecode *pc, template class TypeConstraintCallProp : public TypeConstraint { - RawScript script_; + JSScript *script_; public: jsbytecode *callpc; @@ -746,7 +746,7 @@ class TypeConstraintCallProp : public TypeConstraint /* Property being accessed. */ jsid id; - TypeConstraintCallProp(RawScript script, jsbytecode *callpc, jsid id) + TypeConstraintCallProp(JSScript *script, jsbytecode *callpc, jsid id) : script_(script), callpc(callpc), id(id) { JS_ASSERT(script && callpc); @@ -783,7 +783,7 @@ HeapTypeSet::addCallProperty(JSContext *cx, JSScript *script, jsbytecode *pc, js */ class TypeConstraintSetElement : public TypeConstraint { - RawScript script_; + JSScript *script_; public: jsbytecode *pc; @@ -791,7 +791,7 @@ class TypeConstraintSetElement : public TypeConstraint StackTypeSet *objectTypes; StackTypeSet *valueTypes; - TypeConstraintSetElement(RawScript script, jsbytecode *pc, + TypeConstraintSetElement(JSScript *script, jsbytecode *pc, StackTypeSet *objectTypes, StackTypeSet *valueTypes) : script_(script), pc(pc), objectTypes(objectTypes), valueTypes(valueTypes) @@ -841,7 +841,7 @@ StackTypeSet::addCall(JSContext *cx, TypeCallsite *site) /* Constraints for arithmetic operations. */ class TypeConstraintArith : public TypeConstraint { - RawScript script_; + JSScript *script_; public: jsbytecode *pc; @@ -852,7 +852,7 @@ class TypeConstraintArith : public TypeConstraint /* For addition operations, the other operand. */ TypeSet *other; - TypeConstraintArith(RawScript script, jsbytecode *pc, TypeSet *target, TypeSet *other) + TypeConstraintArith(JSScript *script, jsbytecode *pc, TypeSet *target, TypeSet *other) : script_(script), pc(pc), target(target), other(other) { JS_ASSERT(target); @@ -873,12 +873,12 @@ StackTypeSet::addArith(JSContext *cx, JSScript *script, jsbytecode *pc, TypeSet /* Subset constraint which transforms primitive values into appropriate objects. */ class TypeConstraintTransformThis : public TypeConstraint { - RawScript script_; + JSScript *script_; public: TypeSet *target; - TypeConstraintTransformThis(RawScript script, TypeSet *target) + TypeConstraintTransformThis(JSScript *script, TypeSet *target) : script_(script), target(target) {} @@ -899,14 +899,14 @@ StackTypeSet::addTransformThis(JSContext *cx, JSScript *script, TypeSet *target) */ class TypeConstraintPropagateThis : public TypeConstraint { - RawScript script_; + JSScript *script_; public: jsbytecode *callpc; Type type; StackTypeSet *types; - TypeConstraintPropagateThis(RawScript script, jsbytecode *callpc, Type type, StackTypeSet *types) + TypeConstraintPropagateThis(JSScript *script, jsbytecode *callpc, Type type, StackTypeSet *types) : script_(script), callpc(callpc), type(type), types(types) {} @@ -1060,11 +1060,11 @@ void ScriptAnalysis::breakTypeBarriersSSA(JSContext *cx, const SSAValue &v) class TypeConstraintSubsetBarrier : public TypeConstraint { public: - RawScript script; + JSScript *script; jsbytecode *pc; TypeSet *target; - TypeConstraintSubsetBarrier(RawScript script, jsbytecode *pc, TypeSet *target) + TypeConstraintSubsetBarrier(JSScript *script, jsbytecode *pc, TypeSet *target) : script(script), pc(pc), target(target) {} @@ -2338,7 +2338,7 @@ enum RecompileKind { * compilation. */ static inline bool -JITCodeHasCheck(RawScript script, jsbytecode *pc, RecompileKind kind) +JITCodeHasCheck(JSScript *script, jsbytecode *pc, RecompileKind kind) { if (kind == RECOMPILE_NONE) return false; @@ -2380,7 +2380,7 @@ JITCodeHasCheck(RawScript script, jsbytecode *pc, RecompileKind kind) * which this script was inlined into. */ static inline void -AddPendingRecompile(JSContext *cx, RawScript script, jsbytecode *pc, +AddPendingRecompile(JSContext *cx, JSScript *script, jsbytecode *pc, RecompileKind kind = RECOMPILE_NONE) { /* @@ -2430,10 +2430,10 @@ AddPendingRecompile(JSContext *cx, RawScript script, jsbytecode *pc, */ class TypeConstraintFreezeStack : public TypeConstraint { - RawScript script_; + JSScript *script_; public: - TypeConstraintFreezeStack(RawScript script) + TypeConstraintFreezeStack(JSScript *script) : script_(script) {} @@ -2637,7 +2637,7 @@ TypeCompartment::addAllocationSiteTypeObject(JSContext *cx, AllocationSiteKey ke } static inline RawId -GetAtomId(JSContext *cx, RawScript script, const jsbytecode *pc, unsigned offset) +GetAtomId(JSContext *cx, JSScript *script, const jsbytecode *pc, unsigned offset) { PropertyName *name = script->getName(GET_UINT32_INDEX(pc + offset)); return IdToTypeId(NameToId(name)); @@ -2891,7 +2891,7 @@ TypeZone::nukeTypes(FreeOp *fop) /* Throw away all JIT code in the compartment, but leave everything else alone. */ for (gc::CellIter i(zone(), gc::FINALIZE_SCRIPT); !i.done(); i.next()) { - RawScript script = i.get(); + JSScript *script = i.get(); mjit::ReleaseScriptCode(fop, script); # ifdef JS_ION ion::FinishInvalidation(fop, script); @@ -2958,7 +2958,7 @@ TypeCompartment::addPendingRecompile(JSContext *cx, const RecompileInfo &info) } void -TypeCompartment::addPendingRecompile(JSContext *cx, RawScript script, jsbytecode *pc) +TypeCompartment::addPendingRecompile(JSContext *cx, JSScript *script, jsbytecode *pc) { JS_ASSERT(script); if (!constrainedOutputs) @@ -5980,7 +5980,7 @@ JSScript::makeTypes(JSContext *cx) JS_ASSERT(originalFunction()); JS_ASSERT(function()->nargs == originalFunction()->nargs); - RawScript original = originalFunction()->nonLazyScript(); + JSScript *original = originalFunction()->nonLazyScript(); if (!original->ensureHasTypes(cx)) return false; @@ -6741,7 +6741,7 @@ TypeCompartment::~TypeCompartment() } /* static */ void -TypeScript::Sweep(FreeOp *fop, RawScript script) +TypeScript::Sweep(FreeOp *fop, JSScript *script) { JSCompartment *compartment = script->compartment(); JS_ASSERT(compartment->zone()->isGCSweeping()); @@ -6921,7 +6921,7 @@ TypeCompartment::maybePurgeAnalysis(JSContext *cx, bool force) } static void -SizeOfScriptTypeInferenceData(RawScript script, JS::TypeInferenceSizes *sizes, +SizeOfScriptTypeInferenceData(JSScript *script, JS::TypeInferenceSizes *sizes, JSMallocSizeOfFun mallocSizeOf) { TypeScript *typeScript = script->types; @@ -7039,7 +7039,7 @@ TypeZone::sweep(FreeOp *fop, bool releaseTypes) gcstats::AutoPhase ap2(rt->gcStats, gcstats::PHASE_DISCARD_TI); for (CellIterUnderGC i(zone(), FINALIZE_SCRIPT); !i.done(); i.next()) { - RawScript script = i.get(); + JSScript *script = i.get(); if (script->types) { types::TypeScript::Sweep(fop, script); diff --git a/js/src/jsinfer.h b/js/src/jsinfer.h index edc92ae28cdc..232d0420027e 100644 --- a/js/src/jsinfer.h +++ b/js/src/jsinfer.h @@ -20,7 +20,7 @@ #include "js/HashTable.h" #include "js/Vector.h" -ForwardDeclareJS(Script); +class JSScript; namespace js { @@ -1165,7 +1165,7 @@ struct TypeCallsite /* Type set receiving the return value of this call. */ StackTypeSet *returnTypes; - inline TypeCallsite(JSContext *cx, RawScript script, jsbytecode *pc, + inline TypeCallsite(JSContext *cx, JSScript *script, jsbytecode *pc, bool isNew, unsigned argumentCount); }; @@ -1191,15 +1191,15 @@ class TypeScript /* Array of type type sets for variables and JOF_TYPESET ops. */ TypeSet *typeArray() { return (TypeSet *) (uintptr_t(this) + sizeof(TypeScript)); } - static inline unsigned NumTypeSets(RawScript script); + static inline unsigned NumTypeSets(JSScript *script); - static inline HeapTypeSet *ReturnTypes(RawScript script); - static inline StackTypeSet *ThisTypes(RawScript script); - static inline StackTypeSet *ArgTypes(RawScript script, unsigned i); - static inline StackTypeSet *LocalTypes(RawScript script, unsigned i); + static inline HeapTypeSet *ReturnTypes(JSScript *script); + static inline StackTypeSet *ThisTypes(JSScript *script); + static inline StackTypeSet *ArgTypes(JSScript *script, unsigned i); + static inline StackTypeSet *LocalTypes(JSScript *script, unsigned i); /* Follows slot layout in jsanalyze.h, can get this/arg/local type sets. */ - static inline StackTypeSet *SlotTypes(RawScript script, unsigned slot); + static inline StackTypeSet *SlotTypes(JSScript *script, unsigned slot); /* Get the default 'new' object for a given standard class, per the script's global. */ static inline TypeObject *StandardType(JSContext *cx, JSProtoKey kind); @@ -1248,7 +1248,7 @@ class TypeScript static void AddFreezeConstraints(JSContext *cx, JSScript *script); static void Purge(JSContext *cx, HandleScript script); - static void Sweep(FreeOp *fop, RawScript script); + static void Sweep(FreeOp *fop, JSScript *script); void destroy(); }; @@ -1431,7 +1431,7 @@ struct TypeCompartment /* Mark a script as needing recompilation once inference has finished. */ void addPendingRecompile(JSContext *cx, const RecompileInfo &info); - void addPendingRecompile(JSContext *cx, RawScript script, jsbytecode *pc); + void addPendingRecompile(JSContext *cx, JSScript *script, jsbytecode *pc); /* Monitor future effects on a bytecode. */ void monitorBytecode(JSContext *cx, JSScript *script, uint32_t offset, diff --git a/js/src/jsinferinlines.h b/js/src/jsinferinlines.h index f54bd004717d..16f5a2807ea6 100644 --- a/js/src/jsinferinlines.h +++ b/js/src/jsinferinlines.h @@ -418,7 +418,7 @@ struct AutoEnterCompilation JS_ASSERT(info.outputIndex == RecompileInfo::NoCompilerRunning); } - bool init(RawScript script, bool constructing, unsigned chunkIndex) + bool init(JSScript *script, bool constructing, unsigned chunkIndex) { CompilerOutput co; co.script = script; @@ -725,7 +725,7 @@ FixObjectType(JSContext *cx, HandleObject obj) cx->compartment->types.fixObjectType(cx, obj); } -/* Interface helpers for RawScript */ +/* Interface helpers for JSScript*. */ extern void TypeMonitorResult(JSContext *cx, JSScript *script, jsbytecode *pc, const js::Value &rval); extern void TypeDynamicResult(JSContext *cx, JSScript *script, jsbytecode *pc, @@ -780,7 +780,7 @@ UseNewTypeForClone(JSFunction *fun) * instance a singleton type and clone the underlying script. */ - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); if (script->length >= 50) return false; @@ -809,20 +809,20 @@ UseNewTypeForClone(JSFunction *fun) ///////////////////////////////////////////////////////////////////// /* static */ inline unsigned -TypeScript::NumTypeSets(RawScript script) +TypeScript::NumTypeSets(JSScript *script) { return script->nTypeSets + analyze::TotalSlots(script); } /* static */ inline HeapTypeSet * -TypeScript::ReturnTypes(RawScript script) +TypeScript::ReturnTypes(JSScript *script) { TypeSet *types = script->types->typeArray() + script->nTypeSets + js::analyze::CalleeSlot(); return types->toHeapTypeSet(); } /* static */ inline StackTypeSet * -TypeScript::ThisTypes(RawScript script) +TypeScript::ThisTypes(JSScript *script) { TypeSet *types = script->types->typeArray() + script->nTypeSets + js::analyze::ThisSlot(); return types->toStackTypeSet(); @@ -835,7 +835,7 @@ TypeScript::ThisTypes(RawScript script) */ /* static */ inline StackTypeSet * -TypeScript::ArgTypes(RawScript script, unsigned i) +TypeScript::ArgTypes(JSScript *script, unsigned i) { JS_ASSERT(i < script->function()->nargs); TypeSet *types = script->types->typeArray() + script->nTypeSets + js::analyze::ArgSlot(i); @@ -843,7 +843,7 @@ TypeScript::ArgTypes(RawScript script, unsigned i) } /* static */ inline StackTypeSet * -TypeScript::LocalTypes(RawScript script, unsigned i) +TypeScript::LocalTypes(JSScript *script, unsigned i) { JS_ASSERT(i < script->nfixed); TypeSet *types = script->types->typeArray() + script->nTypeSets + js::analyze::LocalSlot(script, i); @@ -851,7 +851,7 @@ TypeScript::LocalTypes(RawScript script, unsigned i) } /* static */ inline StackTypeSet * -TypeScript::SlotTypes(RawScript script, unsigned slot) +TypeScript::SlotTypes(JSScript *script, unsigned slot) { JS_ASSERT(slot < js::analyze::TotalSlots(script)); TypeSet *types = script->types->typeArray() + script->nTypeSets + slot; @@ -1553,7 +1553,7 @@ TypeSet::getTypeObject(unsigned i) const ///////////////////////////////////////////////////////////////////// inline -TypeCallsite::TypeCallsite(JSContext *cx, RawScript script, jsbytecode *pc, +TypeCallsite::TypeCallsite(JSContext *cx, JSScript *script, jsbytecode *pc, bool isNew, unsigned argumentCount) : script(script), pc(pc), isNew(isNew), argumentCount(argumentCount), thisTypes(NULL), returnTypes(NULL) diff --git a/js/src/jsinterp.cpp b/js/src/jsinterp.cpp index 600ab60ad02e..39b3a0e0d01b 100644 --- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -312,7 +312,7 @@ js::RunScript(JSContext *cx, StackFrame *fp) if (!iter.done()) { ++iter; if (iter.isScript()) { - RawScript script = iter.script(); + JSScript *script = iter.script(); jsbytecode *pc = iter.pc(); if (UseNewType(cx, script, pc)) fp->setUseNewType(); diff --git a/js/src/jsinterpinlines.h b/js/src/jsinterpinlines.h index 64078dac72f6..e4656ee62047 100644 --- a/js/src/jsinterpinlines.h +++ b/js/src/jsinterpinlines.h @@ -887,7 +887,7 @@ GetElementOperation(JSContext *cx, JSOp op, MutableHandleValue lref, HandleValue static JS_ALWAYS_INLINE bool SetObjectElementOperation(JSContext *cx, Handle obj, HandleId id, const Value &value, - bool strict, RawScript maybeScript = NULL, jsbytecode *pc = NULL) + bool strict, JSScript *maybeScript = NULL, jsbytecode *pc = NULL) { RootedScript script(cx, maybeScript); types::TypeScript::MonitorAssign(cx, obj, id); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 5483cf2e9d60..928f279a64a1 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1563,7 +1563,7 @@ js::CreateThisForFunction(JSContext *cx, HandleObject callee, bool newType) * checking whether document.all is defined. */ static bool -Detecting(JSContext *cx, RawScript script, jsbytecode *pc) +Detecting(JSContext *cx, JSScript *script, jsbytecode *pc) { /* General case: a branch or equality op follows the access. */ JSOp op = JSOp(*pc); @@ -1614,7 +1614,7 @@ js_InferFlags(JSContext *cx, unsigned defaultFlags) * handle the case of cross-compartment property access. */ jsbytecode *pc; - RawScript script = cx->stack.currentScript(&pc, ContextStack::ALLOW_CROSS_COMPARTMENT); + JSScript *script = cx->stack.currentScript(&pc, ContextStack::ALLOW_CROSS_COMPARTMENT); if (!script) return defaultFlags; @@ -3759,7 +3759,7 @@ NativeGetInline(JSContext *cx, { jsbytecode *pc; - RawScript script = cx->stack.currentScript(&pc); + JSScript *script = cx->stack.currentScript(&pc); if (script && script->hasAnalysis()) { analyze::Bytecode *code = script->analysis()->maybeCode(pc); if (code) @@ -4110,7 +4110,7 @@ static bool MaybeReportUndeclaredVarAssignment(JSContext *cx, JSString *propname) { { - RawScript script = cx->stack.currentScript(NULL, ContextStack::ALLOW_CROSS_COMPARTMENT); + JSScript *script = cx->stack.currentScript(NULL, ContextStack::ALLOW_CROSS_COMPARTMENT); if (!script) return true; @@ -4133,7 +4133,7 @@ js::ReportIfUndeclaredVarAssignment(JSContext *cx, HandleString propname) { { jsbytecode *pc; - RawScript script = cx->stack.currentScript(&pc, ContextStack::ALLOW_CROSS_COMPARTMENT); + JSScript *script = cx->stack.currentScript(&pc, ContextStack::ALLOW_CROSS_COMPARTMENT); if (!script) return true; @@ -4991,7 +4991,7 @@ dumpValue(const Value &v) fputs("hasScript()) { - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); fprintf(stderr, " (%s:%u)", script->filename() ? script->filename() : "", script->lineno); } @@ -5259,7 +5259,7 @@ js_DumpBacktrace(JSContext *cx) if (i.isScript()) { const char *filename = JS_GetScriptFilename(cx, i.script()); unsigned line = JS_PCToLineNumber(cx, i.script(), i.pc()); - RawScript script = i.script(); + JSScript *script = i.script(); sprinter.printf("#%d %14p %s:%d (%p @ %d)\n", depth, (i.isIon() ? 0 : i.interpFrame()), filename, line, script, i.pc() - script->code); diff --git a/js/src/jsprobes.cpp b/js/src/jsprobes.cpp index 956df7b7b876..745397a77622 100644 --- a/js/src/jsprobes.cpp +++ b/js/src/jsprobes.cpp @@ -55,7 +55,7 @@ Probes::discardMJITCode(FreeOp *fop, mjit::JITScript *jscr, mjit::JITChunk *chun bool Probes::registerICCode(JSContext *cx, - mjit::JITChunk *chunk, RawScript script, jsbytecode* pc, + mjit::JITChunk *chunk, JSScript *script, jsbytecode* pc, void *start, size_t size) { if (cx->runtime->spsProfiler.enabled() && @@ -79,7 +79,7 @@ Probes::discardExecutableRegion(void *start, size_t size) #ifdef INCLUDE_MOZILLA_DTRACE static const char * -ScriptFilename(const RawScript script) +ScriptFilename(const JSScript *script) { if (!script) return Probes::nullName; @@ -106,7 +106,7 @@ FunctionName(JSContext *cx, JSFunction *fun, JSAutoByteString* bytes) * a number of usually unused lines of code would cause. */ void -Probes::DTraceEnterJSFun(JSContext *cx, JSFunction *fun, RawScript script) +Probes::DTraceEnterJSFun(JSContext *cx, JSFunction *fun, JSScript *script) { JSAutoByteString funNameBytes; JAVASCRIPT_FUNCTION_ENTRY(ScriptFilename(script), Probes::nullName, @@ -114,7 +114,7 @@ Probes::DTraceEnterJSFun(JSContext *cx, JSFunction *fun, RawScript script) } void -Probes::DTraceExitJSFun(JSContext *cx, JSFunction *fun, RawScript script) +Probes::DTraceExitJSFun(JSContext *cx, JSFunction *fun, JSScript *script) { JSAutoByteString funNameBytes; JAVASCRIPT_FUNCTION_RETURN(ScriptFilename(script), Probes::nullName, diff --git a/js/src/jsprobes.h b/js/src/jsprobes.h index 1a1220b1e9ba..2ea41e9c4fd6 100644 --- a/js/src/jsprobes.h +++ b/js/src/jsprobes.h @@ -75,16 +75,16 @@ bool callTrackingActive(JSContext *); bool wantNativeAddressInfo(JSContext *); /* Entering a JS function */ -bool enterScript(JSContext *, RawScript, JSFunction *, StackFrame *); +bool enterScript(JSContext *, JSScript *, JSFunction *, StackFrame *); /* About to leave a JS function */ -bool exitScript(JSContext *, RawScript, JSFunction *, StackFrame *); +bool exitScript(JSContext *, JSScript *, JSFunction *, StackFrame *); /* Executing a script */ -bool startExecution(RawScript script); +bool startExecution(JSScript *script); /* Script has completed execution */ -bool stopExecution(RawScript script); +bool stopExecution(JSScript *script); /* * Object has been created. |obj| must exist (its class and size are read) @@ -132,7 +132,7 @@ discardMJITCode(FreeOp *fop, mjit::JITScript *jscr, mjit::JITChunk *chunk, void* */ bool registerICCode(JSContext *cx, - mjit::JITChunk *chunk, RawScript script, jsbytecode* pc, + mjit::JITChunk *chunk, JSScript *script, jsbytecode* pc, void *start, size_t size); #endif /* JS_METHODJIT */ @@ -149,8 +149,8 @@ discardExecutableRegion(void *start, size_t size); * marshalling required for these probe points is expensive enough that it * shouldn't really matter. */ -void DTraceEnterJSFun(JSContext *cx, JSFunction *fun, RawScript script); -void DTraceExitJSFun(JSContext *cx, JSFunction *fun, RawScript script); +void DTraceEnterJSFun(JSContext *cx, JSFunction *fun, JSScript *script); +void DTraceExitJSFun(JSContext *cx, JSFunction *fun, JSScript *script); } /* namespace Probes */ @@ -181,7 +181,7 @@ Probes::wantNativeAddressInfo(JSContext *cx) } inline bool -Probes::enterScript(JSContext *cx, RawScript script, JSFunction *maybeFun, +Probes::enterScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, StackFrame *fp) { bool ok = true; @@ -204,7 +204,7 @@ Probes::enterScript(JSContext *cx, RawScript script, JSFunction *maybeFun, } inline bool -Probes::exitScript(JSContext *cx, RawScript script, JSFunction *maybeFun, +Probes::exitScript(JSContext *cx, JSScript *script, JSFunction *maybeFun, StackFrame *fp) { bool ok = true; @@ -275,7 +275,7 @@ Probes::finalizeObject(JSObject *obj) return ok; } inline bool -Probes::startExecution(RawScript script) +Probes::startExecution(JSScript *script) { bool ok = true; @@ -289,7 +289,7 @@ Probes::startExecution(RawScript script) } inline bool -Probes::stopExecution(RawScript script) +Probes::stopExecution(JSScript *script) { bool ok = true; diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 50a5674dceb6..acf0c0edf740 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -371,7 +371,7 @@ XDRScriptConst(XDRState *xdr, HeapValue *vp) } static inline uint32_t -FindBlockIndex(RawScript script, StaticBlockObject &block) +FindBlockIndex(JSScript *script, StaticBlockObject &block) { ObjectArray *objects = script->objects(); HeapPtrObject *vector = objects->vector; @@ -844,7 +844,7 @@ JSScript::initScriptCounts(JSContext *cx) return true; } -static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(RawScript script) +static inline ScriptCountsMap::Ptr GetScriptCountsMapEntry(JSScript *script) { JS_ASSERT(script->hasScriptCounts); ScriptCountsMap *map = script->compartment()->scriptCountsMap; @@ -1632,7 +1632,7 @@ ScriptDataSize(uint32_t nbindings, uint32_t nobjects, uint32_t nregexps, return size; } -RawScript +JSScript * JSScript::Create(JSContext *cx, HandleObject enclosingScope, bool savedCallerFun, const CompileOptions &options, unsigned staticLevel, ScriptSource *ss, uint32_t bufStart, uint32_t bufEnd) @@ -1962,7 +1962,7 @@ js::CallNewScriptHook(JSContext *cx, HandleScript script, HandleFunction fun) } void -js::CallDestroyScriptHook(FreeOp *fop, RawScript script) +js::CallDestroyScriptHook(FreeOp *fop, JSScript *script) { if (script->selfHosted) return; @@ -2019,10 +2019,10 @@ GSNCache::purge() } jssrcnote * -js_GetSrcNote(JSContext *cx, RawScript script, jsbytecode *pc) +js_GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc) { GSNCache *cache = &cx->runtime->gsnCache; - cx = NULL; // nulling |cx| ensures GC can't be triggered, so |RawScript script| is safe + cx = NULL; // nulling |cx| ensures GC can't be triggered, so |JSScript *script| is safe size_t target = pc - script->code; if (target >= size_t(script->length)) @@ -2122,7 +2122,7 @@ js::PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbyt } unsigned -js::PCToLineNumber(RawScript script, jsbytecode *pc, unsigned *columnp) +js::PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp) { /* Cope with StackFrame.pc value prior to entering js_Interpret. */ if (!pc) @@ -2135,7 +2135,7 @@ js::PCToLineNumber(RawScript script, jsbytecode *pc, unsigned *columnp) #define SN_LINE_LIMIT (SN_3BYTE_OFFSET_FLAG << 16) jsbytecode * -js_LineNumberToPC(RawScript script, unsigned target) +js_LineNumberToPC(JSScript *script, unsigned target) { ptrdiff_t offset = 0; ptrdiff_t best = -1; @@ -2170,7 +2170,7 @@ out: } JS_FRIEND_API(unsigned) -js_GetScriptLineExtent(RawScript script) +js_GetScriptLineExtent(JSScript *script) { unsigned lineno = script->lineno; unsigned maxLineNo = 0; @@ -2217,7 +2217,7 @@ js::CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, unsigned * return; } - RawScript script = iter.script(); + JSScript *script = iter.script(); *file = script->filename(); *linenop = PCToLineNumber(iter.script(), iter.pc()); *origin = script->originPrincipals; @@ -2225,13 +2225,13 @@ js::CurrentScriptFileLineOriginSlow(JSContext *cx, const char **file, unsigned * template static inline T * -Rebase(RawScript dst, RawScript src, T *srcp) +Rebase(JSScript *dst, JSScript *src, T *srcp) { size_t off = reinterpret_cast(srcp) - src->data; return reinterpret_cast(dst->data + off); } -RawScript +JSScript * js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HandleScript src) { /* NB: Keep this in sync with XDRScript. */ @@ -2412,7 +2412,7 @@ js::CloneFunctionScript(JSContext *cx, HandleFunction original, HandleFunction c clone->mutableScript().init(NULL); - RawScript cscript = CloneScript(cx, scope, clone, script); + JSScript *cscript = CloneScript(cx, scope, clone, script); if (!cscript) return false; diff --git a/js/src/jsscript.h b/js/src/jsscript.h index 5311fc677380..e43772867048 100644 --- a/js/src/jsscript.h +++ b/js/src/jsscript.h @@ -19,8 +19,6 @@ #include "js/RootingAPI.h" #include "vm/Shape.h" -ForwardDeclareJS(Script); - namespace js { namespace ion { @@ -244,9 +242,9 @@ class ScriptCounts } }; -typedef HashMap, + DefaultHasher, SystemAllocPolicy> ScriptCountsMap; class DebugScript @@ -272,9 +270,9 @@ class DebugScript BreakpointSite *breakpoints[1]; }; -typedef HashMap, + DefaultHasher, SystemAllocPolicy> DebugScriptMap; struct ScriptSource; @@ -531,7 +529,7 @@ class JSScript : public js::gc::Cell // public: - static js::RawScript Create(JSContext *cx, js::HandleObject enclosingScope, bool savedCallerFun, + static JSScript *Create(JSContext *cx, js::HandleObject enclosingScope, bool savedCallerFun, const JS::CompileOptions &options, unsigned staticLevel, js::ScriptSource *ss, uint32_t sourceStart, uint32_t sourceEnd); @@ -855,7 +853,7 @@ class JSScript : public js::gc::Cell bool hasArray(ArrayKind kind) { return (hasArrayBits & (1 << kind)); } void setHasArray(ArrayKind kind) { hasArrayBits |= (1 << kind); } - void cloneHasArray(js::RawScript script) { hasArrayBits = script->hasArrayBits; } + void cloneHasArray(JSScript *script) { hasArrayBits = script->hasArrayBits; } bool hasConsts() { return hasArray(CONSTS); } bool hasObjects() { return hasArray(OBJECTS); } @@ -1006,8 +1004,8 @@ class JSScript : public js::gc::Cell JS::Zone *zone() const { return tenuredZone(); } - static inline void writeBarrierPre(js::RawScript script); - static inline void writeBarrierPost(js::RawScript script, void *addr); + static inline void writeBarrierPre(JSScript *script); + static inline void writeBarrierPost(JSScript *script, void *addr); static inline js::ThingRootKind rootKind() { return js::THING_ROOT_SCRIPT; } @@ -1083,7 +1081,7 @@ class AliasedFormalIter } public: - explicit inline AliasedFormalIter(js::RawScript script); + explicit inline AliasedFormalIter(JSScript *script); bool done() const { return p_ == end_; } operator bool() const { return !done(); } @@ -1296,7 +1294,7 @@ extern void CallNewScriptHook(JSContext *cx, JS::HandleScript script, JS::HandleFunction fun); extern void -CallDestroyScriptHook(FreeOp *fop, js::RawScript script); +CallDestroyScriptHook(FreeOp *fop, JSScript *script); struct SharedScriptData { @@ -1360,7 +1358,7 @@ FreeScriptData(JSRuntime *rt); struct ScriptAndCounts { /* This structure is stored and marked from the JSRuntime. */ - js::RawScript script; + JSScript *script; ScriptCounts scriptCounts; PCCounts &getPCCounts(jsbytecode *pc) const { @@ -1376,18 +1374,18 @@ struct ScriptAndCounts } /* namespace js */ extern jssrcnote * -js_GetSrcNote(JSContext *cx, js::RawScript script, jsbytecode *pc); +js_GetSrcNote(JSContext *cx, JSScript *script, jsbytecode *pc); extern jsbytecode * -js_LineNumberToPC(js::RawScript script, unsigned lineno); +js_LineNumberToPC(JSScript *script, unsigned lineno); extern JS_FRIEND_API(unsigned) -js_GetScriptLineExtent(js::RawScript script); +js_GetScriptLineExtent(JSScript *script); namespace js { extern unsigned -PCToLineNumber(js::RawScript script, jsbytecode *pc, unsigned *columnp = NULL); +PCToLineNumber(JSScript *script, jsbytecode *pc, unsigned *columnp = NULL); extern unsigned PCToLineNumber(unsigned startLine, jssrcnote *notes, jsbytecode *code, jsbytecode *pc, @@ -1413,7 +1411,7 @@ enum LineOption { inline void CurrentScriptFileLineOrigin(JSContext *cx, unsigned *linenop, LineOption = NOT_CALLED_FROM_JSOP_EVAL); -extern RawScript +extern JSScript * CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun, HandleScript script); bool diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h index 560aa44a14ab..fe88afec3afa 100644 --- a/js/src/jsscriptinlines.h +++ b/js/src/jsscriptinlines.h @@ -28,7 +28,7 @@ Bindings::Bindings() {} inline -AliasedFormalIter::AliasedFormalIter(js::RawScript script) +AliasedFormalIter::AliasedFormalIter(JSScript *script) : begin_(script->bindings.bindingArray()), p_(begin_), end_(begin_ + (script->funHasAnyAliasedFormal ? script->bindings.numArgs() : 0)), @@ -176,7 +176,7 @@ JSScript::destroyMJITInfo(js::FreeOp *fop) #endif /* JS_METHODJIT */ inline void -JSScript::writeBarrierPre(js::RawScript script) +JSScript::writeBarrierPre(JSScript *script) { #ifdef JSGC_INCREMENTAL if (!script || !script->runtime()->needsBarrier()) @@ -185,7 +185,7 @@ JSScript::writeBarrierPre(js::RawScript script) JS::Zone *zone = script->zone(); if (zone->needsBarrier()) { JS_ASSERT(!zone->rt->isHeapBusy()); - js::RawScript tmp = script; + JSScript *tmp = script; MarkScriptUnbarriered(zone->barrierTracer(), &tmp, "write barrier"); JS_ASSERT(tmp == script); } @@ -193,7 +193,7 @@ JSScript::writeBarrierPre(js::RawScript script) } inline void -JSScript::writeBarrierPost(js::RawScript script, void *addr) +JSScript::writeBarrierPost(JSScript *script, void *addr) { } diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp index 9a2af0d46427..68afd1eb5644 100644 --- a/js/src/jsstr.cpp +++ b/js/src/jsstr.cpp @@ -2615,7 +2615,7 @@ LambdaIsGetElem(JSObject &lambda) if (!fun->hasScript()) return NULL; - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); jsbytecode *pc = script->code; /* diff --git a/js/src/methodjit/MonoIC.cpp b/js/src/methodjit/MonoIC.cpp index 02616da865a7..f9228fe5de30 100644 --- a/js/src/methodjit/MonoIC.cpp +++ b/js/src/methodjit/MonoIC.cpp @@ -1308,7 +1308,7 @@ class CallCompiler : public BaseCompiler } JS_ASSERT(fun); - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); JS_ASSERT(script); uint32_t flags = callingNew ? StackFrame::CONSTRUCTING : 0; @@ -1488,7 +1488,7 @@ ic::GenerateArgumentCheckStub(VMFrame &f) JITScript *jit = f.jit(); StackFrame *fp = f.fp(); JSFunction *fun = fp->fun(); - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); if (jit->argsCheckPool) jit->resetArgsCheck(); diff --git a/js/src/methodjit/PolyIC.cpp b/js/src/methodjit/PolyIC.cpp index 14533e4192ee..eace788f5164 100644 --- a/js/src/methodjit/PolyIC.cpp +++ b/js/src/methodjit/PolyIC.cpp @@ -2170,7 +2170,7 @@ frameCountersOffset(VMFrame &f) } jsbytecode *pc; - RawScript script = cx->stack.currentScript(&pc); + JSScript *script = cx->stack.currentScript(&pc); offset += pc - script->code; return offset; diff --git a/js/src/methodjit/StubCalls.cpp b/js/src/methodjit/StubCalls.cpp index f2ba2f6939a9..1fab4ac47d01 100644 --- a/js/src/methodjit/StubCalls.cpp +++ b/js/src/methodjit/StubCalls.cpp @@ -1568,7 +1568,7 @@ stubs::AssertArgumentTypes(VMFrame &f) { StackFrame *fp = f.fp(); JSFunction *fun = fp->fun(); - RawScript script = fun->nonLazyScript(); + JSScript *script = fun->nonLazyScript(); /* * Don't check the type of 'this' for constructor frames, the 'this' value @@ -1612,7 +1612,7 @@ stubs::InvariantFailure(VMFrame &f, void *rval) *frameAddr = repatchCode; /* Recompile the outermost script, and don't hoist any bounds checks. */ - RawScript script = f.fp()->script(); + JSScript *script = f.fp()->script(); JS_ASSERT(!script->failedBoundsCheck); script->failedBoundsCheck = true; diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp index 57df45d15399..660224b1cad2 100644 --- a/js/src/shell/js.cpp +++ b/js/src/shell/js.cpp @@ -1403,7 +1403,7 @@ AssertEq(JSContext *cx, unsigned argc, jsval *vp) return true; } -static RawScript +static JSScript * ValueToScript(JSContext *cx, jsval v, JSFunction **funp = NULL) { RootedFunction fun(cx, JS_ValueToFunction(cx, v)); @@ -1485,7 +1485,7 @@ GetScriptAndPCArgs(JSContext *cx, unsigned argc, jsval *argv, MutableHandleScrip } static JSTrapStatus -TrapHandler(JSContext *cx, RawScript, jsbytecode *pc, jsval *rvalArg, +TrapHandler(JSContext *cx, JSScript *, jsbytecode *pc, jsval *rvalArg, jsval closure) { JSString *str = JSVAL_TO_STRING(closure); @@ -1558,7 +1558,7 @@ Untrap(JSContext *cx, unsigned argc, jsval *vp) } static JSTrapStatus -DebuggerAndThrowHandler(JSContext *cx, RawScript script, jsbytecode *pc, jsval *rval, +DebuggerAndThrowHandler(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval, void *closure) { return TrapHandler(cx, script, pc, rval, STRING_TO_JSVAL((JSString *)closure)); diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp index 9306b1f91e6a..7355a04ec578 100644 --- a/js/src/vm/ArgumentsObject.cpp +++ b/js/src/vm/ArgumentsObject.cpp @@ -55,7 +55,7 @@ CopyStackFrameArguments(const AbstractFramePtr frame, HeapValue *dst, unsigned t ArgumentsObject::MaybeForwardToCallObject(AbstractFramePtr frame, JSObject *obj, ArgumentsData *data) { - RawScript script = frame.script(); + JSScript *script = frame.script(); if (frame.fun()->isHeavyweight() && script->argsObjAliasesFormals()) { obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(frame.callObj())); for (AliasedFormalIter fi(script); fi; fi++) @@ -69,7 +69,7 @@ ArgumentsObject::MaybeForwardToCallObject(ion::IonJSFrameLayout *frame, HandleOb JSObject *obj, ArgumentsData *data) { JSFunction *callee = ion::CalleeTokenToFunction(frame->calleeToken()); - RawScript script = callee->nonLazyScript(); + JSScript *script = callee->nonLazyScript(); if (callee->isHeavyweight() && script->argsObjAliasesFormals()) { JS_ASSERT(callObj && callObj->isCall()); obj->initFixedSlot(MAYBE_CALL_SLOT, ObjectValue(*callObj.get())); diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 075899720b57..78e3b05ff258 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -1231,7 +1231,7 @@ Debugger::onSingleStep(JSContext *cx, MutableHandleValue vp) */ { uint32_t stepperCount = 0; - RawScript trappingScript = iter.script(); + JSScript *trappingScript = iter.script(); GlobalObject *global = cx->global(); if (GlobalObject::DebuggerVector *debuggers = global->getDebuggers()) { for (Debugger **p = debuggers->begin(); p != debuggers->end(); p++) { @@ -3796,7 +3796,7 @@ static JSBool DebuggerFrame_getOffset(JSContext *cx, unsigned argc, Value *vp) { THIS_FRAME(cx, argc, vp, "get offset", args, thisobj, iter); - RawScript script = iter.script(); + JSScript *script = iter.script(); iter.updatePcQuadratic(); jsbytecode *pc = iter.pc(); JS_ASSERT(script->code <= pc); diff --git a/js/src/vm/SPSProfiler.cpp b/js/src/vm/SPSProfiler.cpp index 49f469ef6c2a..d9edecaed6b1 100644 --- a/js/src/vm/SPSProfiler.cpp +++ b/js/src/vm/SPSProfiler.cpp @@ -82,7 +82,7 @@ SPSProfiler::enable(bool enabled) /* Lookup the string for the function/script, creating one if necessary */ const char* -SPSProfiler::profileString(JSContext *cx, RawScript script, JSFunction *maybeFun) +SPSProfiler::profileString(JSContext *cx, JSScript *script, JSFunction *maybeFun) { JS_ASSERT(strings.initialized()); ProfileStringMap::AddPtr s = strings.lookupForAdd(script); @@ -99,7 +99,7 @@ SPSProfiler::profileString(JSContext *cx, RawScript script, JSFunction *maybeFun } void -SPSProfiler::onScriptFinalized(RawScript script) +SPSProfiler::onScriptFinalized(JSScript *script) { /* * This function is called whenever a script is destroyed, regardless of @@ -118,7 +118,7 @@ SPSProfiler::onScriptFinalized(RawScript script) } bool -SPSProfiler::enter(JSContext *cx, RawScript script, JSFunction *maybeFun) +SPSProfiler::enter(JSContext *cx, JSScript *script, JSFunction *maybeFun) { const char *str = profileString(cx, script, maybeFun); if (str == NULL) @@ -131,7 +131,7 @@ SPSProfiler::enter(JSContext *cx, RawScript script, JSFunction *maybeFun) } void -SPSProfiler::exit(JSContext *cx, RawScript script, JSFunction *maybeFun) +SPSProfiler::exit(JSContext *cx, JSScript *script, JSFunction *maybeFun) { pop(); @@ -182,7 +182,7 @@ SPSProfiler::enterNative(const char *string, void *sp) } void -SPSProfiler::push(const char *string, void *sp, RawScript script, jsbytecode *pc) +SPSProfiler::push(const char *string, void *sp, JSScript *script, jsbytecode *pc) { /* these operations cannot be re-ordered, so volatile-ize operations */ volatile ProfileEntry *stack = stack_; @@ -214,7 +214,7 @@ SPSProfiler::pop() * AddPtr held while invoking allocProfileString. */ const char* -SPSProfiler::allocProfileString(JSContext *cx, RawScript script, JSFunction *maybeFun) +SPSProfiler::allocProfileString(JSContext *cx, JSScript *script, JSFunction *maybeFun) { DebugOnly gcBefore = cx->runtime->gcNumber; StringBuffer buf(cx); @@ -267,7 +267,7 @@ JMChunkInfo::JMChunkInfo(mjit::JSActiveFrame *frame, {} jsbytecode* -SPSProfiler::ipToPC(RawScript script, size_t ip) +SPSProfiler::ipToPC(JSScript *script, size_t ip) { if (!jminfo.initialized()) return NULL; @@ -295,7 +295,7 @@ SPSProfiler::ipToPC(RawScript script, size_t ip) } jsbytecode* -JMChunkInfo::convert(RawScript script, size_t ip) +JMChunkInfo::convert(JSScript *script, size_t ip) { if (mainStart <= ip && ip < mainEnd) { size_t offset = 0; @@ -393,7 +393,7 @@ SPSProfiler::registerScript(mjit::JSActiveFrame *frame, bool SPSProfiler::registerICCode(mjit::JITChunk *chunk, - RawScript script, jsbytecode *pc, + JSScript *script, jsbytecode *pc, void *base, size_t size) { JS_ASSERT(jminfo.initialized()); @@ -415,7 +415,7 @@ SPSProfiler::discardMJITCode(mjit::JITScript *jscr, } void -SPSProfiler::unregisterScript(RawScript script, mjit::JITChunk *chunk) +SPSProfiler::unregisterScript(JSScript *script, mjit::JITChunk *chunk) { JITInfoMap::Ptr ptr = jminfo.lookup(script); if (!ptr) diff --git a/js/src/vm/SPSProfiler.h b/js/src/vm/SPSProfiler.h index a0c366311892..71fe530aadf1 100644 --- a/js/src/vm/SPSProfiler.h +++ b/js/src/vm/SPSProfiler.h @@ -135,9 +135,9 @@ class SPSProfiler bool slowAssertions; uint32_t enabled_; - const char *allocProfileString(JSContext *cx, RawScript script, + const char *allocProfileString(JSContext *cx, JSScript *script, JSFunction *function); - void push(const char *string, void *sp, RawScript script, jsbytecode *pc); + void push(const char *string, void *sp, JSScript *script, jsbytecode *pc); void pop(); public: @@ -164,9 +164,9 @@ class SPSProfiler * - exit: this function has ceased execution, and no further * entries/exits will be made */ - bool enter(JSContext *cx, RawScript script, JSFunction *maybeFun); - void exit(JSContext *cx, RawScript script, JSFunction *maybeFun); - void updatePC(RawScript script, jsbytecode *pc) { + bool enter(JSContext *cx, JSScript *script, JSFunction *maybeFun); + void exit(JSContext *cx, JSScript *script, JSFunction *maybeFun); + void updatePC(JSScript *script, jsbytecode *pc) { if (enabled() && *size_ - 1 < max_) { JS_ASSERT(*size_ > 0); JS_ASSERT(stack_[*size_ - 1].script() == script); @@ -203,7 +203,7 @@ class SPSProfiler mjit::PCLengthEntry *pcLengths, mjit::JITChunk *chunk); - jsbytecode *convert(RawScript script, size_t ip); + jsbytecode *convert(JSScript *script, size_t ip); }; struct JMScriptInfo @@ -236,23 +236,23 @@ class SPSProfiler mjit::JSActiveFrame **inlineFrames); void discardMJITCode(mjit::JITScript *jscr, mjit::JITChunk *chunk, void* address); - bool registerICCode(mjit::JITChunk *chunk, RawScript script, jsbytecode* pc, + bool registerICCode(mjit::JITChunk *chunk, JSScript *script, jsbytecode* pc, void *start, size_t size); - jsbytecode *ipToPC(RawScript script, size_t ip); + jsbytecode *ipToPC(JSScript *script, size_t ip); private: JMChunkInfo *registerScript(mjit::JSActiveFrame *frame, mjit::PCLengthEntry *lenths, mjit::JITChunk *chunk); - void unregisterScript(RawScript script, mjit::JITChunk *chunk); + void unregisterScript(JSScript *script, mjit::JITChunk *chunk); public: #else - jsbytecode *ipToPC(RawScript script, size_t ip) { return NULL; } + jsbytecode *ipToPC(JSScript *script, size_t ip) { return NULL; } #endif void setProfilingStack(ProfileEntry *stack, uint32_t *size, uint32_t max); - const char *profileString(JSContext *cx, RawScript script, JSFunction *maybeFun); - void onScriptFinalized(RawScript script); + const char *profileString(JSContext *cx, JSScript *script, JSFunction *maybeFun); + void onScriptFinalized(JSScript *script); /* meant to be used for testing, not recommended to call in normal code */ size_t stringsCount() { return strings.count(); } @@ -378,7 +378,7 @@ class SPSInstrumentation * instrumentation should be emitted. This updates internal state to flag * that further instrumentation should actually be emitted. */ - void setPushed(RawScript script) { + void setPushed(JSScript *script) { if (!enabled()) return; JS_ASSERT(frame->left == 0); @@ -389,7 +389,7 @@ class SPSInstrumentation * Flags entry into a JS function for the first time. Before this is called, * no instrumentation is emitted, but after this instrumentation is emitted. */ - bool push(JSContext *cx, RawScript script, Assembler &masm, Register scratch) { + bool push(JSContext *cx, JSScript *script, Assembler &masm, Register scratch) { if (!enabled()) return true; const char *string = profiler_->profileString(cx, script, @@ -406,7 +406,7 @@ class SPSInstrumentation * sets the current PC to something non-null, however, so as soon as JIT * code is reentered this updates the current pc to NULL. */ - void pushManual(RawScript script, Assembler &masm, Register scratch) { + void pushManual(JSScript *script, Assembler &masm, Register scratch) { if (!enabled()) return; masm.spsUpdatePCIdx(profiler_, ProfileEntry::NullPCIndex, scratch); diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index ec1082e00b71..6d834783cd44 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -88,7 +88,7 @@ StaticScopeIter::block() const return obj->asStaticBlock(); } -RawScript +JSScript * StaticScopeIter::funScript() const { JS_ASSERT(type() == FUNCTION); @@ -1232,7 +1232,7 @@ class DebugScopeProxy : public BaseProxyHandler return false; if (maybeframe) { - RawScript script = maybeframe.script(); + JSScript *script = maybeframe.script(); unsigned local = block->slotToLocalIndex(script->bindings, shape->slot()); if (action == GET) vp.set(maybeframe.unaliasedLocal(local)); diff --git a/js/src/vm/ScopeObject.h b/js/src/vm/ScopeObject.h index 25371461efda..6f78805f5bd6 100644 --- a/js/src/vm/ScopeObject.h +++ b/js/src/vm/ScopeObject.h @@ -72,7 +72,7 @@ class StaticScopeIter Type type() const; StaticBlockObject &block() const; - RawScript funScript() const; + JSScript *funScript() const; }; /*****************************************************************************/ diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp index 29d942afb233..91acc27fb78f 100644 --- a/js/src/vm/SelfHosting.cpp +++ b/js/src/vm/SelfHosting.cpp @@ -707,7 +707,7 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext *cx, Handle na RootedFunction sourceFun(cx, funVal.toObject().toFunction()); RootedScript sourceScript(cx, sourceFun->nonLazyScript()); JS_ASSERT(!sourceScript->enclosingStaticScope()); - RawScript cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript); + JSScript *cscript = CloneScript(cx, NullPtr(), targetFun, sourceScript); if (!cscript) return false; targetFun->setScript(cscript); diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index a925de1e4e9c..1c15be192d4a 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -133,7 +133,7 @@ StackFrame::resetInlinePrev(StackFrame *prevfp, jsbytecode *prevpc) inline void StackFrame::initCallFrame(JSContext *cx, JSFunction &callee, - RawScript script, uint32_t nactual, StackFrame::Flags flagsArg) + JSScript *script, uint32_t nactual, StackFrame::Flags flagsArg) { JS_ASSERT((flagsArg & ~(CONSTRUCTING | LOWERED_CALL_APPLY | @@ -507,7 +507,7 @@ ContextStack::popFrameAfterOverflow() regs.popFrame(fp->actuals() + fp->numActualArgs()); } -inline RawScript +inline JSScript * ContextStack::currentScript(jsbytecode **ppc, MaybeAllowCrossCompartment allowCrossCompartment) const { @@ -536,7 +536,7 @@ ContextStack::currentScript(jsbytecode **ppc, mjit::JITChunk *chunk = fp->jit()->chunk(regs.pc); JS_ASSERT(inlined->inlineIndex < chunk->nInlineFrames); mjit::InlineFrame *frame = &chunk->inlineFrames()[inlined->inlineIndex]; - RawScript script = frame->fun->nonLazyScript(); + JSScript *script = frame->fun->nonLazyScript(); if (!allowCrossCompartment && script->compartment() != cx_->compartment) return NULL; if (ppc) @@ -545,7 +545,7 @@ ContextStack::currentScript(jsbytecode **ppc, } #endif - RawScript script = fp->script(); + JSScript *script = fp->script(); if (!allowCrossCompartment && script->compartment() != cx_->compartment) return NULL; @@ -841,7 +841,7 @@ AbstractFramePtr::isDebuggerFrame() const #endif return false; } -inline RawScript +inline JSScript * AbstractFramePtr::script() const { if (isStackFrame()) diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp index d10dbc13eb65..e2f65495dbac 100644 --- a/js/src/vm/Stack.cpp +++ b/js/src/vm/Stack.cpp @@ -53,7 +53,7 @@ using mozilla::PodCopy; /*****************************************************************************/ void -StackFrame::initExecuteFrame(RawScript script, StackFrame *prevLink, AbstractFramePtr prev, +StackFrame::initExecuteFrame(JSScript *script, StackFrame *prevLink, AbstractFramePtr prev, FrameRegs *regs, const Value &thisv, JSObject &scopeChain, ExecuteType type) { @@ -87,7 +87,7 @@ StackFrame::initExecuteFrame(RawScript script, StackFrame *prevLink, AbstractFra dstvp[0] = NullValue(); exec.script = script; #ifdef DEBUG - u.evalScript = (RawScript)0xbad; + u.evalScript = (JSScript *)0xbad; #endif } diff --git a/js/src/vm/Stack.h b/js/src/vm/Stack.h index ee077c9ee673..c5c2d420ee3c 100644 --- a/js/src/vm/Stack.h +++ b/js/src/vm/Stack.h @@ -292,7 +292,7 @@ class AbstractFramePtr inline bool isFramePushedByExecute() const; inline bool isDebuggerFrame() const; - inline RawScript script() const; + inline JSScript *script() const; inline JSFunction *fun() const; inline JSFunction *maybeFun() const; inline JSFunction *callee() const; @@ -418,12 +418,12 @@ class StackFrame private: mutable uint32_t flags_; /* bits described by Flags */ union { /* describes what code is executing in a */ - RawScript script; /* global frame */ + JSScript *script; /* global frame */ JSFunction *fun; /* function frame, pre GetScopeChain */ } exec; union { /* describes the arguments of a function */ unsigned nactual; /* for non-eval frames */ - RawScript evalScript; /* the script of an eval-in-function */ + JSScript *evalScript; /* the script of an eval-in-function */ } u; mutable JSObject *scopeChain_; /* if HAS_SCOPECHAIN, current scope chain */ StackFrame *prev_; /* if HAS_PREVPC, previous cx->regs->fp */ @@ -485,13 +485,13 @@ class StackFrame /* Used for Invoke, Interpret, trace-jit LeaveTree, and method-jit stubs. */ void initCallFrame(JSContext *cx, JSFunction &callee, - RawScript script, uint32_t nactual, StackFrame::Flags flags); + JSScript *script, uint32_t nactual, StackFrame::Flags flags); /* Used for getFixupFrame (for FixupArity). */ void initFixupFrame(StackFrame *prev, StackFrame::Flags flags, void *ncode, unsigned nactual); /* Used for eval. */ - void initExecuteFrame(RawScript script, StackFrame *prevLink, AbstractFramePtr prev, + void initExecuteFrame(JSScript *script, StackFrame *prevLink, AbstractFramePtr prev, FrameRegs *regs, const Value &thisv, JSObject &scopeChain, ExecuteType type); @@ -760,7 +760,7 @@ class StackFrame * the same VMFrame. Other calls force expansion of the inlined frames. */ - RawScript script() const { + JSScript *script() const { return isFunctionFrame() ? isEvalFrame() ? u.evalScript @@ -1342,7 +1342,7 @@ class FrameRegs } /* For stubs::CompileFunction, ContextStack: */ - void prepareToRun(StackFrame &fp, RawScript script) { + void prepareToRun(StackFrame &fp, JSScript *script) { pc = script->code; sp = fp.slots() + script->nfixed; fp_ = &fp; @@ -1350,7 +1350,7 @@ class FrameRegs } void setToEndOfScript() { - RawScript script = fp()->script(); + JSScript *script = fp()->script(); sp = fp()->base(); pc = script->code + script->length - JSOP_STOP_LENGTH; JS_ASSERT(*pc == JSOP_STOP); @@ -1770,7 +1770,7 @@ class ContextStack DONT_ALLOW_CROSS_COMPARTMENT = false, ALLOW_CROSS_COMPARTMENT = true }; - inline RawScript currentScript(jsbytecode **pc = NULL, + inline JSScript *currentScript(jsbytecode **pc = NULL, MaybeAllowCrossCompartment = DONT_ALLOW_CROSS_COMPARTMENT) const; /* Get the scope chain for the topmost scripted call on the stack. */ @@ -1965,7 +1965,7 @@ class StackIter #endif return data_.state_ == SCRIPTED; } - RawScript script() const { + JSScript *script() const { JS_ASSERT(isScript()); if (data_.state_ == SCRIPTED) return interpFrame()->script();