Commit ded9d22a authored by Stephan Herhut's avatar Stephan Herhut Committed by Commit Bot

[wasm] Add extra DCHECK to ensure pending exception

When module instantiation fails, we need to throw an exception or raise
an error additionally to just returning an empty handle. This change
adds an extra DCHECK to make sure this is not forgotten.

Bug: v8:8015
Change-Id: Ib5d580ccfa2fb689e01c2bdabe856c8c4a47a853
Reviewed-on: https://chromium-review.googlesource.com/1233259Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Stephan Herhut <herhut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56026}
parent baa9bf19
......@@ -341,6 +341,7 @@ MaybeHandle<WasmInstanceObject> InstantiateToInstanceObject(
if (!instance.is_null() && builder.ExecuteStartFunction()) {
return instance;
}
DCHECK(isolate->has_pending_exception() || thrower->error());
return {};
}
......@@ -993,7 +994,11 @@ MaybeHandle<WasmInstanceObject> InstanceBuilder::Build() {
// (e.g. https://crbug.com/769637).
// Allocate memory if the initial size is more than 0 pages.
memory_ = AllocateMemory(initial_pages);
if (memory_.is_null()) return {}; // failed to allocate memory
if (memory_.is_null()) {
// failed to allocate memory
DCHECK(isolate_->has_pending_exception() || thrower_->error());
return {};
}
}
//--------------------------------------------------------------------------
......
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