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

Side by Side Diff: src/typing-asm.cc

Issue 1564313003: [wasm] Fix validation error for missing return statement in asm.js module. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-575364.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/typing-asm.h" 7 #include "src/typing-asm.h"
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopes.h" 10 #include "src/ast/scopes.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 RECURSE( 120 RECURSE(
121 VisitWithExpectation(decl->fun(), Type::Any(zone()), "UNREACHABLE")); 121 VisitWithExpectation(decl->fun(), Type::Any(zone()), "UNREACHABLE"));
122 if (!computed_type_->IsFunction()) { 122 if (!computed_type_->IsFunction()) {
123 FAIL(decl->fun(), "function literal expected to be a function"); 123 FAIL(decl->fun(), "function literal expected to be a function");
124 } 124 }
125 } 125 }
126 } 126 }
127 127
128 // Validate exports. 128 // Validate exports.
129 ReturnStatement* stmt = fun->body()->last()->AsReturnStatement(); 129 ReturnStatement* stmt = fun->body()->last()->AsReturnStatement();
130 if (stmt == nullptr) {
131 FAIL(fun->body()->last(), "last statement in module is not a return");
132 }
130 RECURSE(VisitWithExpectation(stmt->expression(), Type::Object(), 133 RECURSE(VisitWithExpectation(stmt->expression(), Type::Object(),
131 "expected object export")); 134 "expected object export"));
132 } 135 }
133 136
134 137
135 void AsmTyper::VisitVariableDeclaration(VariableDeclaration* decl) { 138 void AsmTyper::VisitVariableDeclaration(VariableDeclaration* decl) {
136 Variable* var = decl->proxy()->var(); 139 Variable* var = decl->proxy()->var();
137 if (var->location() != VariableLocation::PARAMETER) { 140 if (var->location() != VariableLocation::PARAMETER) {
138 if (GetType(var) == NULL) { 141 if (GetType(var) == NULL) {
139 SetType(var, Type::Any(zone())); 142 SetType(var, Type::Any(zone()));
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 1452
1450 1453
1451 void AsmTyper::VisitRewritableAssignmentExpression( 1454 void AsmTyper::VisitRewritableAssignmentExpression(
1452 RewritableAssignmentExpression* expr) { 1455 RewritableAssignmentExpression* expr) {
1453 RECURSE(Visit(expr->expression())); 1456 RECURSE(Visit(expr->expression()));
1454 } 1457 }
1455 1458
1456 1459
1457 } // namespace internal 1460 } // namespace internal
1458 } // namespace v8 1461 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-575364.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698