| 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/control-builders.h" | 7 #include "src/compiler/control-builders.h" |
| 8 #include "src/compiler/generic-node-inl.h" | 8 #include "src/compiler/generic-node-inl.h" |
| 9 #include "src/compiler/graph-visualizer.h" | 9 #include "src/compiler/graph-visualizer.h" |
| 10 #include "src/compiler/node-properties-inl.h" | 10 #include "src/compiler/node-properties-inl.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 = kMachineLast, | 32 SimplifiedLoweringTester(MachineType p0 = kMachineLast, |
| 33 MachineType p1 = kMachineLast, | 33 MachineType p1 = kMachineLast, |
| 34 MachineType p2 = kMachineLast, | 34 MachineType p2 = kMachineLast, |
| 35 MachineType p3 = kMachineLast, | 35 MachineType p3 = kMachineLast, |
| 36 MachineType p4 = kMachineLast) | 36 MachineType p4 = kMachineLast) |
| 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 source_positions(this->graph()), | |
| 40 jsgraph(this->graph(), this->common(), &typer), | 39 jsgraph(this->graph(), this->common(), &typer), |
| 41 lowering(&jsgraph, &source_positions) {} | 40 lowering(&jsgraph) {} |
| 42 | 41 |
| 43 Typer typer; | 42 Typer typer; |
| 44 SourcePositionTable source_positions; | |
| 45 JSGraph jsgraph; | 43 JSGraph jsgraph; |
| 46 SimplifiedLowering lowering; | 44 SimplifiedLowering lowering; |
| 47 | 45 |
| 48 void LowerAllNodes() { | 46 void LowerAllNodes() { |
| 49 this->End(); | 47 this->End(); |
| 50 lowering.LowerAllNodes(); | 48 lowering.LowerAllNodes(); |
| 51 } | 49 } |
| 52 | 50 |
| 53 Factory* factory() { return this->isolate()->factory(); } | 51 Factory* factory() { return this->isolate()->factory(); } |
| 54 Heap* heap() { return this->isolate()->heap(); } | 52 Heap* heap() { return this->isolate()->heap(); } |
| (...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 | 636 |
| 639 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, Operator* op, | 637 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, Operator* op, |
| 640 Operator* trunc) { | 638 Operator* trunc) { |
| 641 Node* node = graph()->NewNode(op, p0, p1); | 639 Node* node = graph()->NewNode(op, p0, p1); |
| 642 Return(graph()->NewNode(trunc, node)); | 640 Return(graph()->NewNode(trunc, node)); |
| 643 Lower(); | 641 Lower(); |
| 644 CHECK_EQ(expected, node->opcode()); | 642 CHECK_EQ(expected, node->opcode()); |
| 645 } | 643 } |
| 646 | 644 |
| 647 void Lower() { | 645 void Lower() { |
| 648 SimplifiedLowering lowering(&jsgraph, NULL); | 646 SimplifiedLowering lowering(&jsgraph); |
| 649 lowering.LowerAllNodes(); | 647 lowering.LowerAllNodes(); |
| 650 } | 648 } |
| 651 | 649 |
| 652 // Inserts the node as the return value of the graph. | 650 // Inserts the node as the return value of the graph. |
| 653 Node* Return(Node* node) { | 651 Node* Return(Node* node) { |
| 654 ret->ReplaceInput(0, node); | 652 ret->ReplaceInput(0, node); |
| 655 return node; | 653 return node; |
| 656 } | 654 } |
| 657 | 655 |
| 658 // Inserts the node as the effect input to the return of the graph. | 656 // Inserts the node as the effect input to the return of the graph. |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 | 1361 |
| 1364 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, | 1362 Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, |
| 1365 t.p1, t.start, t.start); | 1363 t.p1, t.start, t.start); |
| 1366 t.Effect(store); | 1364 t.Effect(store); |
| 1367 t.Lower(); | 1365 t.Lower(); |
| 1368 | 1366 |
| 1369 CHECK_EQ(IrOpcode::kStore, store->opcode()); | 1367 CHECK_EQ(IrOpcode::kStore, store->opcode()); |
| 1370 CHECK_EQ(t.p0, store->InputAt(0)); | 1368 CHECK_EQ(t.p0, store->InputAt(0)); |
| 1371 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); | 1369 CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); |
| 1372 } | 1370 } |
| OLD | NEW |