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

Unified Diff: src/wasm/wasm-interpreter.cc

Issue 2165633006: [wasm] Remove special memory type for (internal) globals and use local type instead. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: [wasm] Remove special memory type for (internal) globals and use local type instead. Created 4 years, 5 months 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/module-decoder.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-interpreter.cc
diff --git a/src/wasm/wasm-interpreter.cc b/src/wasm/wasm-interpreter.cc
index ed4dd64a5e07f418e629c668d449302143fb96a6..4d2d994e459db356d3572400f6636f42d4bf4e5d 100644
--- a/src/wasm/wasm-interpreter.cc
+++ b/src/wasm/wasm-interpreter.cc
@@ -1407,31 +1407,15 @@ class ThreadImpl : public WasmInterpreter::Thread {
GlobalIndexOperand operand(&decoder, code->at(pc));
const WasmGlobal* global = &module()->globals[operand.index];
byte* ptr = instance()->globals_start + global->offset;
- MachineType type = global->type;
+ LocalType type = global->type;
WasmVal val;
- if (type == MachineType::Int8()) {
- val =
- WasmVal(static_cast<int32_t>(*reinterpret_cast<int8_t*>(ptr)));
- } else if (type == MachineType::Uint8()) {
- val =
- WasmVal(static_cast<int32_t>(*reinterpret_cast<uint8_t*>(ptr)));
- } else if (type == MachineType::Int16()) {
- val =
- WasmVal(static_cast<int32_t>(*reinterpret_cast<int16_t*>(ptr)));
- } else if (type == MachineType::Uint16()) {
- val = WasmVal(
- static_cast<int32_t>(*reinterpret_cast<uint16_t*>(ptr)));
- } else if (type == MachineType::Int32()) {
+ if (type == kAstI32) {
val = WasmVal(*reinterpret_cast<int32_t*>(ptr));
- } else if (type == MachineType::Uint32()) {
- val = WasmVal(*reinterpret_cast<uint32_t*>(ptr));
- } else if (type == MachineType::Int64()) {
+ } else if (type == kAstI64) {
val = WasmVal(*reinterpret_cast<int64_t*>(ptr));
- } else if (type == MachineType::Uint64()) {
- val = WasmVal(*reinterpret_cast<uint64_t*>(ptr));
- } else if (type == MachineType::Float32()) {
+ } else if (type == kAstF32) {
val = WasmVal(*reinterpret_cast<float*>(ptr));
- } else if (type == MachineType::Float64()) {
+ } else if (type == kAstF64) {
val = WasmVal(*reinterpret_cast<double*>(ptr));
} else {
UNREACHABLE();
@@ -1444,31 +1428,15 @@ class ThreadImpl : public WasmInterpreter::Thread {
GlobalIndexOperand operand(&decoder, code->at(pc));
const WasmGlobal* global = &module()->globals[operand.index];
byte* ptr = instance()->globals_start + global->offset;
- MachineType type = global->type;
+ LocalType type = global->type;
WasmVal val = Pop();
- if (type == MachineType::Int8()) {
- *reinterpret_cast<int8_t*>(ptr) =
- static_cast<int8_t>(val.to<int32_t>());
- } else if (type == MachineType::Uint8()) {
- *reinterpret_cast<uint8_t*>(ptr) =
- static_cast<uint8_t>(val.to<uint32_t>());
- } else if (type == MachineType::Int16()) {
- *reinterpret_cast<int16_t*>(ptr) =
- static_cast<int16_t>(val.to<int32_t>());
- } else if (type == MachineType::Uint16()) {
- *reinterpret_cast<uint16_t*>(ptr) =
- static_cast<uint16_t>(val.to<uint32_t>());
- } else if (type == MachineType::Int32()) {
+ if (type == kAstI32) {
*reinterpret_cast<int32_t*>(ptr) = val.to<int32_t>();
- } else if (type == MachineType::Uint32()) {
- *reinterpret_cast<uint32_t*>(ptr) = val.to<uint32_t>();
- } else if (type == MachineType::Int64()) {
+ } else if (type == kAstI64) {
*reinterpret_cast<int64_t*>(ptr) = val.to<int64_t>();
- } else if (type == MachineType::Uint64()) {
- *reinterpret_cast<uint64_t*>(ptr) = val.to<uint64_t>();
- } else if (type == MachineType::Float32()) {
+ } else if (type == kAstF32) {
*reinterpret_cast<float*>(ptr) = val.to<float>();
- } else if (type == MachineType::Float64()) {
+ } else if (type == kAstF64) {
*reinterpret_cast<double*>(ptr) = val.to<double>();
} else {
UNREACHABLE();
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/wasm-module.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698