Commit ee106cb9 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

Reland "[wasm] [cleanup] Only pass information really needed"

This is a reland of fa18e78d.

Mips compile error is fixed.

Original change's description:
> [wasm] [cleanup] Only pass information really needed
>
> Instead of always passing the MachineType, we can often just pass the
> accessed memory size or the MachineRepresentation, which is less
> information to pass and will simplify the upcoming refactoring for
> memory operations in Liftoff.
>
> R=titzer@chromium.org
>
> Bug: v8:6600
> Change-Id: I8748f8e00dcfdbc4082893143fe88bdafde99053
> Reviewed-on: https://chromium-review.googlesource.com/822194
> Reviewed-by: Ben Titzer <titzer@chromium.org>
> Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#50041}

TBR=titzer@chromium.org

Bug: v8:6600
Change-Id: Ia2c47464277a7c7a70099e7f7d6e32003e34d87e
Reviewed-on: https://chromium-review.googlesource.com/822342Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50047}
parent 65ac8ca0
This diff is collapsed.
...@@ -353,7 +353,7 @@ class WasmGraphBuilder { ...@@ -353,7 +353,7 @@ class WasmGraphBuilder {
Node* LoadMem(wasm::ValueType type, MachineType memtype, Node* index, Node* LoadMem(wasm::ValueType type, MachineType memtype, Node* index,
uint32_t offset, uint32_t alignment, uint32_t offset, uint32_t alignment,
wasm::WasmCodePosition position); wasm::WasmCodePosition position);
Node* StoreMem(MachineType memtype, Node* index, uint32_t offset, Node* StoreMem(MachineRepresentation mem_rep, Node* index, uint32_t offset,
uint32_t alignment, Node* val, wasm::WasmCodePosition position, uint32_t alignment, Node* val, wasm::WasmCodePosition position,
wasm::ValueType type); wasm::ValueType type);
static void PrintDebugName(Node* node); static void PrintDebugName(Node* node);
...@@ -457,11 +457,11 @@ class WasmGraphBuilder { ...@@ -457,11 +457,11 @@ class WasmGraphBuilder {
Node* String(const char* string); Node* String(const char* string);
Node* MemBuffer(uint32_t offset); Node* MemBuffer(uint32_t offset);
void BoundsCheckMem(MachineType memtype, Node* index, uint32_t offset, void BoundsCheckMem(uint8_t access_size, Node* index, uint32_t offset,
wasm::WasmCodePosition position); wasm::WasmCodePosition position);
const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type); const Operator* GetSafeLoadOperator(int offset, wasm::ValueType type);
const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type); const Operator* GetSafeStoreOperator(int offset, wasm::ValueType type);
Node* BuildChangeEndiannessStore(Node* node, MachineType type, Node* BuildChangeEndiannessStore(Node* node, MachineRepresentation rep,
wasm::ValueType wasmtype = wasm::kWasmStmt); wasm::ValueType wasmtype = wasm::kWasmStmt);
Node* BuildChangeEndiannessLoad(Node* node, MachineType type, Node* BuildChangeEndiannessLoad(Node* node, MachineType type,
wasm::ValueType wasmtype = wasm::kWasmStmt); wasm::ValueType wasmtype = wasm::kWasmStmt);
......
...@@ -528,7 +528,7 @@ class LiftoffCompiler { ...@@ -528,7 +528,7 @@ class LiftoffCompiler {
Value* result) { Value* result) {
unsupported(decoder, "memory load"); unsupported(decoder, "memory load");
} }
void StoreMem(Decoder* decoder, ValueType type, MachineType mem_type, void StoreMem(Decoder* decoder, ValueType type, MachineRepresentation mem_rep,
const MemoryAccessOperand<validate>& operand, const MemoryAccessOperand<validate>& operand,
const Value& index, const Value& value) { const Value& index, const Value& value) {
unsupported(decoder, "memory store"); unsupported(decoder, "memory store");
......
...@@ -581,7 +581,7 @@ struct ControlWithNamedConstructors : public ControlBase<Value> { ...@@ -581,7 +581,7 @@ struct ControlWithNamedConstructors : public ControlBase<Value> {
F(LoadMem, ValueType type, MachineType mem_type, \ F(LoadMem, ValueType type, MachineType mem_type, \
const MemoryAccessOperand<validate>& operand, const Value& index, \ const MemoryAccessOperand<validate>& operand, const Value& index, \
Value* result) \ Value* result) \
F(StoreMem, ValueType type, MachineType mem_type, \ F(StoreMem, ValueType type, MachineRepresentation mem_rep, \
const MemoryAccessOperand<validate>& operand, const Value& index, \ const MemoryAccessOperand<validate>& operand, const Value& index, \
const Value& value) \ const Value& value) \
F(CurrentMemoryPages, Value* result) \ F(CurrentMemoryPages, Value* result) \
...@@ -1997,8 +1997,8 @@ class WasmFullDecoder : public WasmDecoder<validate> { ...@@ -1997,8 +1997,8 @@ class WasmFullDecoder : public WasmDecoder<validate> {
ElementSizeLog2Of(mem_type.representation())); ElementSizeLog2Of(mem_type.representation()));
auto value = Pop(1, type); auto value = Pop(1, type);
auto index = Pop(0, kWasmI32); auto index = Pop(0, kWasmI32);
CALL_INTERFACE_IF_REACHABLE(StoreMem, type, mem_type, operand, index, CALL_INTERFACE_IF_REACHABLE(StoreMem, type, mem_type.representation(),
value); operand, index, value);
return operand.length; return operand.length;
} }
......
...@@ -347,10 +347,10 @@ class WasmGraphBuildingInterface { ...@@ -347,10 +347,10 @@ class WasmGraphBuildingInterface {
operand.alignment, decoder->position()); operand.alignment, decoder->position());
} }
void StoreMem(Decoder* decoder, ValueType type, MachineType mem_type, void StoreMem(Decoder* decoder, ValueType type, MachineRepresentation mem_rep,
const MemoryAccessOperand<validate>& operand, const MemoryAccessOperand<validate>& operand,
const Value& index, const Value& value) { const Value& index, const Value& value) {
BUILD(StoreMem, mem_type, index.node, operand.offset, operand.alignment, BUILD(StoreMem, mem_rep, index.node, operand.offset, operand.alignment,
value.node, decoder->position(), type); value.node, decoder->position(), type);
} }
......
...@@ -551,7 +551,7 @@ class V8_EXPORT_PRIVATE WasmOpcodes { ...@@ -551,7 +551,7 @@ class V8_EXPORT_PRIVATE WasmOpcodes {
static const char* TrapReasonMessage(TrapReason reason); static const char* TrapReasonMessage(TrapReason reason);
static byte MemSize(MachineType type) { static byte MemSize(MachineType type) {
return 1 << ElementSizeLog2Of(type.representation()); return MemSize(type.representation());
} }
static byte MemSize(ValueType type) { return 1 << ElementSizeLog2Of(type); } static byte MemSize(ValueType type) { return 1 << ElementSizeLog2Of(type); }
......
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