| 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/pipeline.h" | 5 #include "src/compiler/pipeline.h" |
| 6 | 6 |
| 7 #include "src/base/platform/elapsed-timer.h" | 7 #include "src/base/platform/elapsed-timer.h" |
| 8 #include "src/compiler/ast-graph-builder.h" | 8 #include "src/compiler/ast-graph-builder.h" |
| 9 #include "src/compiler/code-generator.h" | 9 #include "src/compiler/code-generator.h" |
| 10 #include "src/compiler/graph-replay.h" | 10 #include "src/compiler/graph-replay.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 GraphReducer graph_reducer(&graph); | 178 GraphReducer graph_reducer(&graph); |
| 179 graph_reducer.AddReducer(&phi_reducer); | 179 graph_reducer.AddReducer(&phi_reducer); |
| 180 graph_reducer.ReduceGraph(); | 180 graph_reducer.ReduceGraph(); |
| 181 // TODO(mstarzinger): Running reducer once ought to be enough for everyone. | 181 // TODO(mstarzinger): Running reducer once ought to be enough for everyone. |
| 182 graph_reducer.ReduceGraph(); | 182 graph_reducer.ReduceGraph(); |
| 183 graph_reducer.ReduceGraph(); | 183 graph_reducer.ReduceGraph(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 VerifyAndPrintGraph(&graph, "Initial untyped"); | 186 VerifyAndPrintGraph(&graph, "Initial untyped"); |
| 187 | 187 |
| 188 JSContextSpecializer spec(info(), &jsgraph, context_node); |
| 189 |
| 188 if (FLAG_context_specialization) { | 190 if (FLAG_context_specialization) { |
| 189 SourcePositionTable::Scope pos_(&source_positions, | 191 SourcePositionTable::Scope pos_(&source_positions, |
| 190 SourcePosition::Unknown()); | 192 SourcePosition::Unknown()); |
| 191 // Specialize the code to the context as aggressively as possible. | 193 // Specialize the code to the context as aggressively as possible. |
| 192 JSContextSpecializer spec(info(), &jsgraph, context_node); | |
| 193 spec.SpecializeToContext(); | 194 spec.SpecializeToContext(); |
| 194 VerifyAndPrintGraph(&graph, "Context specialized"); | 195 VerifyAndPrintGraph(&graph, "Context specialized"); |
| 195 } | 196 } |
| 196 | 197 |
| 197 // Print a replay of the initial graph. | 198 // Print a replay of the initial graph. |
| 198 if (FLAG_print_turbo_replay) { | 199 if (FLAG_print_turbo_replay) { |
| 199 GraphReplayPrinter::PrintReplay(&graph); | 200 GraphReplayPrinter::PrintReplay(&graph); |
| 200 } | 201 } |
| 201 | 202 |
| 202 if (FLAG_turbo_types) { | 203 if (FLAG_turbo_types) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 217 GraphReducer graph_reducer(&graph); | 218 GraphReducer graph_reducer(&graph); |
| 218 graph_reducer.AddReducer(&lowering); | 219 graph_reducer.AddReducer(&lowering); |
| 219 graph_reducer.ReduceGraph(); | 220 graph_reducer.ReduceGraph(); |
| 220 | 221 |
| 221 VerifyAndPrintGraph(&graph, "Lowered typed"); | 222 VerifyAndPrintGraph(&graph, "Lowered typed"); |
| 222 } | 223 } |
| 223 } | 224 } |
| 224 | 225 |
| 225 Handle<Code> code = Handle<Code>::null(); | 226 Handle<Code> code = Handle<Code>::null(); |
| 226 if (SupportedTarget()) { | 227 if (SupportedTarget()) { |
| 228 Linkage linkage(info()); |
| 227 { | 229 { |
| 228 // Lower any remaining generic JSOperators. | 230 // Lower any remaining generic JSOperators. |
| 229 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, | 231 PhaseStats lowering_stats(info(), PhaseStats::CREATE_GRAPH, |
| 230 "generic lowering"); | 232 "generic lowering"); |
| 231 SourcePositionTable::Scope pos(&source_positions, | 233 SourcePositionTable::Scope pos(&source_positions, |
| 232 SourcePosition::Unknown()); | 234 SourcePosition::Unknown()); |
| 233 MachineOperatorBuilder machine(zone()); | 235 MachineOperatorBuilder machine(zone()); |
| 234 JSGenericLowering lowering(info(), &jsgraph, &machine); | 236 JSGenericLowering lowering(&jsgraph, &spec, &linkage, &machine); |
| 235 GraphReducer graph_reducer(&graph); | 237 GraphReducer graph_reducer(&graph); |
| 236 graph_reducer.AddReducer(&lowering); | 238 graph_reducer.AddReducer(&lowering); |
| 237 graph_reducer.ReduceGraph(); | 239 graph_reducer.ReduceGraph(); |
| 238 | 240 |
| 239 VerifyAndPrintGraph(&graph, "Lowered generic"); | 241 VerifyAndPrintGraph(&graph, "Lowered generic"); |
| 240 } | 242 } |
| 241 | 243 |
| 242 // Compute a schedule. | 244 // Compute a schedule. |
| 243 Schedule* schedule = ComputeSchedule(&graph); | 245 Schedule* schedule = ComputeSchedule(&graph); |
| 244 TraceSchedule(schedule); | 246 TraceSchedule(schedule); |
| 245 | 247 |
| 246 { | 248 { |
| 247 // Generate optimized code. | 249 // Generate optimized code. |
| 248 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); | 250 PhaseStats codegen_stats(info(), PhaseStats::CODEGEN, "codegen"); |
| 249 Linkage linkage(info()); | 251 |
| 250 code = GenerateCode(&linkage, &graph, schedule, &source_positions); | 252 code = GenerateCode(&linkage, &graph, schedule, &source_positions); |
| 251 info()->SetCode(code); | 253 info()->SetCode(code); |
| 252 } | 254 } |
| 253 | 255 |
| 254 // Print optimized code. | 256 // Print optimized code. |
| 255 v8::internal::CodeGenerator::PrintCode(code, info()); | 257 v8::internal::CodeGenerator::PrintCode(code, info()); |
| 256 } | 258 } |
| 257 | 259 |
| 258 if (FLAG_trace_turbo) { | 260 if (FLAG_trace_turbo) { |
| 259 OFStream os(stdout); | 261 OFStream os(stdout); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 } | 351 } |
| 350 | 352 |
| 351 | 353 |
| 352 void Pipeline::TearDown() { | 354 void Pipeline::TearDown() { |
| 353 InstructionOperand::TearDownCaches(); | 355 InstructionOperand::TearDownCaches(); |
| 354 } | 356 } |
| 355 | 357 |
| 356 } // namespace compiler | 358 } // namespace compiler |
| 357 } // namespace internal | 359 } // namespace internal |
| 358 } // namespace v8 | 360 } // namespace v8 |
| OLD | NEW |