Commit 19cfe697 authored by Clemens Hammacher's avatar Clemens Hammacher Committed by Commit Bot

[wasm] Fix signature of simd builders

This refactoring makes some parameters const, and does not rely on the
fact that inputs are passed via NodeVector. Both changes are needed for
an upcoming refactoring of the wasm decoder.

R=bbudge@chromium.org

Change-Id: Ifbd6185ae9ea5a0ef526c2fd695e13e3f14475f4
Reviewed-on: https://chromium-review.googlesource.com/571004Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46729}
parent 0725ff15
......@@ -981,7 +981,8 @@ SIMD_LANE_OP_LIST(SIMD_LANE_OPS)
SIMD_FORMAT_LIST(SIMD_SHIFT_OPS)
#undef SIMD_SHIFT_OPS
const Operator* MachineOperatorBuilder::S8x16Shuffle(uint8_t shuffle[16]) {
const Operator* MachineOperatorBuilder::S8x16Shuffle(
const uint8_t shuffle[16]) {
uint8_t* array = zone_->NewArray<uint8_t>(16);
memcpy(array, shuffle, 16);
return new (zone_)
......
......@@ -577,7 +577,7 @@ class V8_EXPORT_PRIVATE MachineOperatorBuilder final
const Operator* S128Not();
const Operator* S128Select();
const Operator* S8x16Shuffle(uint8_t shuffle[16]);
const Operator* S8x16Shuffle(const uint8_t shuffle[16]);
const Operator* S1x4AnyTrue();
const Operator* S1x4AllTrue();
......
......@@ -3350,8 +3350,7 @@ Node* WasmGraphBuilder::S128Zero() {
return graph()->NewNode(jsgraph()->machine()->S128Zero());
}
Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode,
const NodeVector& inputs) {
Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode, Node* const* inputs) {
has_simd_ = true;
switch (opcode) {
case wasm::kExprF32x4Splat:
......@@ -3677,7 +3676,7 @@ Node* WasmGraphBuilder::SimdOp(wasm::WasmOpcode opcode,
}
Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane,
const NodeVector& inputs) {
Node* const* inputs) {
has_simd_ = true;
switch (opcode) {
case wasm::kExprF32x4ExtractLane:
......@@ -3710,7 +3709,7 @@ Node* WasmGraphBuilder::SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane,
}
Node* WasmGraphBuilder::SimdShiftOp(wasm::WasmOpcode opcode, uint8_t shift,
const NodeVector& inputs) {
Node* const* inputs) {
has_simd_ = true;
switch (opcode) {
case wasm::kExprI32x4Shl:
......@@ -3742,8 +3741,8 @@ Node* WasmGraphBuilder::SimdShiftOp(wasm::WasmOpcode opcode, uint8_t shift,
}
}
Node* WasmGraphBuilder::Simd8x16ShuffleOp(uint8_t shuffle[16],
const NodeVector& inputs) {
Node* WasmGraphBuilder::Simd8x16ShuffleOp(const uint8_t shuffle[16],
Node* const* inputs) {
has_simd_ = true;
return graph()->NewNode(jsgraph()->machine()->S8x16Shuffle(shuffle),
inputs[0], inputs[1]);
......
......@@ -262,15 +262,14 @@ class WasmGraphBuilder {
Node* S1x8Zero();
Node* S1x16Zero();
Node* SimdOp(wasm::WasmOpcode opcode, const NodeVector& inputs);
Node* SimdOp(wasm::WasmOpcode opcode, Node* const* inputs);
Node* SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane,
const NodeVector& inputs);
Node* SimdLaneOp(wasm::WasmOpcode opcode, uint8_t lane, Node* const* inputs);
Node* SimdShiftOp(wasm::WasmOpcode opcode, uint8_t shift,
const NodeVector& inputs);
Node* const* inputs);
Node* Simd8x16ShuffleOp(uint8_t shuffle[16], const NodeVector& inputs);
Node* Simd8x16ShuffleOp(const uint8_t shuffle[16], Node* const* inputs);
bool has_simd() const { return has_simd_; }
......
......@@ -1541,7 +1541,7 @@ class WasmFullDecoder : public WasmDecoder {
if (Validate(pc_, opcode, operand)) {
compiler::NodeVector inputs(1, zone_);
inputs[0] = Pop(0, ValueType::kSimd128).node;
TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs);
TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs.data());
Push(type, node);
}
return operand.length;
......@@ -1553,7 +1553,7 @@ class WasmFullDecoder : public WasmDecoder {
compiler::NodeVector inputs(2, zone_);
inputs[1] = Pop(1, type).node;
inputs[0] = Pop(0, ValueType::kSimd128).node;
TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs);
TFNode* node = BUILD(SimdLaneOp, opcode, operand.lane, inputs.data());
Push(ValueType::kSimd128, node);
}
return operand.length;
......@@ -1564,7 +1564,7 @@ class WasmFullDecoder : public WasmDecoder {
if (Validate(pc_, opcode, operand)) {
compiler::NodeVector inputs(1, zone_);
inputs[0] = Pop(0, ValueType::kSimd128).node;
TFNode* node = BUILD(SimdShiftOp, opcode, operand.shift, inputs);
TFNode* node = BUILD(SimdShiftOp, opcode, operand.shift, inputs.data());
Push(ValueType::kSimd128, node);
}
return operand.length;
......@@ -1576,7 +1576,7 @@ class WasmFullDecoder : public WasmDecoder {
compiler::NodeVector inputs(2, zone_);
inputs[1] = Pop(1, ValueType::kSimd128).node;
inputs[0] = Pop(0, ValueType::kSimd128).node;
TFNode* node = BUILD(Simd8x16ShuffleOp, operand.shuffle, inputs);
TFNode* node = BUILD(Simd8x16ShuffleOp, operand.shuffle, inputs.data());
Push(ValueType::kSimd128, node);
}
return 16;
......@@ -1635,7 +1635,7 @@ class WasmFullDecoder : public WasmDecoder {
Value val = Pop(static_cast<int>(i - 1), sig->GetParam(i - 1));
inputs[i - 1] = val.node;
}
TFNode* node = BUILD(SimdOp, opcode, inputs);
TFNode* node = BUILD(SimdOp, opcode, inputs.data());
Push(GetReturnType(sig), node);
} else {
error("invalid simd opcode");
......
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