Commit 24a09874 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix usages of ErrorThrower::Reify

ErrorThrower::Reify() should only be called if an error is actually set.
This CL introduces a Reset() method to replace the obsolete (now
disallowed) usages.

R=mtrofin@chromium.org
BUG=chromium:717056

Change-Id: I41b989a9c7b33591ee26ec6d43540a38289ab54f
Reviewed-on: https://chromium-review.googlesource.com/493506Reviewed-by: 's avatarMircea Trofin <mtrofin@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45039}
parent 63a40cae
......@@ -335,7 +335,7 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
MaybeHandle<Object> maybe_module_object =
wasm::SyncInstantiate(isolate, &thrower, module, ffi_object, memory);
if (maybe_module_object.is_null()) {
thrower.Reify(); // Ensure exceptions do not propagate.
thrower.Reset(); // Ensure exceptions do not propagate.
return MaybeHandle<Object>();
}
DCHECK(!thrower.error());
......
......@@ -180,7 +180,7 @@ void WebAssemblyValidate(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::wasm::SyncValidate(reinterpret_cast<i::Isolate*>(isolate), bytes)) {
return_value.Set(v8::True(isolate));
} else {
if (thrower.wasm_error()) thrower.Reify(); // Clear error.
if (thrower.wasm_error()) thrower.Reset(); // Clear error.
return_value.Set(v8::False(isolate));
}
}
......
......@@ -144,6 +144,11 @@ Handle<Object> ErrorThrower::Reify() {
return exception;
}
void ErrorThrower::Reset() {
error_type_ = kNone;
error_msg_.clear();
}
ErrorThrower::ErrorThrower(ErrorThrower&& other)
: isolate_(other.isolate_),
context_(other.context_),
......
......@@ -114,7 +114,11 @@ class V8_EXPORT_PRIVATE ErrorThrower {
result.error_offset());
}
Handle<Object> Reify();
// Create and return exception object.
MUST_USE_RESULT Handle<Object> Reify();
// Reset any error which was set on this thrower.
void Reset();
bool error() const { return error_type_ != kNone; }
bool wasm_error() { return error_type_ >= kFirstWasmError; }
......
// 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.
// Check that stack overflow inside asm-wasm translation propagates correctly.
function asm() {
'use asm';
return {};
}
function rec() {
asm();
rec();
}
assertThrows(() => rec(), RangeError);
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