Skip to content

Commit

Permalink
[asm.js] Improve error reporting of internal failures.
Browse files Browse the repository at this point in the history
R=sigurds@chromium.org

Change-Id: I54df6ab72a3d6836be15d4a26b8a1615628eb872
Reviewed-on: https://chromium-review.googlesource.com/1163703
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54935}
  • Loading branch information
Michael Starzinger authored and Commit Bot committed Aug 7, 2018
1 parent 28a480e commit d28af94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/asmjs/asm-js.cc
Expand Up @@ -392,8 +392,14 @@ MaybeHandle<Object> AsmJs::InstantiateAsmWasm(Isolate* isolate,
// An exception caused by the module start function will be set as pending
// and bypass the {ErrorThrower}, this happens in case of a stack overflow.
if (isolate->has_pending_exception()) isolate->clear_pending_exception();
if (thrower.error()) {
ScopedVector<char> error_reason(100);
SNPrintF(error_reason, "Internal wasm failure: %s", thrower.error_msg());
ReportInstantiationFailure(script, position, error_reason.start());
} else {
ReportInstantiationFailure(script, position, "Internal wasm failure");
}
thrower.Reset(); // Ensure exceptions do not propagate.
ReportInstantiationFailure(script, position, "Internal wasm failure");
return MaybeHandle<Object>();
}
DCHECK(!thrower.error());
Expand Down
1 change: 1 addition & 0 deletions src/wasm/wasm-result.h
Expand Up @@ -123,6 +123,7 @@ class V8_EXPORT_PRIVATE ErrorThrower {

bool error() const { return error_type_ != kNone; }
bool wasm_error() { return error_type_ >= kFirstWasmError; }
const char* error_msg() { return error_msg_.c_str(); }

Isolate* isolate() const { return isolate_; }

Expand Down

0 comments on commit d28af94

Please sign in to comment.