Skip to content

Commit e7ccf0a

Browse files
thibaudmichaudV8 LUCI CQ
authored andcommitted
[wasm] Fix default externref/exnref reference
- The default nullexternref should be null instead of undefined - The default exnref/nullexnref should be null instead of wasm_null R=mliedtke@chromium.org Fixed: 372285204,372269618 Change-Id: Id5addce2b196f7ba81aac3c2dd9447a91ed2ce2b Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5922878 Commit-Queue: Thibaud Michaud <thibaudm@chromium.org> Reviewed-by: Matthias Liedtke <mliedtke@chromium.org> Cr-Commit-Position: refs/heads/main@{#96531}
1 parent 414c594 commit e7ccf0a

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎src/wasm/wasm-js.cc‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,9 +1385,12 @@ i::Handle<i::HeapObject> DefaultReferenceValue(i::Isolate* isolate,
13851385
DCHECK(type.is_object_reference());
13861386
// Use undefined for JS type (externref) but null for wasm types as wasm does
13871387
// not know undefined.
1388-
if (type.heap_representation() == i::wasm::HeapType::kExtern ||
1389-
type.heap_representation() == i::wasm::HeapType::kNoExtern) {
1388+
if (type.heap_representation() == i::wasm::HeapType::kExtern) {
13901389
return isolate->factory()->undefined_value();
1390+
} else if (type.heap_representation() == i::wasm::HeapType::kNoExtern ||
1391+
type.heap_representation() == i::wasm::HeapType::kExn ||
1392+
type.heap_representation() == i::wasm::HeapType::kNoExn) {
1393+
return isolate->factory()->null_value();
13911394
}
13921395
return isolate->factory()->wasm_null();
13931396
}

0 commit comments

Comments
 (0)