зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1564927 - Move off-thread API for BinAST to the right header. r=jwalden
Also reorder functions in OffThreadScriptCompilation to group by data source type. Differential Revision: https://phabricator.services.mozilla.com/D37575 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
1e2404a275
Коммит
8df08d5f7d
|
@ -40,12 +40,6 @@ class OffThreadToken;
|
|||
using OffThreadCompileCallback = void (*)(OffThreadToken* token,
|
||||
void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API bool CanCompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
/*
|
||||
* Off thread compilation control flow.
|
||||
*
|
||||
|
@ -63,6 +57,9 @@ extern JS_PUBLIC_API bool CanDecodeOffThread(
|
|||
* to FinishOffThreadScript.
|
||||
*/
|
||||
|
||||
extern JS_PUBLIC_API bool CanCompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CompileOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
SourceText<char16_t>& srcBuf, OffThreadCompileCallback callback,
|
||||
|
@ -103,6 +100,9 @@ extern JS_PUBLIC_API JSObject* FinishOffThreadModule(JSContext* cx,
|
|||
extern JS_PUBLIC_API void CancelOffThreadModule(JSContext* cx,
|
||||
OffThreadToken* token);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeOffThreadScript(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
mozilla::Vector<uint8_t>& buffer /* TranscodeBuffer& */, size_t cursor,
|
||||
|
@ -136,6 +136,13 @@ extern JS_PUBLIC_API void CancelMultiOffThreadScriptsDecoder(
|
|||
extern JS_PUBLIC_API bool CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API JSScript* FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, OffThreadToken* token);
|
||||
|
||||
#endif // defined(JS_BUILD_BINAST)
|
||||
|
||||
} // namespace JS
|
||||
|
|
|
@ -3626,19 +3626,6 @@ JSScript* JS::DecodeBinAST(JSContext* cx, const ReadOnlyCompileOptions& options,
|
|||
return DecodeBinAST(cx, options, fileContents.begin(), fileContents.length());
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData) {
|
||||
return StartOffThreadDecodeBinAST(cx, options, buf, length, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
|
||||
return HelperThreadState().finishBinASTDecodeTask(cx, token);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API JSObject* JS_GetGlobalFromScript(JSScript* script) {
|
||||
|
|
|
@ -1974,16 +1974,6 @@ extern JS_PUBLIC_API JSScript* DecodeBinAST(
|
|||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length);
|
||||
|
||||
extern JS_PUBLIC_API bool DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData);
|
||||
|
||||
extern JS_PUBLIC_API JSScript* FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, OffThreadToken* token);
|
||||
|
||||
} /* namespace JS */
|
||||
|
||||
#endif /* JS_BUILD_BINAST */
|
||||
|
|
|
@ -70,19 +70,6 @@ JS_PUBLIC_API bool JS::CanCompileOffThread(
|
|||
return CanDoOffThread(cx, options, length, OffThread::Compile);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::Decode);
|
||||
}
|
||||
|
||||
#ifdef JS_BUILD_BINAST
|
||||
JS_PUBLIC_API bool JS::CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::DecodeBinAST);
|
||||
}
|
||||
#endif
|
||||
|
||||
JS_PUBLIC_API bool JS::CompileOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
JS::SourceText<char16_t>& srcBuf,
|
||||
|
@ -147,6 +134,12 @@ JS_PUBLIC_API void JS::CancelOffThreadModule(JSContext* cx,
|
|||
token);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeOffThread(JSContext* cx,
|
||||
const ReadOnlyCompileOptions& options,
|
||||
size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::Decode);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeOffThreadScript(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
mozilla::Vector<uint8_t>& buffer /* TranscodeBuffer& */, size_t cursor,
|
||||
|
@ -164,21 +157,6 @@ JS_PUBLIC_API bool JS::DecodeOffThreadScript(
|
|||
return StartOffThreadDecodeScript(cx, options, range, callback, callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeMultiOffThreadScripts(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
TranscodeSources& sources, OffThreadCompileCallback callback,
|
||||
void* callbackData) {
|
||||
#ifdef DEBUG
|
||||
size_t length = 0;
|
||||
for (auto& source : sources) {
|
||||
length += source.range.length();
|
||||
}
|
||||
MOZ_ASSERT(CanCompileOffThread(cx, options, length));
|
||||
#endif
|
||||
return StartOffThreadDecodeMultiScripts(cx, options, sources, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadScriptDecoder(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
|
@ -194,6 +172,21 @@ JS_PUBLIC_API void JS::CancelOffThreadScriptDecoder(JSContext* cx,
|
|||
ParseTaskKind::ScriptDecode, token);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeMultiOffThreadScripts(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options,
|
||||
TranscodeSources& sources, OffThreadCompileCallback callback,
|
||||
void* callbackData) {
|
||||
#ifdef DEBUG
|
||||
size_t length = 0;
|
||||
for (auto& source : sources) {
|
||||
length += source.range.length();
|
||||
}
|
||||
MOZ_ASSERT(CanCompileOffThread(cx, options, length));
|
||||
#endif
|
||||
return StartOffThreadDecodeMultiScripts(cx, options, sources, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::FinishMultiOffThreadScriptsDecoder(
|
||||
JSContext* cx, JS::OffThreadToken* token,
|
||||
MutableHandle<ScriptVector> scripts) {
|
||||
|
@ -209,3 +202,26 @@ JS_PUBLIC_API void JS::CancelMultiOffThreadScriptsDecoder(
|
|||
HelperThreadState().cancelParseTask(cx->runtime(),
|
||||
ParseTaskKind::MultiScriptsDecode, token);
|
||||
}
|
||||
|
||||
#ifdef JS_BUILD_BINAST
|
||||
|
||||
JS_PUBLIC_API bool JS::CanDecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, size_t length) {
|
||||
return CanDoOffThread(cx, options, length, OffThread::DecodeBinAST);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::DecodeBinASTOffThread(
|
||||
JSContext* cx, const ReadOnlyCompileOptions& options, const uint8_t* buf,
|
||||
size_t length, OffThreadCompileCallback callback, void* callbackData) {
|
||||
return StartOffThreadDecodeBinAST(cx, options, buf, length, callback,
|
||||
callbackData);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API JSScript* JS::FinishOffThreadBinASTDecode(
|
||||
JSContext* cx, JS::OffThreadToken* token) {
|
||||
MOZ_ASSERT(cx);
|
||||
MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
|
||||
return HelperThreadState().finishBinASTDecodeTask(cx, token);
|
||||
}
|
||||
|
||||
#endif // JS_BUILD_BINAST
|
||||
|
|
Загрузка…
Ссылка в новой задаче