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

Unified Diff: src/wasm/wasm-module.cc

Issue 2299873002: [wasm] consolidate wasm and asm.js module compilation sequence (Closed)
Patch Set: 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
« src/wasm/wasm-module.h ('K') | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 7a276dfc94e0597c0b6922d2291d7ac00520c0a2..ec881d19f17e7355e5da00c81680d0418bd59629 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1640,6 +1640,25 @@ Handle<JSObject> CreateCompiledModuleObject(
return module_obj;
}
+MaybeHandle<JSObject> CreateModuleObjectFromBytes(
+ Isolate* isolate, const byte* start, const byte* end, ErrorThrower* thrower,
+ bool verify, ModuleOrigin origin) {
+ MaybeHandle<JSObject> nothing;
+ Zone zone(isolate->allocator());
+ ModuleResult result =
+ DecodeWasmModule(isolate, &zone, start, end, verify, origin);
+ std::unique_ptr<const WasmModule> decoded_module(result.val);
+ if (result.failed()) {
+ thrower->Failed("Wasm decoding failed", result);
+ return nothing;
+ }
+ MaybeHandle<FixedArray> compiled_module =
+ decoded_module->CompileFunctions(isolate, thrower);
+ if (compiled_module.is_null()) return nothing;
+
+ return CreateCompiledModuleObject(isolate, compiled_module.ToHandleChecked());
+}
+
namespace testing {
int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
« src/wasm/wasm-module.h ('K') | « src/wasm/wasm-module.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698