Commit 4122df26 authored by ahaas's avatar ahaas Committed by Commit bot

[wasm] Use MachineOperatorBuilder::word() instead of kPointerSize to determine the word size.

R=titzer@chromium.org

Review URL: https://codereview.chromium.org/1770333002

Cr-Commit-Position: refs/heads/master@{#34581}
parent 01f603d2
......@@ -32,7 +32,7 @@ Int64Lowering::Int64Lowering(Graph* graph, MachineOperatorBuilder* machine,
}
void Int64Lowering::LowerGraph() {
if (4 != kPointerSize) {
if (!machine()->Is32()) {
return;
}
stack_.push(graph()->end());
......
......@@ -862,28 +862,28 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input) {
// kExprI64Popcnt:
// kExprF32SConvertI64:
case wasm::kExprF32SConvertI64:
if (kPointerSize == 4) {
if (m->Is32()) {
return BuildF32SConvertI64(input);
}
op = m->RoundInt64ToFloat32();
break;
// kExprF32UConvertI64:
case wasm::kExprF32UConvertI64:
if (kPointerSize == 4) {
if (m->Is32()) {
return BuildF32UConvertI64(input);
}
op = m->RoundUint64ToFloat32();
break;
// kExprF64SConvertI64:
case wasm::kExprF64SConvertI64:
if (kPointerSize == 4) {
if (m->Is32()) {
return BuildF64SConvertI64(input);
}
op = m->RoundInt64ToFloat64();
break;
// kExprF64UConvertI64:
case wasm::kExprF64UConvertI64:
if (kPointerSize == 4) {
if (m->Is32()) {
return BuildF64UConvertI64(input);
}
op = m->RoundUint64ToFloat64();
......@@ -2196,7 +2196,7 @@ Node* WasmGraphBuilder::String(const char* string) {
Graph* WasmGraphBuilder::graph() { return jsgraph()->graph(); }
void WasmGraphBuilder::Int64LoweringForTesting() {
if (kPointerSize == 4) {
if (jsgraph()->machine()->Is32()) {
Int64Lowering r(jsgraph()->graph(), jsgraph()->machine(),
jsgraph()->common(), jsgraph()->zone(),
function_signature_);
......@@ -2442,7 +2442,7 @@ Handle<Code> CompileWasmFunction(wasm::ErrorThrower& thrower, Isolate* isolate,
// Run the compiler pipeline to generate machine code.
CallDescriptor* descriptor =
wasm::ModuleEnv::GetWasmCallDescriptor(&zone, function.sig);
if (kPointerSize == 4) {
if (machine.Is32()) {
descriptor = module_env->GetI32WasmCallDescriptor(&zone, descriptor);
}
Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION);
......
......@@ -28,7 +28,8 @@ namespace compiler {
class Int64LoweringTest : public GraphTest {
public:
Int64LoweringTest() : GraphTest(), machine_(zone()) {
Int64LoweringTest()
: GraphTest(), machine_(zone(), MachineRepresentation::kWord32) {
value_[0] = 0x1234567890abcdef;
value_[1] = 0x1edcba098765432f;
value_[2] = 0x1133557799886644;
......@@ -114,8 +115,6 @@ class Int64LoweringTest : public GraphTest {
};
TEST_F(Int64LoweringTest, Int64Constant) {
if (4 != kPointerSize) return;
LowerGraph(Int64Constant(value(0)), MachineRepresentation::kWord64);
EXPECT_THAT(graph()->end()->InputAt(1),
IsReturn2(IsInt32Constant(low_word_value(0)),
......@@ -123,8 +122,6 @@ TEST_F(Int64LoweringTest, Int64Constant) {
}
TEST_F(Int64LoweringTest, Int64Load) {
if (4 != kPointerSize) return;
int32_t base = 0x1234;
int32_t index = 0x5678;
......@@ -150,8 +147,6 @@ TEST_F(Int64LoweringTest, Int64Load) {
}
TEST_F(Int64LoweringTest, Int64Store) {
if (4 != kPointerSize) return;
// We have to build the TF graph explicitly here because Store does not return
// a value.
......@@ -195,8 +190,6 @@ TEST_F(Int64LoweringTest, Int64Store) {
}
TEST_F(Int64LoweringTest, Int64And) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->Word64And(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord64);
......@@ -209,8 +202,6 @@ TEST_F(Int64LoweringTest, Int64And) {
}
TEST_F(Int64LoweringTest, TruncateInt64ToInt32) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->TruncateInt64ToInt32(),
Int64Constant(value(0))),
MachineRepresentation::kWord32);
......@@ -219,8 +210,6 @@ TEST_F(Int64LoweringTest, TruncateInt64ToInt32) {
}
TEST_F(Int64LoweringTest, Parameter) {
if (4 != kPointerSize) return;
LowerGraph(Parameter(0), MachineRepresentation::kWord64,
MachineRepresentation::kWord64, 1);
......@@ -229,8 +218,6 @@ TEST_F(Int64LoweringTest, Parameter) {
}
TEST_F(Int64LoweringTest, Parameter2) {
if (4 != kPointerSize) return;
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 5);
sig_builder.AddReturn(MachineRepresentation::kWord32);
......@@ -251,8 +238,6 @@ TEST_F(Int64LoweringTest, Parameter2) {
}
TEST_F(Int64LoweringTest, CallI64Return) {
if (4 != kPointerSize) return;
int32_t function = 0x9999;
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0);
......@@ -281,8 +266,6 @@ TEST_F(Int64LoweringTest, CallI64Return) {
}
TEST_F(Int64LoweringTest, CallI64Parameter) {
if (4 != kPointerSize) return;
int32_t function = 0x9999;
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 3);
......@@ -328,8 +311,6 @@ TEST_F(Int64LoweringTest, CallI64Parameter) {
// kExprI64And:
// kExprI64Ior:
TEST_F(Int64LoweringTest, Int64Ior) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->Word64Or(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord64);
......@@ -343,8 +324,6 @@ TEST_F(Int64LoweringTest, Int64Ior) {
// kExprI64Xor:
TEST_F(Int64LoweringTest, Int64Xor) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->Word64Xor(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord64);
......@@ -357,8 +336,6 @@ TEST_F(Int64LoweringTest, Int64Xor) {
}
// kExprI64Shl:
TEST_F(Int64LoweringTest, Int64Shl) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->Word64Shl(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord64);
......@@ -377,8 +354,6 @@ TEST_F(Int64LoweringTest, Int64Shl) {
// kExprI64ShrS:
// kExprI64Eq:
TEST_F(Int64LoweringTest, Int64Eq) {
if (4 != kPointerSize) return;
LowerGraph(graph()->NewNode(machine()->Word64Equal(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord32);
......@@ -396,24 +371,20 @@ TEST_F(Int64LoweringTest, Int64Eq) {
// kExprI64Ne:
// kExprI64LtS:
TEST_F(Int64LoweringTest, Int64LtS) {
if (4 != kPointerSize) return;
TestComparison(machine()->Int64LessThan(), IsInt32LessThan, IsUint32LessThan);
}
// kExprI64LeS:
TEST_F(Int64LoweringTest, Int64LeS) {
if (4 != kPointerSize) return;
TestComparison(machine()->Int64LessThanOrEqual(), IsInt32LessThan,
IsUint32LessThanOrEqual);
}
// kExprI64LtU:
TEST_F(Int64LoweringTest, Int64LtU) {
if (4 != kPointerSize) return;
TestComparison(machine()->Uint64LessThan(), IsUint32LessThan,
IsUint32LessThan);
}
// kExprI64LeU:
TEST_F(Int64LoweringTest, Int64LeU) {
if (4 != kPointerSize) return;
TestComparison(machine()->Uint64LessThanOrEqual(), IsUint32LessThan,
IsUint32LessThanOrEqual);
}
......
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