Commit 1b690f43 authored by rossberg's avatar rossberg Committed by Commit bot

[wasm] W.validate should not throw on failure

R=titzer@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2640113005
Cr-Commit-Position: refs/heads/master@{#42556}
parent 0659898b
......@@ -159,6 +159,7 @@ void WebAssemblyValidate(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (ValidateModule(isolate, args[0], &thrower)) {
return_value.Set(v8::True(isolate));
} else {
if (thrower.wasm_error()) thrower.Reify(); // Clear error.
return_value.Set(v8::False(isolate));
}
}
......
......@@ -64,6 +64,7 @@ void ErrorThrower::RangeError(const char* format, ...) {
void ErrorThrower::CompileError(const char* format, ...) {
if (error()) return;
wasm_error_ = true;
va_list arguments;
va_start(arguments, format);
Format(isolate_->wasm_compile_error_function(), format, arguments);
......@@ -72,6 +73,7 @@ void ErrorThrower::CompileError(const char* format, ...) {
void ErrorThrower::LinkError(const char* format, ...) {
if (error()) return;
wasm_error_ = true;
va_list arguments;
va_start(arguments, format);
Format(isolate_->wasm_link_error_function(), format, arguments);
......@@ -80,6 +82,7 @@ void ErrorThrower::LinkError(const char* format, ...) {
void ErrorThrower::RuntimeError(const char* format, ...) {
if (error()) return;
wasm_error_ = true;
va_list arguments;
va_start(arguments, format);
Format(isolate_->wasm_runtime_error_function(), format, arguments);
......
......@@ -112,6 +112,7 @@ class V8_EXPORT_PRIVATE ErrorThrower {
}
bool error() const { return !exception_.is_null(); }
bool wasm_error() { return wasm_error_; }
private:
void Format(i::Handle<i::JSFunction> constructor, const char* fmt, va_list);
......@@ -119,6 +120,7 @@ class V8_EXPORT_PRIVATE ErrorThrower {
i::Isolate* isolate_;
const char* context_;
i::Handle<i::Object> exception_;
bool wasm_error_ = false;
};
} // namespace wasm
} // namespace internal
......
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