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

Side by Side Diff: test/cctest/compiler/test-simplified-lowering.cc

Issue 897883002: [turbofan]: Improved source position information (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Review feedback Created 5 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « src/compiler/typer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/change-lowering.h" 8 #include "src/compiler/change-lowering.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/graph-reducer.h" 10 #include "src/compiler/graph-reducer.h"
11 #include "src/compiler/graph-visualizer.h" 11 #include "src/compiler/graph-visualizer.h"
12 #include "src/compiler/node-properties.h" 12 #include "src/compiler/node-properties.h"
13 #include "src/compiler/pipeline.h" 13 #include "src/compiler/pipeline.h"
14 #include "src/compiler/representation-change.h" 14 #include "src/compiler/representation-change.h"
15 #include "src/compiler/simplified-lowering.h" 15 #include "src/compiler/simplified-lowering.h"
16 #include "src/compiler/source-position.h"
16 #include "src/compiler/typer.h" 17 #include "src/compiler/typer.h"
17 #include "src/compiler/verifier.h" 18 #include "src/compiler/verifier.h"
18 #include "src/execution.h" 19 #include "src/execution.h"
19 #include "src/parser.h" 20 #include "src/parser.h"
20 #include "src/rewriter.h" 21 #include "src/rewriter.h"
21 #include "src/scopes.h" 22 #include "src/scopes.h"
22 #include "test/cctest/cctest.h" 23 #include "test/cctest/cctest.h"
23 #include "test/cctest/compiler/codegen-tester.h" 24 #include "test/cctest/compiler/codegen-tester.h"
24 #include "test/cctest/compiler/graph-builder-tester.h" 25 #include "test/cctest/compiler/graph-builder-tester.h"
25 #include "test/cctest/compiler/value-helper.h" 26 #include "test/cctest/compiler/value-helper.h"
26 27
27 using namespace v8::internal; 28 using namespace v8::internal;
28 using namespace v8::internal::compiler; 29 using namespace v8::internal::compiler;
29 30
30 template <typename ReturnType> 31 template <typename ReturnType>
31 class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { 32 class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
32 public: 33 public:
33 SimplifiedLoweringTester(MachineType p0 = kMachNone, 34 SimplifiedLoweringTester(MachineType p0 = kMachNone,
34 MachineType p1 = kMachNone, 35 MachineType p1 = kMachNone,
35 MachineType p2 = kMachNone, 36 MachineType p2 = kMachNone,
36 MachineType p3 = kMachNone, 37 MachineType p3 = kMachNone,
37 MachineType p4 = kMachNone) 38 MachineType p4 = kMachNone)
38 : GraphBuilderTester<ReturnType>(p0, p1, p2, p3, p4), 39 : GraphBuilderTester<ReturnType>(p0, p1, p2, p3, p4),
39 typer(this->isolate(), this->graph(), MaybeHandle<Context>()), 40 typer(this->isolate(), this->graph(), MaybeHandle<Context>()),
40 javascript(this->zone()), 41 javascript(this->zone()),
41 jsgraph(this->isolate(), this->graph(), this->common(), &javascript, 42 jsgraph(this->isolate(), this->graph(), this->common(), &javascript,
42 this->machine()), 43 this->machine()),
43 lowering(&jsgraph, this->zone()) {} 44 source_positions(jsgraph.graph()),
45 lowering(&jsgraph, this->zone(), &source_positions) {}
44 46
45 Typer typer; 47 Typer typer;
46 JSOperatorBuilder javascript; 48 JSOperatorBuilder javascript;
47 JSGraph jsgraph; 49 JSGraph jsgraph;
50 SourcePositionTable source_positions;
48 SimplifiedLowering lowering; 51 SimplifiedLowering lowering;
49 52
50 void LowerAllNodes() { 53 void LowerAllNodes() {
51 this->End(); 54 this->End();
52 typer.Run(); 55 typer.Run();
53 lowering.LowerAllNodes(); 56 lowering.LowerAllNodes();
54 } 57 }
55 58
56 void LowerAllNodesAndLowerChanges() { 59 void LowerAllNodesAndLowerChanges() {
57 this->End(); 60 this->End();
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 } 695 }
693 696
694 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op, 697 void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op,
695 const Operator* trunc) { 698 const Operator* trunc) {
696 Node* node = graph()->NewNode(op, p0, p1); 699 Node* node = graph()->NewNode(op, p0, p1);
697 Return(graph()->NewNode(trunc, node)); 700 Return(graph()->NewNode(trunc, node));
698 Lower(); 701 Lower();
699 CHECK_EQ(expected, node->opcode()); 702 CHECK_EQ(expected, node->opcode());
700 } 703 }
701 704
702 void Lower() { SimplifiedLowering(&jsgraph, jsgraph.zone()).LowerAllNodes(); } 705 void Lower() {
706 SourcePositionTable table(jsgraph.graph());
707 SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes();
708 }
703 709
704 // Inserts the node as the return value of the graph. 710 // Inserts the node as the return value of the graph.
705 Node* Return(Node* node) { 711 Node* Return(Node* node) {
706 ret->ReplaceInput(0, node); 712 ret->ReplaceInput(0, node);
707 return node; 713 return node;
708 } 714 }
709 715
710 // Inserts the node as the effect input to the return of the graph. 716 // Inserts the node as the effect input to the return of the graph.
711 void Effect(Node* node) { ret->ReplaceInput(1, node); } 717 void Effect(Node* node) { ret->ReplaceInput(1, node); }
712 718
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2038 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z); 2044 Bounds phi_bounds = Bounds::Either(Bounds(d.arg1), Bounds(d.arg2), z);
2039 NodeProperties::SetBounds(phi, phi_bounds); 2045 NodeProperties::SetBounds(phi, phi_bounds);
2040 2046
2041 Node* use = t.Use(phi, d.use); 2047 Node* use = t.Use(phi, d.use);
2042 t.Return(use); 2048 t.Return(use);
2043 t.Lower(); 2049 t.Lower();
2044 2050
2045 CHECK_EQ(d.expected, OpParameter<MachineType>(phi)); 2051 CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
2046 } 2052 }
2047 } 2053 }
OLDNEW
« no previous file with comments | « src/compiler/typer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698