Commit 2fc49978 authored by Manos Koukoutos's avatar Manos Koukoutos Committed by Commit Bot

[wasm] Remove dependency of ValueType functions from Kind enum order

Change-Id: I04902e3f91dae6083b3de7630fd91d49ad805a2a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2272565
Commit-Queue: Manos Koukoutos <manoskouk@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68602}
parent 603c319f
...@@ -26,15 +26,18 @@ class Simd128; ...@@ -26,15 +26,18 @@ class Simd128;
// - "ref"/"optref" (a.k.a. "ref null") per // - "ref"/"optref" (a.k.a. "ref null") per
// https://github.com/WebAssembly/function-references // https://github.com/WebAssembly/function-references
// - "rtt" per https://github.com/WebAssembly/gc // - "rtt" per https://github.com/WebAssembly/gc
#define FOREACH_NUMERIC_VALUE_TYPE(V) \
V(I32, 2, I32, Int32, 'i', "i32") \
V(I64, 3, I64, Int64, 'l', "i64") \
V(F32, 2, F32, Float32, 'f', "f32") \
V(F64, 3, F64, Float64, 'd', "f64") \
V(S128, 4, S128, Simd128, 's', "s128") \
V(I8, 0, I8, Int8, 'b', "i8") \
V(I16, 1, I16, Int16, 'h', "i16")
#define FOREACH_VALUE_TYPE(V) \ #define FOREACH_VALUE_TYPE(V) \
V(Stmt, -1, Void, None, 'v', "<stmt>") \ V(Stmt, -1, Void, None, 'v', "<stmt>") \
V(I32, 2, I32, Int32, 'i', "i32") \ FOREACH_NUMERIC_VALUE_TYPE(V) \
V(I64, 3, I64, Int64, 'l', "i64") \
V(F32, 2, F32, Float32, 'f', "f32") \
V(F64, 3, F64, Float64, 'd', "f64") \
V(S128, 4, S128, Simd128, 's', "s128") \
V(I8, 0, I8, Int8, 'b', "i8") \
V(I16, 1, I16, Int16, 'h', "i16") \
V(Rtt, kSystemPointerSizeLog2, Rtt, TaggedPointer, 't', "rtt") \ V(Rtt, kSystemPointerSizeLog2, Rtt, TaggedPointer, 't', "rtt") \
V(Ref, kSystemPointerSizeLog2, Ref, TaggedPointer, 'r', "ref") \ V(Ref, kSystemPointerSizeLog2, Ref, TaggedPointer, 'r', "ref") \
V(OptRef, kSystemPointerSizeLog2, OptRef, TaggedPointer, 'n', "ref null") \ V(OptRef, kSystemPointerSizeLog2, OptRef, TaggedPointer, 'n', "ref null") \
...@@ -259,8 +262,14 @@ class ValueType { ...@@ -259,8 +262,14 @@ class ValueType {
return kLocalVoid; return kLocalVoid;
case kRtt: case kRtt:
return kLocalRtt; return kLocalRtt;
default: #define NUMERIC_TYPE_CASE(kind, ...) \
return static_cast<ValueTypeCode>(kLocalI32 - (kind() - kI32)); case k##kind: \
return kLocal##kind;
FOREACH_NUMERIC_VALUE_TYPE(NUMERIC_TYPE_CASE)
#undef NUMERIC_TYPE_CASE
case kBottom:
// Unreachable code
return kLocalVoid;
} }
} }
......
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