Skip to content

Commit d66cc11

Browse files
thibaudmichaudV8 LUCI CQ
authored andcommitted
[wasm][eh] Rename exception to tag
The JS API constructor was renamed to "WebAssembly.Tag" to match the spec: WebAssembly/exception-handling#159 Rename "exception" to "tag" throughout the codebase for consistency with the JS API, and to match the spec terminology (e.g. "tag section"). [email protected],[email protected] Bug: v8:11992 Change-Id: I63f9f3101abfeefd49117461bd59c594ca5dab70 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3053583 Reviewed-by: Clemens Backes <[email protected]> Reviewed-by: Nico Hartmann <[email protected]> Commit-Queue: Clemens Backes <[email protected]> Cr-Commit-Position: refs/heads/master@{#75994}
1 parent ce1a9ab commit d66cc11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+448
-470
lines changed

src/compiler/code-assembler.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ class SymbolWrapper;
125125
class Undetectable;
126126
class UniqueName;
127127
class WasmCapiFunctionData;
128-
class WasmExceptionObject;
128+
class WasmTagObject;
129129
class WasmExceptionPackage;
130130
class WasmExceptionTag;
131131
class WasmExportedFunctionData;

src/compiler/types.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Type::bitset BitsetType::Lub(const MapRefLike& map) {
258258
case JS_PROMISE_TYPE:
259259
#if V8_ENABLE_WEBASSEMBLY
260260
case WASM_ARRAY_TYPE:
261-
case WASM_EXCEPTION_OBJECT_TYPE:
261+
case WASM_TAG_OBJECT_TYPE:
262262
case WASM_GLOBAL_OBJECT_TYPE:
263263
case WASM_INSTANCE_OBJECT_TYPE:
264264
case WASM_MEMORY_OBJECT_TYPE:

src/compiler/wasm-compiler.cc

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,20 +2364,19 @@ Node* WasmGraphBuilder::MemoryGrow(Node* input) {
23642364
return diamond_result;
23652365
}
23662366

2367-
Node* WasmGraphBuilder::Throw(uint32_t exception_index,
2368-
const wasm::WasmException* exception,
2367+
Node* WasmGraphBuilder::Throw(uint32_t tag_index, const wasm::WasmTag* tag,
23692368
const base::Vector<Node*> values,
23702369
wasm::WasmCodePosition position) {
23712370
needs_stack_check_ = true;
2372-
uint32_t encoded_size = WasmExceptionPackage::GetEncodedSize(exception);
2371+
uint32_t encoded_size = WasmExceptionPackage::GetEncodedSize(tag);
23732372

23742373
Node* values_array =
23752374
gasm_->CallRuntimeStub(wasm::WasmCode::kWasmAllocateFixedArray,
23762375
gasm_->IntPtrConstant(encoded_size));
23772376
SetSourcePosition(values_array, position);
23782377

23792378
uint32_t index = 0;
2380-
const wasm::WasmExceptionSig* sig = exception->sig;
2379+
const wasm::WasmTagSig* sig = tag->sig;
23812380
MachineOperatorBuilder* m = mcgraph()->machine();
23822381
for (size_t i = 0; i < sig->parameter_count(); ++i) {
23832382
Node* value = values[i];
@@ -2429,7 +2428,7 @@ Node* WasmGraphBuilder::Throw(uint32_t exception_index,
24292428
}
24302429
DCHECK_EQ(encoded_size, index);
24312430

2432-
Node* exception_tag = LoadExceptionTagFromTable(exception_index);
2431+
Node* exception_tag = LoadTagFromTable(tag_index);
24332432

24342433
Node* throw_call = gasm_->CallRuntimeStub(wasm::WasmCode::kWasmThrow,
24352434
exception_tag, values_array);
@@ -2486,11 +2485,10 @@ Node* WasmGraphBuilder::ExceptionTagEqual(Node* caught_tag,
24862485
return gasm_->WordEqual(caught_tag, expected_tag);
24872486
}
24882487

2489-
Node* WasmGraphBuilder::LoadExceptionTagFromTable(uint32_t exception_index) {
2490-
Node* exceptions_table =
2491-
LOAD_INSTANCE_FIELD(ExceptionsTable, MachineType::TaggedPointer());
2492-
Node* tag =
2493-
gasm_->LoadFixedArrayElementPtr(exceptions_table, exception_index);
2488+
Node* WasmGraphBuilder::LoadTagFromTable(uint32_t tag_index) {
2489+
Node* tags_table =
2490+
LOAD_INSTANCE_FIELD(TagsTable, MachineType::TaggedPointer());
2491+
Node* tag = gasm_->LoadFixedArrayElementPtr(tags_table, tag_index);
24942492
return tag;
24952493
}
24962494

@@ -2502,14 +2500,14 @@ Node* WasmGraphBuilder::GetExceptionTag(Node* except_obj) {
25022500
}
25032501

25042502
Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj,
2505-
const wasm::WasmException* exception,
2503+
const wasm::WasmTag* tag,
25062504
base::Vector<Node*> values) {
25072505
Node* values_array = gasm_->CallBuiltin(
25082506
Builtin::kWasmGetOwnProperty, Operator::kEliminatable, except_obj,
25092507
LOAD_ROOT(wasm_exception_values_symbol, wasm_exception_values_symbol),
25102508
LOAD_INSTANCE_FIELD(NativeContext, MachineType::TaggedPointer()));
25112509
uint32_t index = 0;
2512-
const wasm::WasmExceptionSig* sig = exception->sig;
2510+
const wasm::WasmTagSig* sig = tag->sig;
25132511
DCHECK_EQ(sig->parameter_count(), values.size());
25142512
for (size_t i = 0; i < sig->parameter_count(); ++i) {
25152513
Node* value;
@@ -2559,7 +2557,7 @@ Node* WasmGraphBuilder::GetExceptionValues(Node* except_obj,
25592557
}
25602558
values[i] = value;
25612559
}
2562-
DCHECK_EQ(index, WasmExceptionPackage::GetEncodedSize(exception));
2560+
DCHECK_EQ(index, WasmExceptionPackage::GetEncodedSize(tag));
25632561
return values_array;
25642562
}
25652563

src/compiler/wasm-compiler.h

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,14 @@ class WasmGraphBuilder {
266266
Node* Unop(wasm::WasmOpcode opcode, Node* input,
267267
wasm::WasmCodePosition position = wasm::kNoCodePosition);
268268
Node* MemoryGrow(Node* input);
269-
Node* Throw(uint32_t exception_index, const wasm::WasmException* exception,
269+
Node* Throw(uint32_t tag_index, const wasm::WasmTag* tag,
270270
const base::Vector<Node*> values,
271271
wasm::WasmCodePosition position);
272272
Node* Rethrow(Node* except_obj);
273273
Node* ExceptionTagEqual(Node* caught_tag, Node* expected_tag);
274-
Node* LoadExceptionTagFromTable(uint32_t exception_index);
274+
Node* LoadTagFromTable(uint32_t tag_index);
275275
Node* GetExceptionTag(Node* except_obj);
276-
Node* GetExceptionValues(Node* except_obj,
277-
const wasm::WasmException* exception,
276+
Node* GetExceptionValues(Node* except_obj, const wasm::WasmTag* tag,
278277
base::Vector<Node*> values_out);
279278
bool IsPhiWithMerge(Node* phi, Node* merge);
280279
bool ThrowsException(Node* node, Node** if_success, Node** if_exception);

src/diagnostics/objects-printer.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,10 +2076,10 @@ void WasmMemoryObject::WasmMemoryObjectPrint(std::ostream& os) {
20762076
os << "\n";
20772077
}
20782078

2079-
void WasmExceptionObject::WasmExceptionObjectPrint(std::ostream& os) {
2080-
PrintHeader(os, "WasmExceptionObject");
2079+
void WasmTagObject::WasmTagObjectPrint(std::ostream& os) {
2080+
PrintHeader(os, "WasmTagObject");
20812081
os << "\n - serialized_signature: " << Brief(serialized_signature());
2082-
os << "\n - exception_tag: " << Brief(exception_tag());
2082+
os << "\n - tag: " << Brief(tag());
20832083
os << "\n";
20842084
}
20852085

src/objects/contexts.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ enum ContextLookupFlags {
291291
V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \
292292
V(SYMBOL_FUNCTION_INDEX, JSFunction, symbol_function) \
293293
V(WASM_EXPORTED_FUNCTION_MAP_INDEX, Map, wasm_exported_function_map) \
294-
V(WASM_EXCEPTION_CONSTRUCTOR_INDEX, JSFunction, wasm_exception_constructor) \
294+
V(WASM_TAG_CONSTRUCTOR_INDEX, JSFunction, wasm_tag_constructor) \
295295
V(WASM_GLOBAL_CONSTRUCTOR_INDEX, JSFunction, wasm_global_constructor) \
296296
V(WASM_INSTANCE_CONSTRUCTOR_INDEX, JSFunction, wasm_instance_constructor) \
297297
V(WASM_MEMORY_CONSTRUCTOR_INDEX, JSFunction, wasm_memory_constructor) \

src/objects/js-objects.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,8 +2334,8 @@ int JSObject::GetHeaderSize(InstanceType type,
23342334
return WasmTableObject::kHeaderSize;
23352335
case WASM_VALUE_OBJECT_TYPE:
23362336
return WasmValueObject::kHeaderSize;
2337-
case WASM_EXCEPTION_OBJECT_TYPE:
2338-
return WasmExceptionObject::kHeaderSize;
2337+
case WASM_TAG_OBJECT_TYPE:
2338+
return WasmTagObject::kHeaderSize;
23392339
#endif // V8_ENABLE_WEBASSEMBLY
23402340
default: {
23412341
std::stringstream ss;

src/objects/map.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ VisitorId Map::GetVisitorId(Map map) {
286286
case JS_SEGMENTS_TYPE:
287287
#endif // V8_INTL_SUPPORT
288288
#if V8_ENABLE_WEBASSEMBLY
289-
case WASM_EXCEPTION_OBJECT_TYPE:
289+
case WASM_TAG_OBJECT_TYPE:
290290
case WASM_GLOBAL_OBJECT_TYPE:
291291
case WASM_MEMORY_OBJECT_TYPE:
292292
case WASM_MODULE_OBJECT_TYPE:

src/objects/object-list-macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ class ZoneForwardList;
217217
V(UniqueName) \
218218
IF_WASM(V, WasmArray) \
219219
IF_WASM(V, WasmCapiFunctionData) \
220-
IF_WASM(V, WasmExceptionObject) \
220+
IF_WASM(V, WasmTagObject) \
221221
IF_WASM(V, WasmExceptionPackage) \
222222
IF_WASM(V, WasmExportedFunctionData) \
223223
IF_WASM(V, WasmFunctionData) \

src/objects/objects-body-descriptors-inl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ ReturnType BodyDescriptorApply(InstanceType type, T1 p1, T2 p2, T3 p3, T4 p4) {
11331133
case JS_SEGMENTS_TYPE:
11341134
#endif // V8_INTL_SUPPORT
11351135
#if V8_ENABLE_WEBASSEMBLY
1136-
case WASM_EXCEPTION_OBJECT_TYPE:
1136+
case WASM_TAG_OBJECT_TYPE:
11371137
case WASM_GLOBAL_OBJECT_TYPE:
11381138
case WASM_MEMORY_OBJECT_TYPE:
11391139
case WASM_MODULE_OBJECT_TYPE:

0 commit comments

Comments
 (0)