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

Unified Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 1439473003: [turbofan] Move simplified alloc, load and store lowering to change lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: A bit of cement. Created 5 years, 1 month 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/compiler/simplified-lowering.cc ('k') | test/unittests/compiler/change-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/compiler/test-simplified-lowering.cc
diff --git a/test/cctest/compiler/test-simplified-lowering.cc b/test/cctest/compiler/test-simplified-lowering.cc
index 20bfc0f7315f8e381026206fe3804b0053193281..7a06c263ba836ef5c3f9af9f2f1fe2db9ae74e02 100644
--- a/test/cctest/compiler/test-simplified-lowering.cc
+++ b/test/cctest/compiler/test-simplified-lowering.cc
@@ -111,7 +111,7 @@ TEST(RunNumberToInt32_float64) {
kMachInt32};
t.StoreField(store, t.PointerConstant(&result), convert);
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
FOR_FLOAT64_INPUTS(i) {
@@ -138,7 +138,7 @@ TEST(RunNumberToUint32_float64) {
kMachUint32};
t.StoreField(store, t.PointerConstant(&result), convert);
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
FOR_FLOAT64_INPUTS(i) {
@@ -165,7 +165,7 @@ TEST(RunLoadMap) {
Node* load = t.LoadField(access, t.Parameter(0));
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<JSObject> src = TestObject();
@@ -181,7 +181,7 @@ TEST(RunStoreMap) {
t.StoreField(access, t.Parameter(1), t.Parameter(0));
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<JSObject> src = TestObject();
@@ -199,7 +199,7 @@ TEST(RunLoadProperties) {
Node* load = t.LoadField(access, t.Parameter(0));
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<JSObject> src = TestObject();
@@ -216,7 +216,7 @@ TEST(RunLoadStoreMap) {
t.StoreField(access, t.Parameter(1), load);
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<JSObject> src = TestObject();
@@ -237,7 +237,7 @@ TEST(RunLoadStoreFixedArrayIndex) {
t.StoreElement(access, t.Parameter(0), t.Int32Constant(1), load);
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<FixedArray> array = t.factory()->NewFixedArray(2);
@@ -266,7 +266,7 @@ TEST(RunLoadStoreArrayBuffer) {
load);
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Handle<JSArrayBuffer> array = t.factory()->NewJSArrayBuffer();
@@ -298,7 +298,7 @@ TEST(RunLoadFieldFromUntaggedBase) {
SimplifiedLoweringTester<Object*> t;
Node* load = t.LoadField(access, t.PointerConstant(smis));
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
for (int j = -5; j <= 5; j++) {
Smi* expected = Smi::FromInt(j);
@@ -321,7 +321,7 @@ TEST(RunStoreFieldToUntaggedBase) {
Node* p0 = t.Parameter(0);
t.StoreField(access, t.PointerConstant(smis), p0);
t.Return(p0);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
for (int j = -5; j <= 5; j++) {
Smi* expected = Smi::FromInt(j);
@@ -347,7 +347,7 @@ TEST(RunLoadElementFromUntaggedBase) {
Node* load = t.LoadElement(access, t.PointerConstant(smis),
t.Int32Constant(static_cast<int>(j)));
t.Return(load);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
for (int k = -5; k <= 5; k++) {
Smi* expected = Smi::FromInt(k);
@@ -374,7 +374,7 @@ TEST(RunStoreElementFromUntaggedBase) {
t.StoreElement(access, t.PointerConstant(smis),
t.Int32Constant(static_cast<int>(j)), p0);
t.Return(p0);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
for (int k = -5; k <= 5; k++) {
Smi* expected = Smi::FromInt(k);
@@ -439,7 +439,7 @@ class AccessTester : public HandleAndZoneScope {
Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index));
t.StoreElement(access, ptr, t.Int32Constant(to_index), load);
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Object* result = t.Call();
@@ -459,7 +459,7 @@ class AccessTester : public HandleAndZoneScope {
Node* load = t.LoadField(from_access, ptr);
t.StoreField(to_access, ptr, load);
t.Return(t.jsgraph.TrueConstant());
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
Object* result = t.Call();
@@ -651,7 +651,7 @@ TEST(RunAllocate) {
t.StoreField(access, alloc, map);
t.Return(alloc);
- t.LowerAllNodes();
+ t.LowerAllNodesAndLowerChanges();
t.GenerateCode();
HeapObject* result = t.CallWithPotentialGC<HeapObject>();
@@ -682,7 +682,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
javascript(main_zone()),
jsgraph(main_isolate(), graph(), common(), &javascript, simplified(),
machine()) {
- start = graph()->NewNode(common()->Start(2));
+ start = graph()->NewNode(common()->Start(4));
graph()->SetStart(start);
ret =
graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start);
@@ -723,6 +723,17 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes();
}
+ void LowerAllNodesAndLowerChanges() {
+ SourcePositionTable table(jsgraph.graph());
+ SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes();
+
+ ChangeLowering lowering(&jsgraph);
+ GraphReducer reducer(this->zone(), this->graph());
+ reducer.AddReducer(&lowering);
+ reducer.ReduceGraph();
+ Verifier::Run(this->graph());
+ }
+
// Inserts the node as the return value of the graph.
Node* Return(Node* node) {
ret->ReplaceInput(0, node);
@@ -1368,7 +1379,7 @@ TEST(LowerLoadField_to_load) {
t.start, t.start);
Node* use = t.Use(load, kMachineReps[i]);
t.Return(use);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kLoad, load->opcode());
CHECK_EQ(t.p0, load->InputAt(0));
CheckFieldAccessArithmetic(access, load);
@@ -1392,7 +1403,7 @@ TEST(LowerStoreField_to_store) {
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
val, t.start, t.start);
t.Effect(store);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kStore, store->opcode());
CHECK_EQ(val, store->InputAt(2));
CheckFieldAccessArithmetic(access, store);
@@ -1414,7 +1425,7 @@ TEST(LowerStoreField_to_store) {
Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0,
t.p1, t.start, t.start);
t.Effect(store);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kStore, store->opcode());
CHECK_EQ(t.p1, store->InputAt(2));
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
@@ -1434,7 +1445,7 @@ TEST(LowerLoadElement_to_load) {
t.p1, t.start, t.start);
Node* use = t.Use(load, kMachineReps[i]);
t.Return(use);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kLoad, load->opcode());
CHECK_EQ(t.p0, load->InputAt(0));
CheckElementAccessArithmetic(access, load);
@@ -1457,7 +1468,7 @@ TEST(LowerStoreElement_to_store) {
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access),
t.p0, t.p1, val, t.start, t.start);
t.Effect(store);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kStore, store->opcode());
CHECK_EQ(val, store->InputAt(2));
CheckElementAccessArithmetic(access, store);
@@ -1480,7 +1491,7 @@ TEST(LowerStoreElement_to_store) {
Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0,
t.p1, t.p2, t.start, t.start);
t.Effect(store);
- t.Lower();
+ t.LowerAllNodesAndLowerChanges();
CHECK_EQ(IrOpcode::kStore, store->opcode());
CHECK_EQ(t.p2, store->InputAt(2));
StoreRepresentation rep = OpParameter<StoreRepresentation>(store);
@@ -1500,11 +1511,9 @@ TEST(InsertChangeForLoadElementIndex) {
t.p1, t.start, t.start);
t.Return(load);
t.Lower();
- CHECK_EQ(IrOpcode::kLoad, load->opcode());
+ CHECK_EQ(IrOpcode::kLoadElement, load->opcode());
CHECK_EQ(t.p0, load->InputAt(0));
-
- Node* index = CheckElementAccessArithmetic(access, load);
- CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index);
+ CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, load->InputAt(1));
}
@@ -1520,11 +1529,9 @@ TEST(InsertChangeForStoreElementIndex) {
t.jsgraph.TrueConstant(), t.start, t.start);
t.Effect(store);
t.Lower();
- CHECK_EQ(IrOpcode::kStore, store->opcode());
+ CHECK_EQ(IrOpcode::kStoreElement, store->opcode());
CHECK_EQ(t.p0, store->InputAt(0));
-
- Node* index = CheckElementAccessArithmetic(access, store);
- CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, index);
+ CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, store->InputAt(1));
}
@@ -1538,7 +1545,7 @@ TEST(InsertChangeForLoadElement) {
t.p1, t.start, t.start);
t.Return(load);
t.Lower();
- CHECK_EQ(IrOpcode::kLoad, load->opcode());
+ CHECK_EQ(IrOpcode::kLoadElement, load->opcode());
CHECK_EQ(t.p0, load->InputAt(0));
CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0));
}
@@ -1554,7 +1561,7 @@ TEST(InsertChangeForLoadField) {
t.start, t.start);
t.Return(load);
t.Lower();
- CHECK_EQ(IrOpcode::kLoad, load->opcode());
+ CHECK_EQ(IrOpcode::kLoadField, load->opcode());
CHECK_EQ(t.p0, load->InputAt(0));
CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0));
}
@@ -1572,7 +1579,7 @@ TEST(InsertChangeForStoreElement) {
t.Effect(store);
t.Lower();
- CHECK_EQ(IrOpcode::kStore, store->opcode());
+ CHECK_EQ(IrOpcode::kStoreElement, store->opcode());
CHECK_EQ(t.p0, store->InputAt(0));
CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2));
}
@@ -1589,9 +1596,9 @@ TEST(InsertChangeForStoreField) {
t.Effect(store);
t.Lower();
- CHECK_EQ(IrOpcode::kStore, store->opcode());
+ CHECK_EQ(IrOpcode::kStoreField, store->opcode());
CHECK_EQ(t.p0, store->InputAt(0));
- CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2));
+ CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(1));
}
@@ -1628,13 +1635,13 @@ TEST(RunNumberDivide_minus_1_TruncatingToInt32) {
Node* trunc = t.NumberToInt32(div);
t.Return(trunc);
- t.LowerAllNodesAndLowerChanges();
- t.GenerateCode();
+ t.LowerAllNodesAndLowerChanges();
+ t.GenerateCode();
- FOR_INT32_INPUTS(i) {
- int32_t x = 0 - *i;
- t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
- }
+ FOR_INT32_INPUTS(i) {
+ int32_t x = 0 - *i;
+ t.CheckNumberCall(static_cast<double>(x), static_cast<double>(*i));
+ }
}
« no previous file with comments | « src/compiler/simplified-lowering.cc ('k') | test/unittests/compiler/change-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698