summaryrefslogtreecommitdiffstats
path: root/js/src
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-06-08 21:10:15 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:24 -0400
commit93335c3120968fac165a95978ef0dbdffe7900b4 (patch)
treeb5ce39ff2ef517de3c1f00eba6d7a810983d3aaf /js/src
parent4d88f48fdb51a29fd66001e87a74e2d6a130fe1f (diff)
downloadUXP-93335c3120968fac165a95978ef0dbdffe7900b4.tar
UXP-93335c3120968fac165a95978ef0dbdffe7900b4.tar.gz
UXP-93335c3120968fac165a95978ef0dbdffe7900b4.tar.lz
UXP-93335c3120968fac165a95978ef0dbdffe7900b4.tar.xz
UXP-93335c3120968fac165a95978ef0dbdffe7900b4.zip
1320408 - Part 12: Change JSScript::sourceData to static method.
Diffstat (limited to 'js/src')
-rw-r--r--js/src/jit/BaselineJIT.cpp2
-rw-r--r--js/src/jit/Ion.cpp2
-rw-r--r--js/src/jsapi.cpp5
-rw-r--r--js/src/jsfun.cpp2
-rw-r--r--js/src/jsscript.cpp8
-rw-r--r--js/src/jsscript.h4
-rw-r--r--js/src/jsscriptinlines.h2
-rw-r--r--js/src/vm/Interpreter.cpp2
-rw-r--r--js/src/vm/Stack-inl.h4
9 files changed, 16 insertions, 15 deletions
diff --git a/js/src/jit/BaselineJIT.cpp b/js/src/jit/BaselineJIT.cpp
index d0e297c2d..5c21926b5 100644
--- a/js/src/jit/BaselineJIT.cpp
+++ b/js/src/jit/BaselineJIT.cpp
@@ -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);
diff --git a/js/src/jit/Ion.cpp b/js/src/jit/Ion.cpp
index c61b414e0..b8a2d2fba 100644
--- a/js/src/jit/Ion.cpp
+++ b/js/src/jit/Ion.cpp
@@ -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);
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index e2d572598..4e094adff 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -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*)
diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp
index ea64aabe2..954fd47a0 100644
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -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;
diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp
index 28fb3636c..36060e4c0 100644
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -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*
diff --git a/js/src/jsscript.h b/js/src/jsscript.h
index 2f962ab94..74cefea07 100644
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -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);
diff --git a/js/src/jsscriptinlines.h b/js/src/jsscriptinlines.h
index 205a37f24..e1052111b 100644
--- a/js/src/jsscriptinlines.h
+++ b/js/src/jsscriptinlines.h
@@ -100,7 +100,7 @@ JSScript::functionDelazifying() const
}
inline void
-JSScript::ensureNonLazyCanonicalFunction(JSContext* cx)
+JSScript::ensureNonLazyCanonicalFunction()
{
// Infallibly delazify the canonical script.
JSFunction* fun = function();
diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp
index 097b7b0f3..23a1ad2a5 100644
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -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);
diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h
index 9adea9af5..11a19d175 100644
--- a/js/src/vm/Stack-inl.h
+++ b/js/src/vm/Stack-inl.h
@@ -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();