Upgrade V8 to 5.1.281.57 DO NOT MERGE
FPIIM-449
Change-Id: Id981b686b4d587ac31697662eb98bb34be42ad90
(cherry picked from commit 3b9bc31999c9787eb726ecdbfd5796bfdec32a18)
diff --git a/test/unittests/compiler/graph-unittest.h b/test/unittests/compiler/graph-unittest.h
index 9c99992..31bae6d 100644
--- a/test/unittests/compiler/graph-unittest.h
+++ b/test/unittests/compiler/graph-unittest.h
@@ -29,7 +29,6 @@
explicit GraphTest(int num_parameters = 1);
~GraphTest() override;
- protected:
Node* start() { return graph()->start(); }
Node* end() { return graph()->end(); }
diff --git a/test/unittests/compiler/int64-lowering-unittest.cc b/test/unittests/compiler/int64-lowering-unittest.cc
index eff6d4a..08f3038 100644
--- a/test/unittests/compiler/int64-lowering-unittest.cc
+++ b/test/unittests/compiler/int64-lowering-unittest.cc
@@ -28,7 +28,10 @@
class Int64LoweringTest : public GraphTest {
public:
- Int64LoweringTest() : GraphTest(), machine_(zone()) {
+ Int64LoweringTest()
+ : GraphTest(),
+ machine_(zone(), MachineRepresentation::kWord32,
+ MachineOperatorBuilder::Flag::kAllOptionalOps) {
value_[0] = 0x1234567890abcdef;
value_[1] = 0x1edcba098765432f;
value_[2] = 0x1133557799886644;
@@ -86,14 +89,34 @@
return static_cast<int32_t>(value_[i] >> 32);
}
+ void TestComparison(
+ const Operator* op,
+ Matcher<Node*> (*high_word_matcher)(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher),
+ Matcher<Node*> (*low_word_matcher)(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher)) {
+ LowerGraph(
+ graph()->NewNode(op, Int64Constant(value(0)), Int64Constant(value(1))),
+ MachineRepresentation::kWord32);
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn(IsWord32Or(
+ high_word_matcher(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1))),
+ IsWord32And(
+ IsWord32Equal(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1))),
+ low_word_matcher(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1))))),
+ start(), start()));
+ }
+
private:
MachineOperatorBuilder machine_;
int64_t value_[3];
};
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)),
@@ -101,8 +124,6 @@
}
TEST_F(Int64LoweringTest, Int64Load) {
- if (4 != kPointerSize) return;
-
int32_t base = 0x1234;
int32_t index = 0x5678;
@@ -128,8 +149,6 @@
}
TEST_F(Int64LoweringTest, Int64Store) {
- if (4 != kPointerSize) return;
-
// We have to build the TF graph explicitly here because Store does not return
// a value.
@@ -173,8 +192,6 @@
}
TEST_F(Int64LoweringTest, Int64And) {
- if (4 != kPointerSize) return;
-
LowerGraph(graph()->NewNode(machine()->Word64And(), Int64Constant(value(0)),
Int64Constant(value(1))),
MachineRepresentation::kWord64);
@@ -187,8 +204,6 @@
}
TEST_F(Int64LoweringTest, TruncateInt64ToInt32) {
- if (4 != kPointerSize) return;
-
LowerGraph(graph()->NewNode(machine()->TruncateInt64ToInt32(),
Int64Constant(value(0))),
MachineRepresentation::kWord32);
@@ -197,8 +212,6 @@
}
TEST_F(Int64LoweringTest, Parameter) {
- if (4 != kPointerSize) return;
-
LowerGraph(Parameter(0), MachineRepresentation::kWord64,
MachineRepresentation::kWord64, 1);
@@ -207,8 +220,6 @@
}
TEST_F(Int64LoweringTest, Parameter2) {
- if (4 != kPointerSize) return;
-
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 5);
sig_builder.AddReturn(MachineRepresentation::kWord32);
@@ -229,8 +240,6 @@
}
TEST_F(Int64LoweringTest, CallI64Return) {
- if (4 != kPointerSize) return;
-
int32_t function = 0x9999;
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 0);
@@ -259,8 +268,6 @@
}
TEST_F(Int64LoweringTest, CallI64Parameter) {
- if (4 != kPointerSize) return;
-
int32_t function = 0x9999;
Signature<MachineRepresentation>::Builder sig_builder(zone(), 1, 3);
@@ -294,6 +301,505 @@
wasm::ModuleEnv::GetI32WasmCallDescriptor(zone(), desc));
}
+// todo(ahaas): I added a list of missing instructions here to make merging
+// easier when I do them one by one.
+// kExprI64Add:
+TEST_F(Int64LoweringTest, Int64Add) {
+ LowerGraph(graph()->NewNode(machine()->Int64Add(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> add;
+ Matcher<Node*> add_matcher = IsInt32PairAdd(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)), IsInt32Constant(high_word_value(1)));
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&add), add_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&add), add_matcher)),
+ start(), start()));
+}
+// kExprI64Sub:
+TEST_F(Int64LoweringTest, Int64Sub) {
+ LowerGraph(graph()->NewNode(machine()->Int64Sub(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> sub;
+ Matcher<Node*> sub_matcher = IsInt32PairSub(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)), IsInt32Constant(high_word_value(1)));
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&sub), sub_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&sub), sub_matcher)),
+ start(), start()));
+}
+
+// kExprI64Mul:
+TEST_F(Int64LoweringTest, Int64Mul) {
+ LowerGraph(graph()->NewNode(machine()->Int64Mul(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> mul_capture;
+ Matcher<Node*> mul_matcher = IsInt32PairMul(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)), IsInt32Constant(high_word_value(1)));
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&mul_capture), mul_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&mul_capture), mul_matcher)),
+ start(), start()));
+}
+
+// kExprI64DivS:
+// kExprI64DivU:
+// kExprI64RemS:
+// kExprI64RemU:
+// kExprI64Ior:
+TEST_F(Int64LoweringTest, Int64Ior) {
+ LowerGraph(graph()->NewNode(machine()->Word64Or(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsWord32Or(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1))),
+ IsWord32Or(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1))),
+ start(), start()));
+}
+
+// kExprI64Xor:
+TEST_F(Int64LoweringTest, Int64Xor) {
+ LowerGraph(graph()->NewNode(machine()->Word64Xor(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsWord32Xor(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1))),
+ IsWord32Xor(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1))),
+ start(), start()));
+}
+// kExprI64Shl:
+TEST_F(Int64LoweringTest, Int64Shl) {
+ LowerGraph(graph()->NewNode(machine()->Word64Shl(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> shl;
+ Matcher<Node*> shl_matcher = IsWord32PairShl(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)));
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&shl), shl_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&shl), shl_matcher)),
+ start(), start()));
+}
+// kExprI64ShrU:
+TEST_F(Int64LoweringTest, Int64ShrU) {
+ LowerGraph(graph()->NewNode(machine()->Word64Shr(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> shr;
+ Matcher<Node*> shr_matcher = IsWord32PairShr(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)));
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&shr), shr_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&shr), shr_matcher)),
+ start(), start()));
+}
+// kExprI64ShrS:
+TEST_F(Int64LoweringTest, Int64ShrS) {
+ LowerGraph(graph()->NewNode(machine()->Word64Sar(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> sar;
+ Matcher<Node*> sar_matcher = IsWord32PairSar(
+ IsInt32Constant(low_word_value(0)), IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(1)));
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsProjection(0, AllOf(CaptureEq(&sar), sar_matcher)),
+ IsProjection(1, AllOf(CaptureEq(&sar), sar_matcher)),
+ start(), start()));
+}
+// kExprI64Eq:
+TEST_F(Int64LoweringTest, Int64Eq) {
+ LowerGraph(graph()->NewNode(machine()->Word64Equal(), Int64Constant(value(0)),
+ Int64Constant(value(1))),
+ MachineRepresentation::kWord32);
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn(IsWord32Equal(
+ IsWord32Or(IsWord32Xor(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1))),
+ IsWord32Xor(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1)))),
+ IsInt32Constant(0)),
+ start(), start()));
+}
+
+// kExprI64LtS:
+TEST_F(Int64LoweringTest, Int64LtS) {
+ TestComparison(machine()->Int64LessThan(), IsInt32LessThan, IsUint32LessThan);
+}
+// kExprI64LeS:
+TEST_F(Int64LoweringTest, Int64LeS) {
+ TestComparison(machine()->Int64LessThanOrEqual(), IsInt32LessThan,
+ IsUint32LessThanOrEqual);
+}
+// kExprI64LtU:
+TEST_F(Int64LoweringTest, Int64LtU) {
+ TestComparison(machine()->Uint64LessThan(), IsUint32LessThan,
+ IsUint32LessThan);
+}
+// kExprI64LeU:
+TEST_F(Int64LoweringTest, Int64LeU) {
+ TestComparison(machine()->Uint64LessThanOrEqual(), IsUint32LessThan,
+ IsUint32LessThanOrEqual);
+}
+
+// kExprI32ConvertI64:
+TEST_F(Int64LoweringTest, I32ConvertI64) {
+ LowerGraph(graph()->NewNode(machine()->TruncateInt64ToInt32(),
+ Int64Constant(value(0))),
+ MachineRepresentation::kWord32);
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn(IsInt32Constant(low_word_value(0)), start(), start()));
+}
+// kExprI64SConvertI32:
+TEST_F(Int64LoweringTest, I64SConvertI32) {
+ LowerGraph(graph()->NewNode(machine()->ChangeInt32ToInt64(),
+ Int32Constant(low_word_value(0))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(low_word_value(0)),
+ IsWord32Sar(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(31)),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64SConvertI32_2) {
+ LowerGraph(
+ graph()->NewNode(machine()->ChangeInt32ToInt64(),
+ graph()->NewNode(machine()->TruncateInt64ToInt32(),
+ Int64Constant(value(0)))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(low_word_value(0)),
+ IsWord32Sar(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(31)),
+ start(), start()));
+}
+// kExprI64UConvertI32:
+TEST_F(Int64LoweringTest, I64UConvertI32) {
+ LowerGraph(graph()->NewNode(machine()->ChangeUint32ToUint64(),
+ Int32Constant(low_word_value(0))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64UConvertI32_2) {
+ LowerGraph(
+ graph()->NewNode(machine()->ChangeUint32ToUint64(),
+ graph()->NewNode(machine()->TruncateInt64ToInt32(),
+ Int64Constant(value(0)))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(low_word_value(0)), IsInt32Constant(0),
+ start(), start()));
+}
+// kExprF64ReinterpretI64:
+TEST_F(Int64LoweringTest, F64ReinterpretI64) {
+ LowerGraph(graph()->NewNode(machine()->BitcastInt64ToFloat64(),
+ Int64Constant(value(0))),
+ MachineRepresentation::kFloat64);
+
+ Capture<Node*> stack_slot_capture;
+ Matcher<Node*> stack_slot_matcher =
+ IsStackSlot(MachineRepresentation::kWord64);
+
+ Capture<Node*> store_capture;
+ Matcher<Node*> store_matcher =
+ IsStore(StoreRepresentation(MachineRepresentation::kWord32,
+ WriteBarrierKind::kNoWriteBarrier),
+ AllOf(CaptureEq(&stack_slot_capture), stack_slot_matcher),
+ IsInt32Constant(0), IsInt32Constant(low_word_value(0)),
+ IsStore(StoreRepresentation(MachineRepresentation::kWord32,
+ WriteBarrierKind::kNoWriteBarrier),
+ AllOf(CaptureEq(&stack_slot_capture), stack_slot_matcher),
+ IsInt32Constant(4), IsInt32Constant(high_word_value(0)),
+ start(), start()),
+ start());
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn(IsLoad(MachineType::Float64(),
+ AllOf(CaptureEq(&stack_slot_capture), stack_slot_matcher),
+ IsInt32Constant(0),
+ AllOf(CaptureEq(&store_capture), store_matcher), start()),
+ start(), start()));
+}
+// kExprI64ReinterpretF64:
+TEST_F(Int64LoweringTest, I64ReinterpretF64) {
+ LowerGraph(graph()->NewNode(machine()->BitcastFloat64ToInt64(),
+ Float64Constant(bit_cast<double>(value(0)))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> stack_slot;
+ Matcher<Node*> stack_slot_matcher =
+ IsStackSlot(MachineRepresentation::kWord64);
+
+ Capture<Node*> store;
+ Matcher<Node*> store_matcher = IsStore(
+ StoreRepresentation(MachineRepresentation::kFloat64,
+ WriteBarrierKind::kNoWriteBarrier),
+ AllOf(CaptureEq(&stack_slot), stack_slot_matcher), IsInt32Constant(0),
+ IsFloat64Constant(bit_cast<double>(value(0))), start(), start());
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsLoad(MachineType::Int32(),
+ AllOf(CaptureEq(&stack_slot), stack_slot_matcher),
+ IsInt32Constant(0),
+ AllOf(CaptureEq(&store), store_matcher), start()),
+ IsLoad(MachineType::Int32(),
+ AllOf(CaptureEq(&stack_slot), stack_slot_matcher),
+ IsInt32Constant(0x4),
+ AllOf(CaptureEq(&store), store_matcher), start()),
+ start(), start()));
+}
+// kExprI64Clz:
+TEST_F(Int64LoweringTest, I64Clz) {
+ LowerGraph(graph()->NewNode(machine()->Word64Clz(), Int64Constant(value(0))),
+ MachineRepresentation::kWord64);
+
+ Capture<Node*> branch_capture;
+ Matcher<Node*> branch_matcher = IsBranch(
+ IsWord32Equal(IsInt32Constant(high_word_value(0)), IsInt32Constant(0)),
+ start());
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(
+ IsPhi(MachineRepresentation::kWord32,
+ IsInt32Add(IsWord32Clz(IsInt32Constant(low_word_value(0))),
+ IsInt32Constant(32)),
+ IsWord32Clz(IsInt32Constant(high_word_value(0))),
+ IsMerge(
+ IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)),
+ IsIfFalse(
+ AllOf(CaptureEq(&branch_capture), branch_matcher)))),
+ IsInt32Constant(0), start(), start()));
+}
+// kExprI64Ctz:
+TEST_F(Int64LoweringTest, I64Ctz) {
+ LowerGraph(graph()->NewNode(machine()->Word64CtzPlaceholder(),
+ Int64Constant(value(0))),
+ MachineRepresentation::kWord64);
+ Capture<Node*> branch_capture;
+ Matcher<Node*> branch_matcher = IsBranch(
+ IsWord32Equal(IsInt32Constant(low_word_value(0)), IsInt32Constant(0)),
+ start());
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(
+ IsPhi(MachineRepresentation::kWord32,
+ IsInt32Add(IsWord32Ctz(IsInt32Constant(high_word_value(0))),
+ IsInt32Constant(32)),
+ IsWord32Ctz(IsInt32Constant(low_word_value(0))),
+ IsMerge(
+ IsIfTrue(AllOf(CaptureEq(&branch_capture), branch_matcher)),
+ IsIfFalse(
+ AllOf(CaptureEq(&branch_capture), branch_matcher)))),
+ IsInt32Constant(0), start(), start()));
+}
+// kExprI64Popcnt:
+
+TEST_F(Int64LoweringTest, Dfs) {
+ Node* common = Int64Constant(value(0));
+ LowerGraph(graph()->NewNode(machine()->Word64And(), common,
+ graph()->NewNode(machine()->Word64And(), common,
+ Int64Constant(value(1)))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsWord32And(IsInt32Constant(low_word_value(0)),
+ IsWord32And(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1)))),
+ IsWord32And(IsInt32Constant(high_word_value(0)),
+ IsWord32And(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1)))),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Popcnt) {
+ LowerGraph(graph()->NewNode(machine()->Word64PopcntPlaceholder(),
+ Int64Constant(value(0))),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Add(IsWord32Popcnt(IsInt32Constant(low_word_value(0))),
+ IsWord32Popcnt(IsInt32Constant(high_word_value(0)))),
+ IsInt32Constant(0), start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Ror) {
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)),
+ Parameter(0)),
+ MachineRepresentation::kWord64, MachineRepresentation::kWord64, 1);
+
+ Matcher<Node*> branch_lt32_matcher =
+ IsBranch(IsInt32LessThan(IsParameter(0), IsInt32Constant(32)), start());
+
+ Matcher<Node*> low_input_matcher = IsPhi(
+ MachineRepresentation::kWord32, IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(high_word_value(0)),
+ IsMerge(IsIfTrue(branch_lt32_matcher), IsIfFalse(branch_lt32_matcher)));
+
+ Matcher<Node*> high_input_matcher = IsPhi(
+ MachineRepresentation::kWord32, IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(0)),
+ IsMerge(IsIfTrue(branch_lt32_matcher), IsIfFalse(branch_lt32_matcher)));
+
+ Matcher<Node*> shift_matcher =
+ IsWord32And(IsParameter(0), IsInt32Constant(0x1f));
+
+ Matcher<Node*> bit_mask_matcher = IsWord32Shl(
+ IsWord32Sar(IsInt32Constant(std::numeric_limits<int32_t>::min()),
+ shift_matcher),
+ IsInt32Constant(1));
+
+ Matcher<Node*> inv_mask_matcher =
+ IsWord32Xor(bit_mask_matcher, IsInt32Constant(-1));
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(
+ IsWord32Or(IsWord32And(IsWord32Ror(low_input_matcher, shift_matcher),
+ inv_mask_matcher),
+ IsWord32And(IsWord32Ror(high_input_matcher, shift_matcher),
+ bit_mask_matcher)),
+ IsWord32Or(IsWord32And(IsWord32Ror(high_input_matcher, shift_matcher),
+ inv_mask_matcher),
+ IsWord32And(IsWord32Ror(low_input_matcher, shift_matcher),
+ bit_mask_matcher)),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Ror_0) {
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)),
+ Int32Constant(0)),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(high_word_value(0)), start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Ror_32) {
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)),
+ Int32Constant(32)),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(low_word_value(0)), start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Ror_11) {
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)),
+ Int32Constant(11)),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsWord32Or(IsWord32Shr(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(11)),
+ IsWord32Shl(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(21))),
+ IsWord32Or(IsWord32Shr(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(11)),
+ IsWord32Shl(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(21))),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64Ror_43) {
+ LowerGraph(graph()->NewNode(machine()->Word64Ror(), Int64Constant(value(0)),
+ Int32Constant(43)),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(
+ graph()->end()->InputAt(1),
+ IsReturn2(IsWord32Or(IsWord32Shr(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(11)),
+ IsWord32Shl(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(21))),
+ IsWord32Or(IsWord32Shr(IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(11)),
+ IsWord32Shl(IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(21))),
+ start(), start()));
+}
+
+TEST_F(Int64LoweringTest, I64PhiWord64) {
+ LowerGraph(graph()->NewNode(common()->Phi(MachineRepresentation::kWord64, 2),
+ Int64Constant(value(0)), Int64Constant(value(1)),
+ start()),
+ MachineRepresentation::kWord64);
+
+ EXPECT_THAT(graph()->end()->InputAt(1),
+ IsReturn2(IsPhi(MachineRepresentation::kWord32,
+ IsInt32Constant(low_word_value(0)),
+ IsInt32Constant(low_word_value(1)), start()),
+ IsPhi(MachineRepresentation::kWord32,
+ IsInt32Constant(high_word_value(0)),
+ IsInt32Constant(high_word_value(1)), start()),
+ start(), start()));
+}
+
+void TestPhi(Int64LoweringTest* test, MachineRepresentation rep, Node* v1,
+ Node* v2) {
+ test->LowerGraph(test->graph()->NewNode(test->common()->Phi(rep, 2), v1, v2,
+ test->start()),
+ rep);
+
+ EXPECT_THAT(test->graph()->end()->InputAt(1),
+ IsReturn(IsPhi(rep, v1, v2, test->start()), test->start(),
+ test->start()));
+}
+
+TEST_F(Int64LoweringTest, I64PhiFloat32) {
+ TestPhi(this, MachineRepresentation::kFloat32, Float32Constant(1.5),
+ Float32Constant(2.5));
+}
+
+TEST_F(Int64LoweringTest, I64PhiFloat64) {
+ TestPhi(this, MachineRepresentation::kFloat64, Float32Constant(1.5),
+ Float32Constant(2.5));
+}
+
+TEST_F(Int64LoweringTest, I64PhiWord32) {
+ TestPhi(this, MachineRepresentation::kWord32, Float32Constant(1),
+ Float32Constant(2));
+}
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/test/unittests/compiler/js-builtin-reducer-unittest.cc b/test/unittests/compiler/js-builtin-reducer-unittest.cc
index 9e14cda..0f8eed7 100644
--- a/test/unittests/compiler/js-builtin-reducer-unittest.cc
+++ b/test/unittests/compiler/js-builtin-reducer-unittest.cc
@@ -43,7 +43,7 @@
isolate()->factory()->NewStringFromAsciiChecked(
"Math")).ToHandleChecked();
Handle<JSFunction> f = Handle<JSFunction>::cast(
- JSObject::GetProperty(
+ Object::GetProperty(
m, isolate()->factory()->NewStringFromAsciiChecked(name))
.ToHandleChecked());
return HeapConstant(f);
@@ -149,8 +149,8 @@
Node* control = graph()->start();
Node* context = UndefinedConstant();
Node* frame_state = graph()->start();
- TRACED_FOREACH(Type*, t0, kIntegral32Types) {
- TRACED_FOREACH(Type*, t1, kIntegral32Types) {
+ TRACED_FOREACH(Type*, t0, kNumberTypes) {
+ TRACED_FOREACH(Type*, t1, kNumberTypes) {
Node* p0 = Parameter(t0, 0);
Node* p1 = Parameter(t1, 1);
Node* call = graph()->NewNode(javascript()->CallFunction(4), function,
@@ -159,7 +159,8 @@
Reduction r = Reduce(call);
ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsInt32Mul(p0, p1));
+ EXPECT_THAT(r.replacement(),
+ IsNumberImul(IsNumberToUint32(p0), IsNumberToUint32(p1)));
}
}
}
diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
index 919c1b2..de0eefc 100644
--- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
+++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc
@@ -91,7 +91,8 @@
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleLo, 1),
input, context, effect, control));
ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsFloat64ExtractLowWord32(input));
+ EXPECT_THAT(r.replacement(),
+ IsFloat64ExtractLowWord32(IsGuard(Type::Number(), input, _)));
}
@@ -108,7 +109,8 @@
graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineDoubleHi, 1),
input, context, effect, control));
ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsFloat64ExtractHighWord32(input));
+ EXPECT_THAT(r.replacement(),
+ IsFloat64ExtractHighWord32(IsGuard(Type::Number(), input, _)));
}
@@ -240,58 +242,6 @@
// -----------------------------------------------------------------------------
-// %_MathFloor
-
-
-TEST_F(JSIntrinsicLoweringTest, InlineMathFloor) {
- Node* const input = Parameter(0);
- Node* const context = Parameter(1);
- Node* const effect = graph()->start();
- Node* const control = graph()->start();
- Reduction const r = Reduce(
- graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathFloor, 1),
- input, context, effect, control),
- MachineOperatorBuilder::kFloat64RoundDown);
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsFloat64RoundDown(input));
-}
-
-
-// -----------------------------------------------------------------------------
-// %_MathSqrt
-
-
-TEST_F(JSIntrinsicLoweringTest, InlineMathSqrt) {
- Node* const input = Parameter(0);
- Node* const context = Parameter(1);
- Node* const effect = graph()->start();
- Node* const control = graph()->start();
- Reduction const r = Reduce(
- graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathSqrt, 1),
- input, context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsFloat64Sqrt(input));
-}
-
-
-// -----------------------------------------------------------------------------
-// %_MathClz32
-
-
-TEST_F(JSIntrinsicLoweringTest, InlineMathClz32) {
- Node* const input = Parameter(0);
- Node* const context = Parameter(1);
- Node* const effect = graph()->start();
- Node* const control = graph()->start();
- Reduction const r = Reduce(
- graph()->NewNode(javascript()->CallRuntime(Runtime::kInlineMathClz32, 1),
- input, context, effect, control));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsWord32Clz(input));
-}
-
-
-// -----------------------------------------------------------------------------
// %_ValueOf
@@ -334,6 +284,23 @@
AllOf(CaptureEq(&if_false0), IsIfFalse(CaptureEq(&branch0))))));
}
+// -----------------------------------------------------------------------------
+// %_GetOrdinaryHasInstance
+
+TEST_F(JSIntrinsicLoweringTest, InlineGetOrdinaryHasInstance) {
+ Node* const context = Parameter(0);
+ Node* const effect = graph()->start();
+ Node* const control = graph()->start();
+ Reduction const r = Reduce(graph()->NewNode(
+ javascript()->CallRuntime(Runtime::kInlineGetOrdinaryHasInstance, 0),
+ context, effect, control));
+ ASSERT_TRUE(r.Changed());
+ EXPECT_THAT(
+ r.replacement(),
+ IsLoadContext(
+ ContextAccess(0, Context::ORDINARY_HAS_INSTANCE_INDEX, true), _));
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/test/unittests/compiler/js-typed-lowering-unittest.cc b/test/unittests/compiler/js-typed-lowering-unittest.cc
index e37d4a2..1adb5da 100644
--- a/test/unittests/compiler/js-typed-lowering-unittest.cc
+++ b/test/unittests/compiler/js-typed-lowering-unittest.cc
@@ -67,7 +67,7 @@
STATIC_ASSERT(LANGUAGE_END == 3);
-const LanguageMode kLanguageModes[] = {SLOPPY, STRICT, STRONG};
+const LanguageMode kLanguageModes[] = {SLOPPY, STRICT};
} // namespace
diff --git a/test/unittests/compiler/load-elimination-unittest.cc b/test/unittests/compiler/load-elimination-unittest.cc
index 3ad11cf..38bb151 100644
--- a/test/unittests/compiler/load-elimination-unittest.cc
+++ b/test/unittests/compiler/load-elimination-unittest.cc
@@ -12,30 +12,33 @@
namespace internal {
namespace compiler {
-class LoadEliminationTest : public GraphTest {
+class LoadEliminationTest : public TypedGraphTest {
public:
- LoadEliminationTest() : GraphTest(3), simplified_(zone()) {}
+ LoadEliminationTest()
+ : TypedGraphTest(3), common_(zone()), simplified_(zone()) {}
~LoadEliminationTest() override {}
protected:
Reduction Reduce(Node* node) {
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
- LoadElimination reducer(&graph_reducer);
+ LoadElimination reducer(&graph_reducer, graph(), common());
return reducer.Reduce(node);
}
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
+ CommonOperatorBuilder* common() { return &common_; }
private:
+ CommonOperatorBuilder common_;
SimplifiedOperatorBuilder simplified_;
};
TEST_F(LoadEliminationTest, LoadFieldWithStoreField) {
- Node* object1 = Parameter(0);
- Node* object2 = Parameter(1);
- Node* value = Parameter(2);
+ Node* object1 = Parameter(Type::Any(), 0);
+ Node* object2 = Parameter(Type::Any(), 1);
+ Node* value = Parameter(Type::Any(), 2);
Node* effect = graph()->start();
Node* control = graph()->start();
diff --git a/test/unittests/compiler/loop-peeling-unittest.cc b/test/unittests/compiler/loop-peeling-unittest.cc
index 9dcec85..9db4905 100644
--- a/test/unittests/compiler/loop-peeling-unittest.cc
+++ b/test/unittests/compiler/loop-peeling-unittest.cc
@@ -64,7 +64,7 @@
OFStream os(stdout);
os << AsRPO(*graph());
}
- Zone zone;
+ Zone zone(isolate()->allocator());
return LoopFinder::BuildLoopTree(graph(), &zone);
}
diff --git a/test/unittests/compiler/node-test-utils.cc b/test/unittests/compiler/node-test-utils.cc
index ee4cf54..6e5d39f 100644
--- a/test/unittests/compiler/node-test-utils.cc
+++ b/test/unittests/compiler/node-test-utils.cc
@@ -1330,6 +1330,53 @@
const Matcher<Node*> control_matcher_;
};
+class IsStackSlotMatcher final : public NodeMatcher {
+ public:
+ explicit IsStackSlotMatcher(const Matcher<MachineRepresentation>& rep_matcher)
+ : NodeMatcher(IrOpcode::kStackSlot), rep_matcher_(rep_matcher) {}
+
+ void DescribeTo(std::ostream* os) const final {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose rep (";
+ rep_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(OpParameter<MachineRepresentation>(node),
+ "rep", rep_matcher_, listener));
+ }
+
+ private:
+ const Matcher<MachineRepresentation> rep_matcher_;
+};
+
+class IsGuardMatcher final : public NodeMatcher {
+ public:
+ IsGuardMatcher(const Matcher<Type*>& type_matcher,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(IrOpcode::kGuard),
+ type_matcher_(type_matcher),
+ value_matcher_(value_matcher),
+ control_matcher_(control_matcher) {}
+
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(OpParameter<Type*>(node->op()), "type",
+ type_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0),
+ "value", value_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node, 0),
+ "control", control_matcher_, listener));
+ }
+
+ private:
+ const Matcher<Type*> type_matcher_;
+ const Matcher<Node*> value_matcher_;
+ const Matcher<Node*> control_matcher_;
+};
class IsToNumberMatcher final : public NodeMatcher {
public:
@@ -1406,6 +1453,86 @@
const Matcher<Node*> context_matcher_;
};
+class IsQuadopMatcher final : public NodeMatcher {
+ public:
+ IsQuadopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& a_matcher,
+ const Matcher<Node*>& b_matcher,
+ const Matcher<Node*>& c_matcher,
+ const Matcher<Node*>& d_matcher)
+ : NodeMatcher(opcode),
+ a_matcher_(a_matcher),
+ b_matcher_(b_matcher),
+ c_matcher_(c_matcher),
+ d_matcher_(d_matcher) {}
+
+ void DescribeTo(std::ostream* os) const final {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose a (";
+ a_matcher_.DescribeTo(os);
+ *os << ") and b (";
+ b_matcher_.DescribeTo(os);
+ *os << ") and c (";
+ c_matcher_.DescribeTo(os);
+ *os << ") and d (";
+ d_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "a",
+ a_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "b",
+ b_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), "c",
+ c_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), "d",
+ d_matcher_, listener));
+ }
+
+ private:
+ const Matcher<Node*> a_matcher_;
+ const Matcher<Node*> b_matcher_;
+ const Matcher<Node*> c_matcher_;
+ const Matcher<Node*> d_matcher_;
+};
+
+class IsTernopMatcher final : public NodeMatcher {
+ public:
+ IsTernopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& mid_matcher,
+ const Matcher<Node*>& rhs_matcher)
+ : NodeMatcher(opcode),
+ lhs_matcher_(lhs_matcher),
+ mid_matcher_(mid_matcher),
+ rhs_matcher_(rhs_matcher) {}
+
+ void DescribeTo(std::ostream* os) const final {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose lhs (";
+ lhs_matcher_.DescribeTo(os);
+ *os << ") and mid (";
+ mid_matcher_.DescribeTo(os);
+ *os << ") and rhs (";
+ rhs_matcher_.DescribeTo(os);
+ *os << ")";
+ }
+
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final {
+ return (NodeMatcher::MatchAndExplain(node, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs",
+ lhs_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "mid",
+ mid_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), "rhs",
+ rhs_matcher_, listener));
+ }
+
+ private:
+ const Matcher<Node*> lhs_matcher_;
+ const Matcher<Node*> mid_matcher_;
+ const Matcher<Node*> rhs_matcher_;
+};
class IsBinopMatcher final : public NodeMatcher {
public:
@@ -1484,7 +1611,6 @@
} // namespace
-
Matcher<Node*> IsDead() {
return MakeMatcher(new NodeMatcher(IrOpcode::kDead));
}
@@ -1938,6 +2064,12 @@
effect_matcher, control_matcher));
}
+Matcher<Node*> IsGuard(const Matcher<Type*>& type_matcher,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(
+ new IsGuardMatcher(type_matcher, value_matcher, control_matcher));
+}
Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher,
const Matcher<Node*>& lhs_matcher,
@@ -2044,6 +2176,9 @@
effect_matcher, control_matcher));
}
+Matcher<Node*> IsStackSlot(const Matcher<MachineRepresentation>& rep_matcher) {
+ return MakeMatcher(new IsStackSlotMatcher(rep_matcher));
+}
Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher,
const Matcher<Node*>& context_matcher,
@@ -2069,6 +2204,29 @@
return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer));
}
+#define IS_QUADOP_MATCHER(Name) \
+ Matcher<Node*> Is##Name( \
+ const Matcher<Node*>& a_matcher, const Matcher<Node*>& b_matcher, \
+ const Matcher<Node*>& c_matcher, const Matcher<Node*>& d_matcher) { \
+ return MakeMatcher(new IsQuadopMatcher(IrOpcode::k##Name, a_matcher, \
+ b_matcher, c_matcher, d_matcher)); \
+ }
+
+IS_QUADOP_MATCHER(Int32PairAdd)
+IS_QUADOP_MATCHER(Int32PairSub)
+IS_QUADOP_MATCHER(Int32PairMul)
+
+#define IS_TERNOP_MATCHER(Name) \
+ Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
+ const Matcher<Node*>& mid_matcher, \
+ const Matcher<Node*>& rhs_matcher) { \
+ return MakeMatcher(new IsTernopMatcher(IrOpcode::k##Name, lhs_matcher, \
+ mid_matcher, rhs_matcher)); \
+ }
+
+IS_TERNOP_MATCHER(Word32PairShl)
+IS_TERNOP_MATCHER(Word32PairShr)
+IS_TERNOP_MATCHER(Word32PairSar)
#define IS_BINOP_MATCHER(Name) \
Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
@@ -2083,8 +2241,10 @@
IS_BINOP_MATCHER(NumberShiftLeft)
IS_BINOP_MATCHER(NumberShiftRight)
IS_BINOP_MATCHER(NumberShiftRightLogical)
+IS_BINOP_MATCHER(NumberImul)
IS_BINOP_MATCHER(Word32And)
IS_BINOP_MATCHER(Word32Or)
+IS_BINOP_MATCHER(Word32Xor)
IS_BINOP_MATCHER(Word32Sar)
IS_BINOP_MATCHER(Word32Shl)
IS_BINOP_MATCHER(Word32Shr)
@@ -2146,6 +2306,8 @@
IS_UNOP_MATCHER(ObjectIsReceiver)
IS_UNOP_MATCHER(ObjectIsSmi)
IS_UNOP_MATCHER(Word32Clz)
+IS_UNOP_MATCHER(Word32Ctz)
+IS_UNOP_MATCHER(Word32Popcnt)
#undef IS_UNOP_MATCHER
} // namespace compiler
diff --git a/test/unittests/compiler/node-test-utils.h b/test/unittests/compiler/node-test-utils.h
index 03f2a3b..dd036c9 100644
--- a/test/unittests/compiler/node-test-utils.h
+++ b/test/unittests/compiler/node-test-utils.h
@@ -211,6 +211,8 @@
const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsNumberShiftRightLogical(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
+Matcher<Node*> IsNumberImul(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
@@ -261,10 +263,13 @@
const Matcher<Node*>& value_matcher,
const Matcher<Node*>& effect_matcher,
const Matcher<Node*>& control_matcher);
+Matcher<Node*> IsStackSlot(const Matcher<MachineRepresentation>& rep_matcher);
Matcher<Node*> IsWord32And(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Or(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
+Matcher<Node*> IsWord32Xor(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Sar(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Shl(const Matcher<Node*>& lhs_matcher,
@@ -276,6 +281,8 @@
Matcher<Node*> IsWord32Equal(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord32Clz(const Matcher<Node*>& value_matcher);
+Matcher<Node*> IsWord32Ctz(const Matcher<Node*>& value_matcher);
+Matcher<Node*> IsWord32Popcnt(const Matcher<Node*>& value_matcher);
Matcher<Node*> IsWord64And(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher);
Matcher<Node*> IsWord64Or(const Matcher<Node*>& lhs_matcher,
@@ -356,6 +363,35 @@
Matcher<Node*> IsParameter(const Matcher<int> index_matcher);
Matcher<Node*> IsLoadFramePointer();
+Matcher<Node*> IsInt32PairAdd(const Matcher<Node*>& a_matcher,
+ const Matcher<Node*>& b_matcher,
+ const Matcher<Node*>& c_matcher,
+ const Matcher<Node*>& d_matcher);
+Matcher<Node*> IsInt32PairSub(const Matcher<Node*>& a_matcher,
+ const Matcher<Node*>& b_matcher,
+ const Matcher<Node*>& c_matcher,
+ const Matcher<Node*>& d_matcher);
+Matcher<Node*> IsInt32PairMul(const Matcher<Node*>& a_matcher,
+ const Matcher<Node*>& b_matcher,
+ const Matcher<Node*>& c_matcher,
+ const Matcher<Node*>& d_matcher);
+
+Matcher<Node*> IsWord32PairShl(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& mid_matcher,
+ const Matcher<Node*>& rhs_matcher);
+Matcher<Node*> IsWord32PairShr(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& mid_matcher,
+ const Matcher<Node*>& rhs_matcher);
+
+Matcher<Node*> IsWord32PairSar(const Matcher<Node*>& lhs_matcher,
+ const Matcher<Node*>& mid_matcher,
+ const Matcher<Node*>& rhs_matcher);
+
+Matcher<Node*> IsStackSlot();
+Matcher<Node*> IsGuard(const Matcher<Type*>& type_matcher,
+ const Matcher<Node*>& value_matcher,
+ const Matcher<Node*>& control_matcher);
+
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/test/unittests/compiler/s390/OWNERS b/test/unittests/compiler/s390/OWNERS
new file mode 100644
index 0000000..eb007cb
--- /dev/null
+++ b/test/unittests/compiler/s390/OWNERS
@@ -0,0 +1,5 @@
+jyan@ca.ibm.com
+dstence@us.ibm.com
+joransiu@ca.ibm.com
+mbrandy@us.ibm.com
+michael_dawson@ca.ibm.com
diff --git a/test/unittests/compiler/s390/instruction-selector-s390-unittest.cc b/test/unittests/compiler/s390/instruction-selector-s390-unittest.cc
new file mode 100644
index 0000000..5fe72ee
--- /dev/null
+++ b/test/unittests/compiler/s390/instruction-selector-s390-unittest.cc
@@ -0,0 +1,11 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "test/unittests/compiler/instruction-selector-unittest.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {} // namespace compiler
+} // namespace internal
+} // namespace v8
diff --git a/test/unittests/compiler/scheduler-unittest.cc b/test/unittests/compiler/scheduler-unittest.cc
index 6cf0734..da77bdc 100644
--- a/test/unittests/compiler/scheduler-unittest.cc
+++ b/test/unittests/compiler/scheduler-unittest.cc
@@ -2,15 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "src/compiler/schedule.h"
#include "src/compiler/access-builder.h"
#include "src/compiler/common-operator.h"
-#include "src/compiler/graph.h"
#include "src/compiler/graph-visualizer.h"
+#include "src/compiler/graph.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/node.h"
#include "src/compiler/opcodes.h"
#include "src/compiler/operator.h"
-#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
#include "src/compiler/simplified-operator.h"
#include "src/compiler/source-position.h"
@@ -136,6 +136,51 @@
ComputeAndVerifySchedule(13);
}
+TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond1) {
+ Node* start = graph()->NewNode(common()->Start(1));
+ graph()->SetStart(start);
+
+ Node* p0 = graph()->NewNode(common()->Parameter(0), start);
+ Node* d1 = CreateDiamond(graph(), common(), p0);
+ USE(d1);
+ Node* ret = graph()->NewNode(common()->Return(), p0, start, start);
+ Node* end = graph()->NewNode(common()->End(1), ret);
+
+ graph()->SetEnd(end);
+
+ ComputeAndVerifySchedule(4);
+}
+
+TARGET_TEST_F(SchedulerTest, FloatingDeadDiamond2) {
+ Graph* g = graph();
+ Node* start = g->NewNode(common()->Start(1));
+ g->SetStart(start);
+
+ Node* n1 = g->NewNode(common()->Parameter(1), start);
+
+ Node* n2 = g->NewNode(common()->Branch(), n1, start);
+ Node* n3 = g->NewNode(common()->IfTrue(), n2);
+ Node* n4 = g->NewNode(common()->IfFalse(), n2);
+ Node* n5 = g->NewNode(common()->Int32Constant(-100));
+ Node* n6 = g->NewNode(common()->Return(), n5, start, n4);
+ Node* n7 = g->NewNode(common()->Int32Constant(0));
+ Node* n8 = g->NewNode(common()->Return(), n7, start, n3);
+ Node* n9 = g->NewNode(common()->End(2), n6, n8);
+
+ // Dead nodes
+ Node* n10 = g->NewNode(common()->Branch(), n1, n3);
+ Node* n11 = g->NewNode(common()->IfTrue(), n10);
+ Node* n12 = g->NewNode(common()->IfFalse(), n10);
+ Node* n13 = g->NewNode(common()->Merge(2), n11, n12);
+ Node* n14 =
+ g->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), n1, n7, n13);
+
+ USE(n14);
+
+ g->SetEnd(n9);
+
+ ComputeAndVerifySchedule(10);
+}
TARGET_TEST_F(SchedulerTest, FloatingDiamond2) {
Node* start = graph()->NewNode(common()->Start(2));
diff --git a/test/unittests/compiler/select-lowering-unittest.cc b/test/unittests/compiler/select-lowering-unittest.cc
deleted file mode 100644
index 43cfd84..0000000
--- a/test/unittests/compiler/select-lowering-unittest.cc
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2014 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/compiler/select-lowering.h"
-#include "test/unittests/compiler/graph-unittest.h"
-#include "test/unittests/compiler/node-test-utils.h"
-#include "testing/gmock-support.h"
-
-using testing::AllOf;
-using testing::Capture;
-using testing::CaptureEq;
-using testing::Not;
-
-namespace v8 {
-namespace internal {
-namespace compiler {
-
-class SelectLoweringTest : public GraphTest {
- public:
- SelectLoweringTest() : GraphTest(5), lowering_(graph(), common()) {}
-
- protected:
- Reduction Reduce(Node* node) { return lowering_.Reduce(node); }
-
- private:
- SelectLowering lowering_;
-};
-
-
-TEST_F(SelectLoweringTest, SelectWithSameConditions) {
- Node* const p0 = Parameter(0);
- Node* const p1 = Parameter(1);
- Node* const p2 = Parameter(2);
- Node* const p3 = Parameter(3);
- Node* const p4 = Parameter(4);
- Node* const s0 = graph()->NewNode(
- common()->Select(MachineRepresentation::kWord32), p0, p1, p2);
-
- Capture<Node*> branch;
- Capture<Node*> merge;
- {
- Reduction const r = Reduce(s0);
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(
- r.replacement(),
- IsPhi(
- MachineRepresentation::kWord32, p1, p2,
- AllOf(CaptureEq(&merge),
- IsMerge(IsIfTrue(CaptureEq(&branch)),
- IsIfFalse(AllOf(CaptureEq(&branch),
- IsBranch(p0, graph()->start())))))));
- }
- {
- Reduction const r = Reduce(graph()->NewNode(
- common()->Select(MachineRepresentation::kWord32), p0, p3, p4));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, p3, p4,
- CaptureEq(&merge)));
- }
- {
- // We must not reuse the diamond if it is reachable from either else/then
- // values of the Select, because the resulting graph can not be scheduled.
- Reduction const r = Reduce(graph()->NewNode(
- common()->Select(MachineRepresentation::kWord32), p0, s0, p0));
- ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsPhi(MachineRepresentation::kWord32, s0, p0,
- Not(CaptureEq(&merge))));
- }
-}
-
-} // namespace compiler
-} // namespace internal
-} // namespace v8
diff --git a/test/unittests/compiler/zone-pool-unittest.cc b/test/unittests/compiler/zone-pool-unittest.cc
index 3bfde4b..47f1cc5 100644
--- a/test/unittests/compiler/zone-pool-unittest.cc
+++ b/test/unittests/compiler/zone-pool-unittest.cc
@@ -12,7 +12,7 @@
class ZonePoolTest : public TestWithIsolate {
public:
- ZonePoolTest() {}
+ ZonePoolTest() : zone_pool_(&allocator_) {}
protected:
ZonePool* zone_pool() { return &zone_pool_; }
@@ -38,6 +38,7 @@
}
private:
+ base::AccountingAllocator allocator_;
ZonePool zone_pool_;
base::RandomNumberGenerator rng;
};