mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-06 15:58:39 +09:00
1320408 - Part 12: Change JSScript::sourceData to static method.
This commit is contained in:
parent
56a4517a1f
commit
d208cccd10
9 changed files with 16 additions and 15 deletions
|
|
@ -273,7 +273,7 @@ jit::BaselineCompile(JSContext* cx, JSScript* script, bool forceDebugInstrumenta
|
|||
MOZ_ASSERT(script->canBaselineCompile());
|
||||
MOZ_ASSERT(IsBaselineEnabled(cx));
|
||||
|
||||
script->ensureNonLazyCanonicalFunction(cx);
|
||||
script->ensureNonLazyCanonicalFunction();
|
||||
|
||||
LifoAlloc alloc(TempAllocator::PreferredLifoChunkSize);
|
||||
TempAllocator* temp = alloc.new_<TempAllocator>(&alloc);
|
||||
|
|
|
|||
|
|
@ -2153,7 +2153,7 @@ IonCompile(JSContext* cx, JSScript* script,
|
|||
|
||||
// Make sure the script's canonical function isn't lazy. We can't de-lazify
|
||||
// it in a helper thread.
|
||||
script->ensureNonLazyCanonicalFunction(cx);
|
||||
script->ensureNonLazyCanonicalFunction();
|
||||
|
||||
TrackPropertiesForSingletonScopes(cx, script, baselineFrame);
|
||||
|
||||
|
|
|
|||
|
|
@ -4405,14 +4405,15 @@ JS_DecompileScript(JSContext* cx, HandleScript script, const char* name, unsigne
|
|||
|
||||
AssertHeapIsIdle(cx);
|
||||
CHECK_REQUEST(cx);
|
||||
script->ensureNonLazyCanonicalFunction(cx);
|
||||
script->ensureNonLazyCanonicalFunction();
|
||||
RootedFunction fun(cx, script->functionNonDelazifying());
|
||||
if (fun)
|
||||
return JS_DecompileFunction(cx, fun, indent);
|
||||
bool haveSource = script->scriptSource()->hasSourceData();
|
||||
if (!haveSource && !JSScript::loadSource(cx, script->scriptSource(), &haveSource))
|
||||
return nullptr;
|
||||
return haveSource ? script->sourceData(cx) : NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
return haveSource ? JSScript::sourceData(cx, script)
|
||||
: NewStringCopyZ<CanGC>(cx, "[no source]");
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(JSString*)
|
||||
|
|
|
|||
|
|
@ -973,7 +973,7 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
|
|||
};
|
||||
|
||||
if (haveSource) {
|
||||
Rooted<JSFlatString*> src(cx, script->sourceDataWithPrelude(cx));
|
||||
Rooted<JSFlatString*> src(cx, JSScript::sourceDataWithPrelude(cx, script));
|
||||
if (!src)
|
||||
return nullptr;
|
||||
|
||||
|
|
|
|||
|
|
@ -1435,11 +1435,11 @@ JSScript::loadSource(JSContext* cx, ScriptSource* ss, bool* worked)
|
|||
return true;
|
||||
}
|
||||
|
||||
JSFlatString*
|
||||
JSScript::sourceData(JSContext* cx)
|
||||
/* static */ JSFlatString*
|
||||
JSScript::sourceData(JSContext* cx, HandleScript script)
|
||||
{
|
||||
MOZ_ASSERT(scriptSource()->hasSourceData());
|
||||
return scriptSource()->substring(cx, sourceStart(), sourceEnd());
|
||||
MOZ_ASSERT(script->scriptSource()->hasSourceData());
|
||||
return script->scriptSource()->substring(cx, script->sourceStart(), script->sourceEnd());
|
||||
}
|
||||
|
||||
JSFlatString*
|
||||
|
|
|
|||
|
|
@ -1499,7 +1499,7 @@ class JSScript : public js::gc::TenuredCell
|
|||
* De-lazifies the canonical function. Must be called before entering code
|
||||
* that expects the function to be non-lazy.
|
||||
*/
|
||||
inline void ensureNonLazyCanonicalFunction(JSContext* cx);
|
||||
inline void ensureNonLazyCanonicalFunction();
|
||||
|
||||
js::ModuleObject* module() const {
|
||||
if (bodyScope()->is<js::ModuleScope>())
|
||||
|
|
@ -1518,7 +1518,7 @@ class JSScript : public js::gc::TenuredCell
|
|||
// directly, via lazy arguments or a rest parameter.
|
||||
bool mayReadFrameArgsDirectly();
|
||||
|
||||
JSFlatString* sourceData(JSContext* cx);
|
||||
static JSFlatString* sourceData(JSContext* cx, JS::HandleScript script);
|
||||
JSFlatString* sourceDataWithPrelude(JSContext* cx);
|
||||
|
||||
static bool loadSource(JSContext* cx, js::ScriptSource* ss, bool* worked);
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ JSScript::functionDelazifying() const
|
|||
}
|
||||
|
||||
inline void
|
||||
JSScript::ensureNonLazyCanonicalFunction(JSContext* cx)
|
||||
JSScript::ensureNonLazyCanonicalFunction()
|
||||
{
|
||||
// Infallibly delazify the canonical script.
|
||||
JSFunction* fun = function();
|
||||
|
|
|
|||
|
|
@ -373,7 +373,7 @@ js::RunScript(JSContext* cx, RunState& state)
|
|||
|
||||
SPSEntryMarker marker(cx->runtime(), state.script());
|
||||
|
||||
state.script()->ensureNonLazyCanonicalFunction(cx);
|
||||
state.script()->ensureNonLazyCanonicalFunction();
|
||||
|
||||
if (jit::IsIonEnabled(cx)) {
|
||||
jit::MethodStatus status = jit::CanEnter(cx, state);
|
||||
|
|
|
|||
|
|
@ -306,7 +306,7 @@ InterpreterStack::pushInlineFrame(JSContext* cx, InterpreterRegs& regs, const Ca
|
|||
MOZ_ASSERT(regs.sp == args.end());
|
||||
MOZ_ASSERT(callee->nonLazyScript() == script);
|
||||
|
||||
script->ensureNonLazyCanonicalFunction(cx);
|
||||
script->ensureNonLazyCanonicalFunction();
|
||||
|
||||
InterpreterFrame* prev = regs.fp();
|
||||
jsbytecode* prevpc = regs.pc;
|
||||
|
|
@ -342,7 +342,7 @@ InterpreterStack::resumeGeneratorCallFrame(JSContext* cx, InterpreterRegs& regs,
|
|||
Value* prevsp = regs.sp;
|
||||
MOZ_ASSERT(prev);
|
||||
|
||||
script->ensureNonLazyCanonicalFunction(cx);
|
||||
script->ensureNonLazyCanonicalFunction();
|
||||
|
||||
LifoAlloc::Mark mark = allocator_.mark();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue