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

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
Index: src/asmjs/asm-typer.cc
diff --git a/src/asmjs/asm-typer.cc b/src/asmjs/asm-typer.cc
index 88879ab84d4a190c6954bcecdf41e1543d521e1d..4415c30ac6a32b3c6ea59981e7aaa59d11a8f1bc 100644
--- a/src/asmjs/asm-typer.cc
+++ b/src/asmjs/asm-typer.cc
@@ -326,6 +326,7 @@ AsmTyper::VariableInfo* AsmTyper::ImportLookup(Property* import) {
if (i == stdlib->end()) {
return nullptr;
}
+ stdlib_uses_.insert(i->second->standard_member());
return i->second;
}
@@ -429,7 +430,6 @@ AsmTyper::StandardMember AsmTyper::VariableAsStandardMember(Variable* var) {
return kNone;
}
StandardMember member = var_info->standard_member();
- stdlib_uses_.insert(member);
return member;
}
@@ -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);

Powered by Google App Engine
This is Rietveld 408576698