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

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

Issue 437183002: Make start node a value input to parameter nodes. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add start node as input to parameter nodes. Created 6 years, 4 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 | Annotate | Revision Log
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 "src/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/graph-inl.h" 8 #include "src/compiler/graph-inl.h"
9 #include "src/compiler/js-typed-lowering.h" 9 #include "src/compiler/js-typed-lowering.h"
10 #include "src/compiler/node-properties-inl.h" 10 #include "src/compiler/node-properties-inl.h"
11 #include "src/compiler/opcodes.h" 11 #include "src/compiler/opcodes.h"
12 #include "src/compiler/typer.h" 12 #include "src/compiler/typer.h"
13 13
14 using namespace v8::internal; 14 using namespace v8::internal;
15 using namespace v8::internal::compiler; 15 using namespace v8::internal::compiler;
16 16
17 class JSTypedLoweringTester : public HandleAndZoneScope { 17 class JSTypedLoweringTester : public HandleAndZoneScope {
18 public: 18 public:
19 JSTypedLoweringTester() 19 explicit JSTypedLoweringTester(int num_parameters = 0)
20 : isolate(main_isolate()), 20 : isolate(main_isolate()),
21 binop(NULL), 21 binop(NULL),
22 unop(NULL), 22 unop(NULL),
23 javascript(main_zone()), 23 javascript(main_zone()),
24 machine(main_zone()), 24 machine(main_zone()),
25 simplified(main_zone()), 25 simplified(main_zone()),
26 common(main_zone()), 26 common(main_zone()),
27 graph(main_zone()), 27 graph(main_zone()),
28 typer(main_zone()), 28 typer(main_zone()),
29 source_positions(&graph), 29 source_positions(&graph),
30 context_node(NULL) { 30 context_node(NULL) {
31 typer.DecorateGraph(&graph); 31 typer.DecorateGraph(&graph);
32 Node* s = graph.NewNode(common.Start(num_parameters));
33 graph.SetStart(s);
32 } 34 }
33 35
34 Isolate* isolate; 36 Isolate* isolate;
35 Operator* binop; 37 Operator* binop;
36 Operator* unop; 38 Operator* unop;
37 JSOperatorBuilder javascript; 39 JSOperatorBuilder javascript;
38 MachineOperatorBuilder machine; 40 MachineOperatorBuilder machine;
39 SimplifiedOperatorBuilder simplified; 41 SimplifiedOperatorBuilder simplified;
40 CommonOperatorBuilder common; 42 CommonOperatorBuilder common;
41 Graph graph; 43 Graph graph;
42 Typer typer; 44 Typer typer;
43 SourcePositionTable source_positions; 45 SourcePositionTable source_positions;
44 Node* context_node; 46 Node* context_node;
45 47
46 Node* Parameter(Type* t, int32_t index = 0) { 48 Node* Parameter(Type* t, int32_t index = 0) {
47 Node* n = graph.NewNode(common.Parameter(index)); 49 Node* n = graph.NewNode(common.Parameter(index), graph.start());
48 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); 50 NodeProperties::SetBounds(n, Bounds(Type::None(), t));
49 return n; 51 return n;
50 } 52 }
51 53
52 Node* reduce(Node* node) { 54 Node* reduce(Node* node) {
53 JSGraph jsgraph(&graph, &common, &typer); 55 JSGraph jsgraph(&graph, &common, &typer);
54 JSTypedLowering reducer(&jsgraph, &source_positions); 56 JSTypedLowering reducer(&jsgraph, &source_positions);
55 Reduction reduction = reducer.Reduce(node); 57 Reduction reduction = reducer.Reduce(node);
56 if (reduction.Changed()) return reduction.replacement(); 58 if (reduction.Changed()) return reduction.replacement();
57 return node; 59 return node;
58 } 60 }
59 61
60 Node* start() { 62 Node* start() { return graph.start(); }
61 Node* s = graph.start();
62 if (s == NULL) {
63 s = graph.NewNode(common.Start());
64 graph.SetStart(s);
65 }
66 return s;
67 }
68 63
69 Node* context() { 64 Node* context() {
70 if (context_node == NULL) { 65 if (context_node == NULL) {
71 context_node = graph.NewNode(common.Parameter(-1)); 66 context_node = graph.NewNode(common.Parameter(-1), graph.start());
72 } 67 }
73 return context_node; 68 return context_node;
74 } 69 }
75 70
76 Node* control() { return start(); } 71 Node* control() { return start(); }
77 72
78 void CheckPureBinop(IrOpcode::Value expected, Node* node) { 73 void CheckPureBinop(IrOpcode::Value expected, Node* node) {
79 CHECK_EQ(expected, node->opcode()); 74 CHECK_EQ(expected, node->opcode());
80 CHECK_EQ(2, node->InputCount()); // should not have context, effect, etc. 75 CHECK_EQ(2, node->InputCount()); // should not have context, effect, etc.
81 } 76 }
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 CHECK_EQ(p1, r->InputAt(0)); 1333 CHECK_EQ(p1, r->InputAt(0));
1339 CHECK_EQ(p0, r->InputAt(1)); 1334 CHECK_EQ(p0, r->InputAt(1));
1340 } else { 1335 } else {
1341 CHECK_EQ(p0, r->InputAt(0)); 1336 CHECK_EQ(p0, r->InputAt(0));
1342 CHECK_EQ(p1, r->InputAt(1)); 1337 CHECK_EQ(p1, r->InputAt(1));
1343 } 1338 }
1344 } 1339 }
1345 } 1340 }
1346 } 1341 }
1347 } 1342 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-js-context-specialization.cc ('k') | test/cctest/compiler/test-machine-operator-reducer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698