| 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 // TODO(jochen): Remove this after the setting is turned on globally. | 5 // TODO(jochen): Remove this after the setting is turned on globally. |
| 6 #define V8_IMMINENT_DEPRECATION_WARNINGS | 6 #define V8_IMMINENT_DEPRECATION_WARNINGS |
| 7 | 7 |
| 8 #include "src/compilation-dependencies.h" |
| 8 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
| 9 #include "src/compiler/js-typed-lowering.h" | 10 #include "src/compiler/js-typed-lowering.h" |
| 10 #include "src/compiler/machine-operator.h" | 11 #include "src/compiler/machine-operator.h" |
| 11 #include "src/compiler/node-properties.h" | 12 #include "src/compiler/node-properties.h" |
| 12 #include "src/compiler/opcodes.h" | 13 #include "src/compiler/opcodes.h" |
| 13 #include "src/compiler/operator-properties.h" | 14 #include "src/compiler/operator-properties.h" |
| 14 #include "src/compiler/simplified-operator.h" | 15 #include "src/compiler/simplified-operator.h" |
| 15 #include "src/compiler/typer.h" | 16 #include "src/compiler/typer.h" |
| 16 #include "test/cctest/cctest.h" | 17 #include "test/cctest/cctest.h" |
| 17 | 18 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 35 class JSTypedLoweringTester : public HandleAndZoneScope { | 36 class JSTypedLoweringTester : public HandleAndZoneScope { |
| 36 public: | 37 public: |
| 37 explicit JSTypedLoweringTester(int num_parameters = 0) | 38 explicit JSTypedLoweringTester(int num_parameters = 0) |
| 38 : isolate(main_isolate()), | 39 : isolate(main_isolate()), |
| 39 binop(NULL), | 40 binop(NULL), |
| 40 unop(NULL), | 41 unop(NULL), |
| 41 javascript(main_zone()), | 42 javascript(main_zone()), |
| 42 machine(main_zone()), | 43 machine(main_zone()), |
| 43 simplified(main_zone()), | 44 simplified(main_zone()), |
| 44 common(main_zone()), | 45 common(main_zone()), |
| 46 deps(main_isolate(), main_zone()), |
| 45 graph(main_zone()), | 47 graph(main_zone()), |
| 46 typer(main_isolate(), &graph), | 48 typer(main_isolate(), &graph), |
| 47 context_node(NULL) { | 49 context_node(NULL) { |
| 48 graph.SetStart(graph.NewNode(common.Start(num_parameters))); | 50 graph.SetStart(graph.NewNode(common.Start(num_parameters))); |
| 49 graph.SetEnd(graph.NewNode(common.End(1), graph.start())); | 51 graph.SetEnd(graph.NewNode(common.End(1), graph.start())); |
| 50 typer.Run(); | 52 typer.Run(); |
| 51 } | 53 } |
| 52 | 54 |
| 53 Isolate* isolate; | 55 Isolate* isolate; |
| 54 const Operator* binop; | 56 const Operator* binop; |
| 55 const Operator* unop; | 57 const Operator* unop; |
| 56 JSOperatorBuilder javascript; | 58 JSOperatorBuilder javascript; |
| 57 MachineOperatorBuilder machine; | 59 MachineOperatorBuilder machine; |
| 58 SimplifiedOperatorBuilder simplified; | 60 SimplifiedOperatorBuilder simplified; |
| 59 CommonOperatorBuilder common; | 61 CommonOperatorBuilder common; |
| 62 CompilationDependencies deps; |
| 60 Graph graph; | 63 Graph graph; |
| 61 Typer typer; | 64 Typer typer; |
| 62 Node* context_node; | 65 Node* context_node; |
| 63 | 66 |
| 64 Node* Parameter(Type* t, int32_t index = 0) { | 67 Node* Parameter(Type* t, int32_t index = 0) { |
| 65 Node* n = graph.NewNode(common.Parameter(index), graph.start()); | 68 Node* n = graph.NewNode(common.Parameter(index), graph.start()); |
| 66 NodeProperties::SetType(n, t); | 69 NodeProperties::SetType(n, t); |
| 67 return n; | 70 return n; |
| 68 } | 71 } |
| 69 | 72 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 87 parameters, locals, stack, context, UndefinedConstant(), graph.start()); | 90 parameters, locals, stack, context, UndefinedConstant(), graph.start()); |
| 88 | 91 |
| 89 return state_node; | 92 return state_node; |
| 90 } | 93 } |
| 91 | 94 |
| 92 Node* reduce(Node* node) { | 95 Node* reduce(Node* node) { |
| 93 JSGraph jsgraph(main_isolate(), &graph, &common, &javascript, &simplified, | 96 JSGraph jsgraph(main_isolate(), &graph, &common, &javascript, &simplified, |
| 94 &machine); | 97 &machine); |
| 95 // TODO(titzer): mock the GraphReducer here for better unit testing. | 98 // TODO(titzer): mock the GraphReducer here for better unit testing. |
| 96 GraphReducer graph_reducer(main_zone(), &graph); | 99 GraphReducer graph_reducer(main_zone(), &graph); |
| 97 JSTypedLowering reducer(&graph_reducer, &jsgraph, main_zone()); | 100 JSTypedLowering reducer(&graph_reducer, &deps, |
| 101 JSTypedLowering::kDeoptimizationEnabled, &jsgraph, |
| 102 main_zone()); |
| 98 Reduction reduction = reducer.Reduce(node); | 103 Reduction reduction = reducer.Reduce(node); |
| 99 if (reduction.Changed()) return reduction.replacement(); | 104 if (reduction.Changed()) return reduction.replacement(); |
| 100 return node; | 105 return node; |
| 101 } | 106 } |
| 102 | 107 |
| 103 Node* start() { return graph.start(); } | 108 Node* start() { return graph.start(); } |
| 104 | 109 |
| 105 Node* context() { | 110 Node* context() { |
| 106 if (context_node == NULL) { | 111 if (context_node == NULL) { |
| 107 context_node = graph.NewNode(common.Parameter(-1), graph.start()); | 112 context_node = graph.NewNode(common.Parameter(-1), graph.start()); |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1260 CHECK_EQ(p1, r->InputAt(1)); | 1265 CHECK_EQ(p1, r->InputAt(1)); |
| 1261 } | 1266 } |
| 1262 } | 1267 } |
| 1263 } | 1268 } |
| 1264 } | 1269 } |
| 1265 } | 1270 } |
| 1266 | 1271 |
| 1267 } // namespace compiler | 1272 } // namespace compiler |
| 1268 } // namespace internal | 1273 } // namespace internal |
| 1269 } // namespace v8 | 1274 } // namespace v8 |
| OLD | NEW |