Commit 5c8022e6 authored by bradnelson's avatar bradnelson Committed by Commit bot

[wasm][asm.js] Cancel exception and rethrow on parse failure.

BUG=674089
R=marja@chromium.org

Review-Url: https://codereview.chromium.org/2614563002
Cr-Commit-Position: refs/heads/master@{#42440}
parent 48eabdcf
......@@ -573,6 +573,8 @@ bool AsmTyper::ValidateAfterFunctionsPhase() {
void AsmTyper::ClearFunctionNodeTypes() { function_node_types_.clear(); }
AsmType* AsmTyper::TriggerParsingError() { FAIL(root_, "Parsing error"); }
namespace {
bool IsUseAsmDirective(Statement* first_statement) {
ExpressionStatement* use_asm = first_statement->AsExpressionStatement();
......
......@@ -82,6 +82,8 @@ class AsmTyper final {
Handle<JSMessageObject> error_message() const { return error_message_; }
const MessageLocation* message_location() const { return &message_location_; }
AsmType* TriggerParsingError();
AsmType* TypeOf(AstNode* node) const;
AsmType* TypeOf(Variable* v) const;
StandardMember VariableAsStandardMember(Variable* var);
......
......@@ -163,6 +163,11 @@ class AsmWasmBuilderImpl final : public AstVisitor<AsmWasmBuilderImpl> {
info.zone(), decl->fun()->scope()->outer_scope(), FUNCTION_SCOPE);
info.set_asm_function_scope(new_func_scope);
if (!Compiler::ParseAndAnalyze(&info)) {
decl->fun()->scope()->outer_scope()->RemoveInnerScope(new_func_scope);
if (isolate_->has_pending_exception()) {
isolate_->clear_pending_exception();
}
typer_->TriggerParsingError();
typer_failed_ = true;
return;
}
......
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --validate-asm --ignition-staging
function outer() {
"use asm";
function inner() {
switch (1) {
case 0:
break foo;
}
}
}
outer();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment