| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <limits> | 5 #include <limits> |
| 6 | 6 |
| 7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
| 8 #include "src/compiler/control-builders.h" | 8 #include "src/compiler/control-builders.h" |
| 9 #include "src/compiler/generic-node-inl.h" | 9 #include "src/compiler/generic-node-inl.h" |
| 10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 template <typename ReturnType> | 29 template <typename ReturnType> |
| 30 class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { | 30 class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { |
| 31 public: | 31 public: |
| 32 SimplifiedLoweringTester(MachineType p0 = kMachNone, | 32 SimplifiedLoweringTester(MachineType p0 = kMachNone, |
| 33 MachineType p1 = kMachNone, | 33 MachineType p1 = kMachNone, |
| 34 MachineType p2 = kMachNone, | 34 MachineType p2 = kMachNone, |
| 35 MachineType p3 = kMachNone, | 35 MachineType p3 = kMachNone, |
| 36 MachineType p4 = kMachNone) | 36 MachineType p4 = kMachNone) |
| 37 : GraphBuilderTester<ReturnType>(p0, p1, p2, p3, p4), | 37 : GraphBuilderTester<ReturnType>(p0, p1, p2, p3, p4), |
| 38 typer(this->zone()), | 38 typer(this->zone()), |
| 39 jsgraph(this->graph(), this->common(), &typer), | 39 javascript(this->zone()), |
| 40 jsgraph(this->graph(), this->common(), &javascript, &typer, |
| 41 this->machine()), |
| 40 lowering(&jsgraph) {} | 42 lowering(&jsgraph) {} |
| 41 | 43 |
| 42 Typer typer; | 44 Typer typer; |
| 45 JSOperatorBuilder javascript; |
| 43 JSGraph jsgraph; | 46 JSGraph jsgraph; |
| 44 SimplifiedLowering lowering; | 47 SimplifiedLowering lowering; |
| 45 | 48 |
| 46 void LowerAllNodes() { | 49 void LowerAllNodes() { |
| 47 this->End(); | 50 this->End(); |
| 48 lowering.LowerAllNodes(); | 51 lowering.LowerAllNodes(); |
| 49 } | 52 } |
| 50 | 53 |
| 51 Factory* factory() { return this->isolate()->factory(); } | 54 Factory* factory() { return this->isolate()->factory(); } |
| 52 Heap* heap() { return this->isolate()->heap(); } | 55 Heap* heap() { return this->isolate()->heap(); } |
| (...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 619 Smi::FromInt(0), Smi::FromInt(666), | 622 Smi::FromInt(0), Smi::FromInt(666), |
| 620 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; | 623 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; |
| 621 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); | 624 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); |
| 622 } | 625 } |
| 623 | 626 |
| 624 | 627 |
| 625 // Fills in most of the nodes of the graph in order to make tests shorter. | 628 // Fills in most of the nodes of the graph in order to make tests shorter. |
| 626 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { | 629 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { |
| 627 public: | 630 public: |
| 628 Typer typer; | 631 Typer typer; |
| 632 JSOperatorBuilder javascript; |
| 629 JSGraph jsgraph; | 633 JSGraph jsgraph; |
| 630 Node* p0; | 634 Node* p0; |
| 631 Node* p1; | 635 Node* p1; |
| 632 Node* start; | 636 Node* start; |
| 633 Node* end; | 637 Node* end; |
| 634 Node* ret; | 638 Node* ret; |
| 635 | 639 |
| 636 explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None()) | 640 explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None()) |
| 637 : GraphAndBuilders(main_zone()), | 641 : GraphAndBuilders(main_zone()), |
| 638 typer(main_zone()), | 642 typer(main_zone()), |
| 639 jsgraph(graph(), common(), &typer) { | 643 javascript(main_zone()), |
| 644 jsgraph(graph(), common(), &javascript, &typer, machine()) { |
| 640 start = graph()->NewNode(common()->Start(2)); | 645 start = graph()->NewNode(common()->Start(2)); |
| 641 graph()->SetStart(start); | 646 graph()->SetStart(start); |
| 642 ret = | 647 ret = |
| 643 graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start); | 648 graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start); |
| 644 end = graph()->NewNode(common()->End(), ret); | 649 end = graph()->NewNode(common()->End(), ret); |
| 645 graph()->SetEnd(end); | 650 graph()->SetEnd(end); |
| 646 p0 = graph()->NewNode(common()->Parameter(0), start); | 651 p0 = graph()->NewNode(common()->Parameter(0), start); |
| 647 p1 = graph()->NewNode(common()->Parameter(1), start); | 652 p1 = graph()->NewNode(common()->Parameter(1), start); |
| 648 NodeProperties::SetBounds(p0, Bounds(p0_type)); | 653 NodeProperties::SetBounds(p0, Bounds(p0_type)); |
| 649 NodeProperties::SetBounds(p1, Bounds(p1_type)); | 654 NodeProperties::SetBounds(p1, Bounds(p1_type)); |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, | 1446 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, |
| 1442 load1, t.start); | 1447 load1, t.start); |
| 1443 t.Return(t.Use(phi, kMachineTypes[i])); | 1448 t.Return(t.Use(phi, kMachineTypes[i])); |
| 1444 t.Lower(); | 1449 t.Lower(); |
| 1445 | 1450 |
| 1446 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); | 1451 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); |
| 1447 CHECK_EQ(RepresentationOf(kMachineTypes[i]), | 1452 CHECK_EQ(RepresentationOf(kMachineTypes[i]), |
| 1448 RepresentationOf(OpParameter<MachineType>(phi))); | 1453 RepresentationOf(OpParameter<MachineType>(phi))); |
| 1449 } | 1454 } |
| 1450 } | 1455 } |
| OLD | NEW |