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

Unified Diff: src/asmjs/asm-js.cc

Issue 2299873002: [wasm] consolidate wasm and asm.js module compilation sequence (Closed)
Patch Set: [wasm] consolidate wasm and asm.js module compilation sequence Created 4 years, 3 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/api.cc ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-js.cc
diff --git a/src/asmjs/asm-js.cc b/src/asmjs/asm-js.cc
index e94d91730e558b5da3d9db28956c9c9ac706bdc2..de39e204492fabe97b5ff4f66fd7e3378bd40c99 100644
--- a/src/asmjs/asm-js.cc
+++ b/src/asmjs/asm-js.cc
@@ -30,29 +30,6 @@ namespace v8 {
namespace internal {
namespace {
-i::MaybeHandle<i::FixedArray> CompileModule(
- i::Isolate* isolate, const byte* start, const byte* end,
- ErrorThrower* thrower,
- internal::wasm::ModuleOrigin origin = i::wasm::kWasmOrigin) {
- // Decode but avoid a redundant pass over function bodies for verification.
- // Verification will happen during compilation.
- i::Zone zone(isolate->allocator());
- internal::wasm::ModuleResult result = internal::wasm::DecodeWasmModule(
- isolate, &zone, start, end, false, origin);
-
- i::MaybeHandle<i::FixedArray> compiled_module;
- if (result.failed() && origin == internal::wasm::kAsmJsOrigin) {
- thrower->Error("Asm.js converted module failed to decode");
- } else if (result.failed()) {
- thrower->Failed("", result);
- } else {
- compiled_module = result.val->CompileFunctions(isolate, thrower);
- }
-
- if (result.val) delete result.val;
- return compiled_module;
-}
-
Handle<i::Object> StdlibMathMember(i::Isolate* isolate,
Handle<JSReceiver> stdlib,
Handle<Name> name) {
@@ -187,9 +164,9 @@ MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) {
i::Handle<i::FixedArray> foreign_globals;
auto module = builder.Run(&foreign_globals);
- i::MaybeHandle<i::FixedArray> compiled =
- CompileModule(info->isolate(), module->begin(), module->end(), &thrower,
- internal::wasm::kAsmJsOrigin);
+ i::MaybeHandle<i::JSObject> compiled = wasm::CreateModuleObjectFromBytes(
+ info->isolate(), module->begin(), module->end(), &thrower,
+ internal::wasm::kAsmJsOrigin);
DCHECK(!compiled.is_null());
wasm::AsmTyper::StdlibSet uses = typer.StdlibUses();
@@ -223,7 +200,9 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(i::Isolate* isolate,
Handle<FixedArray> wasm_data,
Handle<JSArrayBuffer> memory,
Handle<JSReceiver> foreign) {
- i::Handle<i::FixedArray> compiled(i::FixedArray::cast(wasm_data->get(0)));
+ i::Handle<i::JSObject> module(i::JSObject::cast(wasm_data->get(0)));
+ i::Handle<i::FixedArray> compiled(
+ i::FixedArray::cast(module->GetInternalField(0)));
i::Handle<i::FixedArray> foreign_globals(
i::FixedArray::cast(wasm_data->get(1)));
« no previous file with comments | « src/api.cc ('k') | src/runtime/runtime-test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698