Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Unified Diff: src/runtime/runtime-test.cc

Issue 2264913002: [wasm] asm.js - Remove Wasm.instantiateModuleFromAsm, use asm.js directly. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-test.cc
diff --git a/src/runtime/runtime-test.cc b/src/runtime/runtime-test.cc
index 37c9362069428a65e2f324ba6491ef117d514e8b..0d6cb0efdd0dc388fe9f62ef2f009c2ba687ae15 100644
--- a/src/runtime/runtime-test.cc
+++ b/src/runtime/runtime-test.cc
@@ -664,21 +664,36 @@ RUNTIME_FUNCTION(Runtime_InNewSpace) {
return isolate->heap()->ToBoolean(isolate->heap()->InNewSpace(obj));
}
-RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) {
- SealHandleScope shs(isolate);
- DCHECK(args.length() == 1);
- CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
-
+static bool IsAsmWasmCode(Isolate* isolate, Handle<JSFunction> function) {
if (!function->shared()->HasAsmWasmData()) {
// Doesn't have wasm data.
- return isolate->heap()->ToBoolean(false);
+ return false;
}
if (function->shared()->code() !=
isolate->builtins()->builtin(Builtins::kInstantiateAsmJs)) {
// Hasn't been compiled yet.
- return isolate->heap()->ToBoolean(false);
+ return false;
}
- return isolate->heap()->ToBoolean(true);
+ return true;
+}
+
+RUNTIME_FUNCTION(Runtime_IsAsmWasmCode) {
+ SealHandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ // TODO(mstarzinger): --always-opt should still allow asm.js->wasm,
+ // 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) {
+ SealHandleScope shs(isolate);
+ DCHECK(args.length() == 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSFunction, function, 0);
+ return isolate->heap()->ToBoolean(!IsAsmWasmCode(isolate, function));
}
#define ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(Name) \
« no previous file with comments | « src/runtime/runtime-compiler.cc ('k') | src/wasm/wasm-js.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698