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

Unified Diff: src/asmjs/asm-typer.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/asmjs/asm-js.cc ('k') | src/asmjs/asm-wasm-builder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-typer.cc
diff --git a/src/asmjs/asm-typer.cc b/src/asmjs/asm-typer.cc
index 01c8caed6e1eb2c0a8988f0c65a4d29d4a125f52..4415c30ac6a32b3c6ea59981e7aaa59d11a8f1bc 100644
--- a/src/asmjs/asm-typer.cc
+++ b/src/asmjs/asm-typer.cc
@@ -597,7 +597,21 @@ AsmType* AsmTyper::ValidateModule(FunctionLiteral* fun) {
ZoneVector<Assignment*> function_pointer_tables(zone_);
FlattenedStatements iter(zone_, fun->body());
auto* use_asm_directive = iter.Next();
- if (use_asm_directive == nullptr || !IsUseAsmDirective(use_asm_directive)) {
+ if (use_asm_directive == nullptr) {
+ FAIL(fun, "Missing \"use asm\".");
+ }
+ // Check for extra assignment inserted by the parser when in this form:
+ // (function Module(a, b, c) {... })
+ ExpressionStatement* estatement = use_asm_directive->AsExpressionStatement();
+ if (estatement != nullptr) {
+ Assignment* assignment = estatement->expression()->AsAssignment();
+ if (assignment != nullptr && assignment->target()->IsVariableProxy() &&
+ assignment->target()->AsVariableProxy()->var()->mode() ==
+ CONST_LEGACY) {
+ use_asm_directive = iter.Next();
+ }
+ }
+ if (!IsUseAsmDirective(use_asm_directive)) {
FAIL(fun, "Missing \"use asm\".");
}
source_layout.AddUseAsm(*use_asm_directive);
« no previous file with comments | « src/asmjs/asm-js.cc ('k') | src/asmjs/asm-wasm-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698