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 "src/compiler/graph-inl.h" | 5 #include "src/compiler/graph-inl.h" |
6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
7 #include "src/compiler/js-typed-lowering.h" | 7 #include "src/compiler/js-typed-lowering.h" |
8 #include "src/compiler/machine-operator.h" | 8 #include "src/compiler/machine-operator.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/opcodes.h" | 10 #include "src/compiler/opcodes.h" |
11 #include "src/compiler/typer.h" | 11 #include "src/compiler/typer.h" |
12 #include "test/cctest/cctest.h" | 12 #include "test/cctest/cctest.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 explicit JSTypedLoweringTester(int num_parameters = 0) | 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(&graph, MaybeHandle<Context>()), | 28 typer(main_isolate(), &graph, MaybeHandle<Context>()), |
29 context_node(NULL) { | 29 context_node(NULL) { |
30 graph.SetStart(graph.NewNode(common.Start(num_parameters))); | 30 graph.SetStart(graph.NewNode(common.Start(num_parameters))); |
31 graph.SetEnd(graph.NewNode(common.End())); | 31 graph.SetEnd(graph.NewNode(common.End())); |
32 typer.Run(); | 32 typer.Run(); |
33 } | 33 } |
34 | 34 |
35 Isolate* isolate; | 35 Isolate* isolate; |
36 const Operator* binop; | 36 const Operator* binop; |
37 const Operator* unop; | 37 const Operator* unop; |
38 JSOperatorBuilder javascript; | 38 JSOperatorBuilder javascript; |
(...skipping 29 matching lines...) Expand all Loading... |
68 | 68 |
69 Node* state_node = | 69 Node* state_node = |
70 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0), | 70 graph.NewNode(common.FrameState(JS_FRAME, BailoutId(0), |
71 OutputFrameStateCombine::Ignore()), | 71 OutputFrameStateCombine::Ignore()), |
72 parameters, locals, stack, context, UndefinedConstant()); | 72 parameters, locals, stack, context, UndefinedConstant()); |
73 | 73 |
74 return state_node; | 74 return state_node; |
75 } | 75 } |
76 | 76 |
77 Node* reduce(Node* node) { | 77 Node* reduce(Node* node) { |
78 JSGraph jsgraph(&graph, &common, &javascript, &machine); | 78 JSGraph jsgraph(main_isolate(), &graph, &common, &javascript, &machine); |
79 JSTypedLowering reducer(&jsgraph, main_zone()); | 79 JSTypedLowering reducer(&jsgraph, main_zone()); |
80 Reduction reduction = reducer.Reduce(node); | 80 Reduction reduction = reducer.Reduce(node); |
81 if (reduction.Changed()) return reduction.replacement(); | 81 if (reduction.Changed()) return reduction.replacement(); |
82 return node; | 82 return node; |
83 } | 83 } |
84 | 84 |
85 Node* start() { return graph.start(); } | 85 Node* start() { return graph.start(); } |
86 | 86 |
87 Node* context() { | 87 Node* context() { |
88 if (context_node == NULL) { | 88 if (context_node == NULL) { |
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1280 CHECK_EQ(p1, r->InputAt(0)); | 1280 CHECK_EQ(p1, r->InputAt(0)); |
1281 CHECK_EQ(p0, r->InputAt(1)); | 1281 CHECK_EQ(p0, r->InputAt(1)); |
1282 } else { | 1282 } else { |
1283 CHECK_EQ(p0, r->InputAt(0)); | 1283 CHECK_EQ(p0, r->InputAt(0)); |
1284 CHECK_EQ(p1, r->InputAt(1)); | 1284 CHECK_EQ(p1, r->InputAt(1)); |
1285 } | 1285 } |
1286 } | 1286 } |
1287 } | 1287 } |
1288 } | 1288 } |
1289 } | 1289 } |
OLD | NEW |