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

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

Issue 2398023002: [wasm] asm.js - Parse and convert asm.js to wasm a function at a time. (Closed)
Patch Set: Created 4 years, 2 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 | « no previous file | src/asmjs/asm-typer.h » ('j') | src/asmjs/asm-typer.h » ('J')
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 a1af1af368c838eadebfc60c400946d527087928..cd68a5e0209bd470bc6f9aafc11cc8a1ca9dcf40 100644
--- a/src/asmjs/asm-js.cc
+++ b/src/asmjs/asm-js.cc
@@ -152,24 +152,23 @@ bool IsStdlibMemberValid(i::Isolate* isolate, Handle<JSReceiver> stdlib,
MaybeHandle<FixedArray> AsmJs::ConvertAsmToWasm(ParseInfo* info) {
ErrorThrower thrower(info->isolate(), "Asm.js -> WebAssembly conversion");
- wasm::AsmTyper typer(info->isolate(), info->zone(), *(info->script()),
- info->literal());
- if (!typer.Validate()) {
- DCHECK(!info->isolate()->has_pending_exception());
- PrintF("Validation of asm.js module failed: %s", typer.error_message());
- return MaybeHandle<FixedArray>();
- }
v8::internal::wasm::AsmWasmBuilder builder(info->isolate(), info->zone(),
- info->literal(), &typer);
+ *info->script(), info->literal());
i::Handle<i::FixedArray> foreign_globals;
auto module = builder.Run(&foreign_globals);
+ if (module == nullptr) {
+ DCHECK(!info->isolate()->has_pending_exception());
+ PrintF("Validation of asm.js module failed: %s",
+ builder.typer()->error_message());
+ return MaybeHandle<FixedArray>();
+ }
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();
+ wasm::AsmTyper::StdlibSet uses = builder.typer()->StdlibUses();
Handle<FixedArray> uses_array =
info->isolate()->factory()->NewFixedArray(static_cast<int>(uses.size()));
int count = 0;
« no previous file with comments | « no previous file | src/asmjs/asm-typer.h » ('j') | src/asmjs/asm-typer.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698