Bug 1277562 - Part 5a: Change the meaning of the wasm-baseline switch. r=luke

--HG--
extra : rebase_source : 793eacb33d1901565d2b7b2e84501cc8917a4149
extra : source : 392b626dc954766ac5a077f4cad7ab489fd907aa
This commit is contained in:
Lars T Hansen 2017-02-02 13:22:40 +01:00
Родитель 13cc104eed
Коммит 16a023dd8a
10 изменённых файлов: 33 добавлений и 24 удалений

Просмотреть файл

@ -306,7 +306,7 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
JS::ContextOptions contextOptions;
contextOptions.setAsmJS(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asmjs")))
.setWasm(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm")))
.setWasmAlwaysBaseline(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_baselinejit")))
.setWasmBaseline(GetWorkerPref<bool>(NS_LITERAL_CSTRING("wasm_baselinejit")))
.setThrowOnAsmJSValidationFailure(GetWorkerPref<bool>(
NS_LITERAL_CSTRING("throw_on_asmjs_validation_failure")))
.setBaseline(GetWorkerPref<bool>(NS_LITERAL_CSTRING("baselinejit")))

Просмотреть файл

@ -528,6 +528,14 @@ WasmIsSupported(JSContext* cx, unsigned argc, Value* vp)
return true;
}
static bool
WasmDebuggingIsSupported(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
args.rval().setBoolean(wasm::HasSupport(cx) && cx->options().wasmBaseline());
return true;
}
static bool
WasmTextToBinary(JSContext* cx, unsigned argc, Value* vp)
{
@ -4670,6 +4678,11 @@ gc::ZealModeHelpText),
"wasmIsSupported()",
" Returns a boolean indicating whether WebAssembly is supported on the current device."),
JS_FN_HELP("wasmDebuggingIsSupported", WasmDebuggingIsSupported, 0, 0,
"wasmDebuggingIsSupported()",
" Returns a boolean indicating whether WebAssembly debugging is supported on the current device;\n"
" returns false also if WebAssembly is not supported"),
JS_FN_HELP("wasmTextToBinary", WasmTextToBinary, 1, 0,
"wasmTextToBinary(str)",
" Translates the given text wasm module into its binary encoding."),

Просмотреть файл

@ -1150,7 +1150,7 @@ class JS_PUBLIC_API(ContextOptions) {
ion_(true),
asmJS_(true),
wasm_(false),
wasmAlwaysBaseline_(false),
wasmBaseline_(false),
throwOnAsmJSValidationFailure_(false),
nativeRegExp_(true),
unboxedArrays_(false),
@ -1214,13 +1214,13 @@ class JS_PUBLIC_API(ContextOptions) {
return *this;
}
bool wasmAlwaysBaseline() const { return wasmAlwaysBaseline_; }
ContextOptions& setWasmAlwaysBaseline(bool flag) {
wasmAlwaysBaseline_ = flag;
bool wasmBaseline() const { return wasmBaseline_; }
ContextOptions& setWasmBaseline(bool flag) {
wasmBaseline_ = flag;
return *this;
}
ContextOptions& toggleWasmAlwaysBaseline() {
wasmAlwaysBaseline_ = !wasmAlwaysBaseline_;
ContextOptions& toggleWasmBaseline() {
wasmBaseline_ = !wasmBaseline_;
return *this;
}
@ -1313,7 +1313,7 @@ class JS_PUBLIC_API(ContextOptions) {
bool ion_ : 1;
bool asmJS_ : 1;
bool wasm_ : 1;
bool wasmAlwaysBaseline_ : 1;
bool wasmBaseline_ : 1;
bool throwOnAsmJSValidationFailure_ : 1;
bool nativeRegExp_ : 1;
bool unboxedArrays_ : 1;

Просмотреть файл

@ -263,7 +263,7 @@ static bool enableWasm = false;
static bool enableNativeRegExp = false;
static bool enableUnboxedArrays = false;
static bool enableSharedMemory = SHARED_MEMORY_DEFAULT;
static bool enableWasmAlwaysBaseline = false;
static bool enableWasmBaseline = false;
static bool enableAsyncStacks = false;
static bool enableStreams = false;
#ifdef JS_GC_ZEAL
@ -7811,7 +7811,7 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
enableWasm = !op.getBoolOption("no-wasm");
enableNativeRegExp = !op.getBoolOption("no-native-regexp");
enableUnboxedArrays = op.getBoolOption("unboxed-arrays");
enableWasmAlwaysBaseline = op.getBoolOption("wasm-always-baseline");
enableWasmBaseline = !op.getBoolOption("no-wasm-baseline");
enableAsyncStacks = !op.getBoolOption("no-async-stacks");
enableStreams = op.getBoolOption("enable-streams");
@ -7819,7 +7819,7 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
.setIon(enableIon)
.setAsmJS(enableAsmJS)
.setWasm(enableWasm)
.setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
.setWasmBaseline(enableWasmBaseline)
.setNativeRegExp(enableNativeRegExp)
.setUnboxedArrays(enableUnboxedArrays)
.setAsyncStack(enableAsyncStacks)
@ -8105,7 +8105,7 @@ SetWorkerContextOptions(JSContext* cx)
.setIon(enableIon)
.setAsmJS(enableAsmJS)
.setWasm(enableWasm)
.setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
.setWasmBaseline(enableWasmBaseline)
.setNativeRegExp(enableNativeRegExp)
.setUnboxedArrays(enableUnboxedArrays)
.setStreams(enableStreams);
@ -8301,10 +8301,10 @@ main(int argc, char** argv, char** envp)
|| !op.addBoolOption('\0', "no-ion", "Disable IonMonkey")
|| !op.addBoolOption('\0', "no-asmjs", "Disable asm.js compilation")
|| !op.addBoolOption('\0', "no-wasm", "Disable WebAssembly compilation")
|| !op.addBoolOption('\0', "no-wasm-baseline", "Disable wasm baseline compiler")
|| !op.addBoolOption('\0', "no-native-regexp", "Disable native regexp compilation")
|| !op.addBoolOption('\0', "no-unboxed-objects", "Disable creating unboxed plain objects")
|| !op.addBoolOption('\0', "unboxed-arrays", "Allow creating unboxed arrays")
|| !op.addBoolOption('\0', "wasm-always-baseline", "Enable wasm baseline compiler when possible")
|| !op.addBoolOption('\0', "wasm-check-bce", "Always generate wasm bounds check, even redundant ones.")
|| !op.addBoolOption('\0', "wasm-test-mode", "Enable wasm testing mode, creating synthetic "
"objects for non-canonical NaNs and i64 returned from wasm.")

Просмотреть файл

@ -251,9 +251,9 @@ class JitTest:
elif name == 'test-also-noasmjs':
if options.asmjs_enabled:
test.test_also.append(['--no-asmjs'])
elif name == 'test-also-wasm-baseline':
elif name == 'test-also-no-wasm-baseline':
if options.wasm_enabled:
test.test_also.append(['--wasm-always-baseline'])
test.test_also.append(['--no-wasm-baseline'])
elif name == 'test-also-wasm-check-bce':
if options.wasm_enabled:
test.test_also.append(['--wasm-check-bce'])

Просмотреть файл

@ -25,10 +25,6 @@
* "TODO" indicates an opportunity for a general improvement, with an additional
* tag to indicate the area of improvement. Usually has a bug#.
*
* Unimplemented functionality:
*
* - Tiered compilation (bug 1277562)
*
* There are lots of machine dependencies here but they are pretty well isolated
* to a segment of the compiler. Many dependencies will eventually be factored
* into the MacroAssembler layer and shared with other code generators.

Просмотреть файл

@ -93,7 +93,7 @@ DecodeCodeSection(Decoder& d, ModuleGenerator& mg)
bool
CompileArgs::initFromContext(JSContext* cx, ScriptedCaller&& scriptedCaller)
{
alwaysBaseline = cx->options().wasmAlwaysBaseline();
baselineEnabled = cx->options().wasmBaseline();
// Debug information such as source view or debug traps will require
// additional memory and permanently stay in baseline code, so we try to

Просмотреть файл

@ -39,13 +39,13 @@ struct CompileArgs
{
Assumptions assumptions;
ScriptedCaller scriptedCaller;
bool alwaysBaseline;
bool baselineEnabled;
bool debugEnabled;
CompileArgs(Assumptions&& assumptions, ScriptedCaller&& scriptedCaller)
: assumptions(Move(assumptions)),
scriptedCaller(Move(scriptedCaller)),
alwaysBaseline(false),
baselineEnabled(false),
debugEnabled(false)
{}

Просмотреть файл

@ -143,7 +143,7 @@ ModuleGenerator::initWasm(const CompileArgs& args)
bool canBaseline = BaselineCanCompile();
bool debugEnabled = args.debugEnabled && canBaseline;
tier_ = ((args.alwaysBaseline || debugEnabled) && canBaseline)
tier_ = ((args.baselineEnabled || debugEnabled) && canBaseline)
? Tier::Baseline
: Tier::Ion;

Просмотреть файл

@ -743,7 +743,7 @@ ReloadPrefsCallback(const char* pref, void* data)
.setIon(useIon)
.setAsmJS(useAsmJS)
.setWasm(useWasm)
.setWasmAlwaysBaseline(useWasmBaseline)
.setWasmBaseline(useWasmBaseline)
.setThrowOnAsmJSValidationFailure(throwOnAsmJSValidationFailure)
.setNativeRegExp(useNativeRegExp)
.setAsyncStack(useAsyncStack)