Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1353)

Unified Diff: src/wasm/wasm-opcodes.h

Issue 2594993002: [wasm] Rename wasm::LocalType to wasm::ValueType and kAst* to kWasm* (Closed)
Patch Set: Fix inspector tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/wasm/wasm-module-builder.cc ('k') | src/wasm/wasm-opcodes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-opcodes.h
diff --git a/src/wasm/wasm-opcodes.h b/src/wasm/wasm-opcodes.h
index fd67fed69d86e72a32b707352d84b09f64ffd5cf..c3173a6ac7c45bdf597911b4149b5ff7d862d637 100644
--- a/src/wasm/wasm-opcodes.h
+++ b/src/wasm/wasm-opcodes.h
@@ -15,7 +15,7 @@ namespace internal {
namespace wasm {
// Binary encoding of local types.
-enum LocalTypeCode {
+enum ValueTypeCode {
kLocalVoid = 0x40,
kLocalI32 = 0x7f,
kLocalI64 = 0x7e,
@@ -29,17 +29,17 @@ static const uint8_t kMultivalBlock = 0x41;
// We reuse the internal machine type to represent WebAssembly types.
// A typedef improves readability without adding a whole new type system.
-typedef MachineRepresentation LocalType;
-const LocalType kAstStmt = MachineRepresentation::kNone;
-const LocalType kAstI32 = MachineRepresentation::kWord32;
-const LocalType kAstI64 = MachineRepresentation::kWord64;
-const LocalType kAstF32 = MachineRepresentation::kFloat32;
-const LocalType kAstF64 = MachineRepresentation::kFloat64;
-const LocalType kAstS128 = MachineRepresentation::kSimd128;
-// We use kTagged here because kNone is already used by kAstStmt.
-const LocalType kAstEnd = MachineRepresentation::kTagged;
-
-typedef Signature<LocalType> FunctionSig;
+typedef MachineRepresentation ValueType;
+const ValueType kWasmStmt = MachineRepresentation::kNone;
+const ValueType kWasmI32 = MachineRepresentation::kWord32;
+const ValueType kWasmI64 = MachineRepresentation::kWord64;
+const ValueType kWasmF32 = MachineRepresentation::kFloat32;
+const ValueType kWasmF64 = MachineRepresentation::kFloat64;
+const ValueType kWasmS128 = MachineRepresentation::kSimd128;
+// We use kTagged here because kNone is already used by kWasmStmt.
+const ValueType kWasmEnd = MachineRepresentation::kTagged;
+
+typedef Signature<ValueType> FunctionSig;
std::ostream& operator<<(std::ostream& os, const FunctionSig& function);
typedef Vector<const char> WasmName;
@@ -452,43 +452,43 @@ const WasmCodePosition kNoCodePosition = -1;
FOREACH_ATOMIC_OPCODE(V)
// All signatures.
-#define FOREACH_SIGNATURE(V) \
- FOREACH_SIMD_SIGNATURE(V) \
- V(i_ii, kAstI32, kAstI32, kAstI32) \
- V(i_i, kAstI32, kAstI32) \
- V(i_v, kAstI32) \
- V(i_ff, kAstI32, kAstF32, kAstF32) \
- V(i_f, kAstI32, kAstF32) \
- V(i_dd, kAstI32, kAstF64, kAstF64) \
- V(i_d, kAstI32, kAstF64) \
- V(i_l, kAstI32, kAstI64) \
- V(l_ll, kAstI64, kAstI64, kAstI64) \
- V(i_ll, kAstI32, kAstI64, kAstI64) \
- V(l_l, kAstI64, kAstI64) \
- V(l_i, kAstI64, kAstI32) \
- V(l_f, kAstI64, kAstF32) \
- V(l_d, kAstI64, kAstF64) \
- V(f_ff, kAstF32, kAstF32, kAstF32) \
- V(f_f, kAstF32, kAstF32) \
- V(f_d, kAstF32, kAstF64) \
- V(f_i, kAstF32, kAstI32) \
- V(f_l, kAstF32, kAstI64) \
- V(d_dd, kAstF64, kAstF64, kAstF64) \
- V(d_d, kAstF64, kAstF64) \
- V(d_f, kAstF64, kAstF32) \
- V(d_i, kAstF64, kAstI32) \
- V(d_l, kAstF64, kAstI64) \
- V(d_id, kAstF64, kAstI32, kAstF64) \
- V(f_if, kAstF32, kAstI32, kAstF32) \
- V(l_il, kAstI64, kAstI32, kAstI64)
-
-#define FOREACH_SIMD_SIGNATURE(V) \
- V(s_s, kAstS128, kAstS128) \
- V(s_f, kAstS128, kAstF32) \
- V(s_ss, kAstS128, kAstS128, kAstS128) \
- V(s_sss, kAstS128, kAstS128, kAstS128, kAstS128) \
- V(s_i, kAstS128, kAstI32) \
- V(s_si, kAstS128, kAstS128, kAstI32)
+#define FOREACH_SIGNATURE(V) \
+ FOREACH_SIMD_SIGNATURE(V) \
+ V(i_ii, kWasmI32, kWasmI32, kWasmI32) \
+ V(i_i, kWasmI32, kWasmI32) \
+ V(i_v, kWasmI32) \
+ V(i_ff, kWasmI32, kWasmF32, kWasmF32) \
+ V(i_f, kWasmI32, kWasmF32) \
+ V(i_dd, kWasmI32, kWasmF64, kWasmF64) \
+ V(i_d, kWasmI32, kWasmF64) \
+ V(i_l, kWasmI32, kWasmI64) \
+ V(l_ll, kWasmI64, kWasmI64, kWasmI64) \
+ V(i_ll, kWasmI32, kWasmI64, kWasmI64) \
+ V(l_l, kWasmI64, kWasmI64) \
+ V(l_i, kWasmI64, kWasmI32) \
+ V(l_f, kWasmI64, kWasmF32) \
+ V(l_d, kWasmI64, kWasmF64) \
+ V(f_ff, kWasmF32, kWasmF32, kWasmF32) \
+ V(f_f, kWasmF32, kWasmF32) \
+ V(f_d, kWasmF32, kWasmF64) \
+ V(f_i, kWasmF32, kWasmI32) \
+ V(f_l, kWasmF32, kWasmI64) \
+ V(d_dd, kWasmF64, kWasmF64, kWasmF64) \
+ V(d_d, kWasmF64, kWasmF64) \
+ V(d_f, kWasmF64, kWasmF32) \
+ V(d_i, kWasmF64, kWasmI32) \
+ V(d_l, kWasmF64, kWasmI64) \
+ V(d_id, kWasmF64, kWasmI32, kWasmF64) \
+ V(f_if, kWasmF32, kWasmI32, kWasmF32) \
+ V(l_il, kWasmI64, kWasmI32, kWasmI64)
+
+#define FOREACH_SIMD_SIGNATURE(V) \
+ V(s_s, kWasmS128, kWasmS128) \
+ V(s_f, kWasmS128, kWasmF32) \
+ V(s_ss, kWasmS128, kWasmS128, kWasmS128) \
+ V(s_sss, kWasmS128, kWasmS128, kWasmS128, kWasmS128) \
+ V(s_i, kWasmS128, kWasmI32) \
+ V(s_si, kWasmS128, kWasmS128, kWasmI32)
#define FOREACH_PREFIX(V) \
V(Simd, 0xe5) \
@@ -539,21 +539,21 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
return 1 << ElementSizeLog2Of(type.representation());
}
- static byte MemSize(LocalType type) { return 1 << ElementSizeLog2Of(type); }
+ static byte MemSize(ValueType type) { return 1 << ElementSizeLog2Of(type); }
- static LocalTypeCode LocalTypeCodeFor(LocalType type) {
+ static ValueTypeCode ValueTypeCodeFor(ValueType type) {
switch (type) {
- case kAstI32:
+ case kWasmI32:
return kLocalI32;
- case kAstI64:
+ case kWasmI64:
return kLocalI64;
- case kAstF32:
+ case kWasmF32:
return kLocalF32;
- case kAstF64:
+ case kWasmF64:
return kLocalF64;
- case kAstS128:
+ case kWasmS128:
return kLocalS128;
- case kAstStmt:
+ case kWasmStmt:
return kLocalVoid;
default:
UNREACHABLE();
@@ -561,19 +561,19 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
}
}
- static MachineType MachineTypeFor(LocalType type) {
+ static MachineType MachineTypeFor(ValueType type) {
switch (type) {
- case kAstI32:
+ case kWasmI32:
return MachineType::Int32();
- case kAstI64:
+ case kWasmI64:
return MachineType::Int64();
- case kAstF32:
+ case kWasmF32:
return MachineType::Float32();
- case kAstF64:
+ case kWasmF64:
return MachineType::Float64();
- case kAstS128:
+ case kWasmS128:
return MachineType::Simd128();
- case kAstStmt:
+ case kWasmStmt:
return MachineType::None();
default:
UNREACHABLE();
@@ -581,32 +581,32 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
}
}
- static LocalType LocalTypeFor(MachineType type) {
+ static ValueType ValueTypeFor(MachineType type) {
if (type == MachineType::Int8()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Uint8()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Int16()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Uint16()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Int32()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Uint32()) {
- return kAstI32;
+ return kWasmI32;
} else if (type == MachineType::Int64()) {
- return kAstI64;
+ return kWasmI64;
} else if (type == MachineType::Uint64()) {
- return kAstI64;
+ return kWasmI64;
} else if (type == MachineType::Float32()) {
- return kAstF32;
+ return kWasmF32;
} else if (type == MachineType::Float64()) {
- return kAstF64;
+ return kWasmF64;
} else if (type == MachineType::Simd128()) {
- return kAstS128;
+ return kWasmS128;
} else {
UNREACHABLE();
- return kAstI32;
+ return kWasmI32;
}
}
@@ -637,21 +637,21 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
}
}
- static char ShortNameOf(LocalType type) {
+ static char ShortNameOf(ValueType type) {
switch (type) {
- case kAstI32:
+ case kWasmI32:
return 'i';
- case kAstI64:
+ case kWasmI64:
return 'l';
- case kAstF32:
+ case kWasmF32:
return 'f';
- case kAstF64:
+ case kWasmF64:
return 'd';
- case kAstS128:
+ case kWasmS128:
return 's';
- case kAstStmt:
+ case kWasmStmt:
return 'v';
- case kAstEnd:
+ case kWasmEnd:
return 'x';
default:
UNREACHABLE();
@@ -659,21 +659,21 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
}
}
- static const char* TypeName(LocalType type) {
+ static const char* TypeName(ValueType type) {
switch (type) {
- case kAstI32:
+ case kWasmI32:
return "i32";
- case kAstI64:
+ case kWasmI64:
return "i64";
- case kAstF32:
+ case kWasmF32:
return "f32";
- case kAstF64:
+ case kWasmF64:
return "f64";
- case kAstS128:
+ case kWasmS128:
return "s128";
- case kAstStmt:
+ case kWasmStmt:
return "<stmt>";
- case kAstEnd:
+ case kWasmEnd:
return "<end>";
default:
return "<unknown>";
« no previous file with comments | « src/wasm/wasm-module-builder.cc ('k') | src/wasm/wasm-opcodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698