Commit 9fde10eb authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[wasm] Cleanup %IsAsmWasmCode testing predicate.

By now the compiler pipeline will not produce optimized code for asm.js
functions unless validation failed (even when --always-opt is enabled).
The related workaround in the testing predicate can be removed.

R=rmcilroy@chromium.org

Review-Url: https://codereview.chromium.org/2549463002
Cr-Commit-Position: refs/heads/master@{#41614}
parent 890d28f3
...@@ -677,7 +677,9 @@ RUNTIME_FUNCTION(Runtime_InNewSpace) { ...@@ -677,7 +677,9 @@ RUNTIME_FUNCTION(Runtime_InNewSpace) {
return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj)); return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj));
} }
static bool IsAsmWasmCode(Isolate* isolate, Handle<JSFunction> function) { namespace {
bool IsAsmWasmCode(Isolate* isolate, Handle<JSFunction> function) {
if (!function->shared()->HasAsmWasmData()) { if (!function->shared()->HasAsmWasmData()) {
// Doesn't have wasm data. // Doesn't have wasm data.
return false; return false;
...@@ -690,21 +692,18 @@ static bool IsAsmWasmCode(Isolate* isolate, Handle<JSFunction> function) { ...@@ -690,21 +692,18 @@ static bool IsAsmWasmCode(Isolate* isolate, Handle<JSFunction> function) {
return true; return true;
} }
} // namespace
RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) { RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 1); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
// TODO(mstarzinger): --always-opt should still allow asm.js->wasm, return isolate->heap()->ToBoolean(IsAsmWasmCode(isolate, function));
// but currently does not. For now, pretend asm.js->wasm is on for
// this case. Be more accurate once this is corrected.
return isolate->heap()->ToBoolean(
((FLAG_always_opt || FLAG_prepare_always_opt) && FLAG_validate_asm) ||
IsAsmWasmCode(isolate, function));
} }
RUNTIME_FUNCTION(Runtime_IsNotAsmWasmCode) { RUNTIME_FUNCTION(Runtime_IsNotAsmWasmCode) {
SealHandleScope shs(isolate); SealHandleScope shs(isolate);
DCHECK(args.length() == 1); DCHECK_EQ(1, args.length());
CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0); CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
return isolate->heap()->ToBoolean(!IsAsmWasmCode(isolate, function)); return isolate->heap()->ToBoolean(!IsAsmWasmCode(isolate, function));
} }
......
...@@ -4,6 +4,12 @@ ...@@ -4,6 +4,12 @@
// Flags: --validate-asm --allow-natives-syntax // Flags: --validate-asm --allow-natives-syntax
// Note that this test file contains tests that explicitly check modules are
// valid asm.js and then break them with invalid instantiation arguments. If
// this script is run more than once (e.g. --stress-opt) then modules remain
// broken in the second run and assertions would fail. We prevent re-runs.
// Flags: --nostress-opt
function assertValidAsm(func) { function assertValidAsm(func) {
assertTrue(%IsAsmWasmCode(func)); assertTrue(%IsAsmWasmCode(func));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment