| 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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
| 8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
| 9 #include "src/compiler/change-lowering.h" | |
| 10 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
| 11 #include "src/compiler/effect-control-linearizer.h" | 10 #include "src/compiler/effect-control-linearizer.h" |
| 12 #include "src/compiler/graph-reducer.h" | |
| 13 #include "src/compiler/graph-visualizer.h" | 11 #include "src/compiler/graph-visualizer.h" |
| 12 #include "src/compiler/memory-optimizer.h" |
| 14 #include "src/compiler/node-properties.h" | 13 #include "src/compiler/node-properties.h" |
| 15 #include "src/compiler/pipeline.h" | 14 #include "src/compiler/pipeline.h" |
| 16 #include "src/compiler/representation-change.h" | 15 #include "src/compiler/representation-change.h" |
| 17 #include "src/compiler/scheduler.h" | 16 #include "src/compiler/scheduler.h" |
| 18 #include "src/compiler/simplified-lowering.h" | 17 #include "src/compiler/simplified-lowering.h" |
| 19 #include "src/compiler/source-position.h" | 18 #include "src/compiler/source-position.h" |
| 20 #include "src/compiler/typer.h" | 19 #include "src/compiler/typer.h" |
| 21 #include "src/compiler/verifier.h" | 20 #include "src/compiler/verifier.h" |
| 22 #include "src/execution.h" | 21 #include "src/execution.h" |
| 23 #include "src/parsing/parser.h" | 22 #include "src/parsing/parser.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void LowerAllNodesAndLowerChanges() { | 59 void LowerAllNodesAndLowerChanges() { |
| 61 this->End(); | 60 this->End(); |
| 62 typer.Run(); | 61 typer.Run(); |
| 63 lowering.LowerAllNodes(); | 62 lowering.LowerAllNodes(); |
| 64 | 63 |
| 65 Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), | 64 Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), |
| 66 Scheduler::kNoFlags); | 65 Scheduler::kNoFlags); |
| 67 EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); | 66 EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); |
| 68 linearizer.Run(); | 67 linearizer.Run(); |
| 69 | 68 |
| 70 GraphReducer reducer(this->zone(), this->graph()); | 69 MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); |
| 71 ChangeLowering lowering(&reducer, &jsgraph); | 70 memory_optimizer.Optimize(); |
| 72 reducer.AddReducer(&lowering); | |
| 73 reducer.ReduceGraph(); | |
| 74 Verifier::Run(this->graph()); | |
| 75 } | 71 } |
| 76 | 72 |
| 77 void CheckNumberCall(double expected, double input) { | 73 void CheckNumberCall(double expected, double input) { |
| 78 // TODO(titzer): make calls to NewNumber work in cctests. | 74 // TODO(titzer): make calls to NewNumber work in cctests. |
| 79 if (expected <= Smi::kMinValue) return; | 75 if (expected <= Smi::kMinValue) return; |
| 80 if (expected >= Smi::kMaxValue) return; | 76 if (expected >= Smi::kMaxValue) return; |
| 81 Handle<Object> num = factory()->NewNumber(input); | 77 Handle<Object> num = factory()->NewNumber(input); |
| 82 Object* result = this->Call(*num); | 78 Object* result = this->Call(*num); |
| 83 CHECK(factory()->NewNumber(expected)->SameValue(result)); | 79 CHECK(factory()->NewNumber(expected)->SameValue(result)); |
| 84 } | 80 } |
| (...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 | 742 |
| 747 void LowerAllNodesAndLowerChanges() { | 743 void LowerAllNodesAndLowerChanges() { |
| 748 SourcePositionTable table(jsgraph.graph()); | 744 SourcePositionTable table(jsgraph.graph()); |
| 749 SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); | 745 SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); |
| 750 | 746 |
| 751 Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), | 747 Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), |
| 752 Scheduler::kNoFlags); | 748 Scheduler::kNoFlags); |
| 753 EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); | 749 EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); |
| 754 linearizer.Run(); | 750 linearizer.Run(); |
| 755 | 751 |
| 756 GraphReducer reducer(this->zone(), this->graph()); | 752 MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); |
| 757 ChangeLowering lowering(&reducer, &jsgraph); | 753 memory_optimizer.Optimize(); |
| 758 reducer.AddReducer(&lowering); | |
| 759 reducer.ReduceGraph(); | |
| 760 Verifier::Run(this->graph()); | |
| 761 } | 754 } |
| 762 | 755 |
| 763 // Inserts the node as the return value of the graph. | 756 // Inserts the node as the return value of the graph. |
| 764 Node* Return(Node* node) { | 757 Node* Return(Node* node) { |
| 765 ret->ReplaceInput(0, node); | 758 ret->ReplaceInput(0, node); |
| 766 return node; | 759 return node; |
| 767 } | 760 } |
| 768 | 761 |
| 769 // Inserts the node as the effect input to the return of the graph. | 762 // Inserts the node as the effect input to the return of the graph. |
| 770 void Effect(Node* node) { ret->ReplaceInput(1, node); } | 763 void Effect(Node* node) { ret->ReplaceInput(1, node); } |
| (...skipping 1186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 t.Return(use); | 1950 t.Return(use); |
| 1958 t.Lower(); | 1951 t.Lower(); |
| 1959 | 1952 |
| 1960 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); | 1953 CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); |
| 1961 } | 1954 } |
| 1962 } | 1955 } |
| 1963 | 1956 |
| 1964 } // namespace compiler | 1957 } // namespace compiler |
| 1965 } // namespace internal | 1958 } // namespace internal |
| 1966 } // namespace v8 | 1959 } // namespace v8 |
| OLD | NEW |