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 javascript(this->zone()), | 39 jsgraph(this->graph(), this->common(), &typer), |
40 jsgraph(this->graph(), this->common(), &javascript, &typer, | |
41 this->machine()), | |
42 lowering(&jsgraph) {} | 40 lowering(&jsgraph) {} |
43 | 41 |
44 Typer typer; | 42 Typer typer; |
45 JSOperatorBuilder javascript; | |
46 JSGraph jsgraph; | 43 JSGraph jsgraph; |
47 SimplifiedLowering lowering; | 44 SimplifiedLowering lowering; |
48 | 45 |
49 void LowerAllNodes() { | 46 void LowerAllNodes() { |
50 this->End(); | 47 this->End(); |
51 lowering.LowerAllNodes(); | 48 lowering.LowerAllNodes(); |
52 } | 49 } |
53 | 50 |
54 Factory* factory() { return this->isolate()->factory(); } | 51 Factory* factory() { return this->isolate()->factory(); } |
55 Heap* heap() { return this->isolate()->heap(); } | 52 Heap* heap() { return this->isolate()->heap(); } |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 Smi::FromInt(0), Smi::FromInt(666), | 619 Smi::FromInt(0), Smi::FromInt(666), |
623 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; | 620 Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; |
624 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); | 621 RunAccessTest<Smi*>(kMachAnyTagged, data, arraysize(data)); |
625 } | 622 } |
626 | 623 |
627 | 624 |
628 // Fills in most of the nodes of the graph in order to make tests shorter. | 625 // Fills in most of the nodes of the graph in order to make tests shorter. |
629 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { | 626 class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { |
630 public: | 627 public: |
631 Typer typer; | 628 Typer typer; |
632 JSOperatorBuilder javascript; | |
633 JSGraph jsgraph; | 629 JSGraph jsgraph; |
634 Node* p0; | 630 Node* p0; |
635 Node* p1; | 631 Node* p1; |
636 Node* start; | 632 Node* start; |
637 Node* end; | 633 Node* end; |
638 Node* ret; | 634 Node* ret; |
639 | 635 |
640 explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None()) | 636 explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None()) |
641 : GraphAndBuilders(main_zone()), | 637 : GraphAndBuilders(main_zone()), |
642 typer(main_zone()), | 638 typer(main_zone()), |
643 javascript(main_zone()), | 639 jsgraph(graph(), common(), &typer) { |
644 jsgraph(graph(), common(), &javascript, &typer, machine()) { | |
645 start = graph()->NewNode(common()->Start(2)); | 640 start = graph()->NewNode(common()->Start(2)); |
646 graph()->SetStart(start); | 641 graph()->SetStart(start); |
647 ret = | 642 ret = |
648 graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start); | 643 graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start); |
649 end = graph()->NewNode(common()->End(), ret); | 644 end = graph()->NewNode(common()->End(), ret); |
650 graph()->SetEnd(end); | 645 graph()->SetEnd(end); |
651 p0 = graph()->NewNode(common()->Parameter(0), start); | 646 p0 = graph()->NewNode(common()->Parameter(0), start); |
652 p1 = graph()->NewNode(common()->Parameter(1), start); | 647 p1 = graph()->NewNode(common()->Parameter(1), start); |
653 NodeProperties::SetBounds(p0, Bounds(p0_type)); | 648 NodeProperties::SetBounds(p0, Bounds(p0_type)); |
654 NodeProperties::SetBounds(p1, Bounds(p1_type)); | 649 NodeProperties::SetBounds(p1, Bounds(p1_type)); |
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, | 1441 Node* phi = t.graph()->NewNode(t.common()->Phi(kMachAnyTagged, 2), load0, |
1447 load1, t.start); | 1442 load1, t.start); |
1448 t.Return(t.Use(phi, kMachineTypes[i])); | 1443 t.Return(t.Use(phi, kMachineTypes[i])); |
1449 t.Lower(); | 1444 t.Lower(); |
1450 | 1445 |
1451 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); | 1446 CHECK_EQ(IrOpcode::kPhi, phi->opcode()); |
1452 CHECK_EQ(RepresentationOf(kMachineTypes[i]), | 1447 CHECK_EQ(RepresentationOf(kMachineTypes[i]), |
1453 RepresentationOf(OpParameter<MachineType>(phi))); | 1448 RepresentationOf(OpParameter<MachineType>(phi))); |
1454 } | 1449 } |
1455 } | 1450 } |
OLD | NEW |