| 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 <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "src/base/platform/elapsed-timer.h" | 10 #include "src/base/platform/elapsed-timer.h" |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 } | 408 } |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 | 411 |
| 412 struct ContextSpecializerPhase { | 412 struct ContextSpecializerPhase { |
| 413 static const char* phase_name() { return "context specializing"; } | 413 static const char* phase_name() { return "context specializing"; } |
| 414 | 414 |
| 415 void Run(PipelineData* data, Zone* temp_zone) { | 415 void Run(PipelineData* data, Zone* temp_zone) { |
| 416 SourcePositionTable::Scope pos(data->source_positions(), | 416 SourcePositionTable::Scope pos(data->source_positions(), |
| 417 SourcePosition::Unknown()); | 417 SourcePosition::Unknown()); |
| 418 JSContextSpecializer spec(data->info(), data->jsgraph(), | 418 JSContextSpecializer spec(data->info()->context(), data->jsgraph(), |
| 419 data->context_node()); | 419 data->context_node()); |
| 420 GraphReducer graph_reducer(data->graph(), temp_zone); | 420 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 421 AddReducer(data, &graph_reducer, &spec); | 421 AddReducer(data, &graph_reducer, &spec); |
| 422 graph_reducer.ReduceGraph(); | 422 graph_reducer.ReduceGraph(); |
| 423 } | 423 } |
| 424 }; | 424 }; |
| 425 | 425 |
| 426 | 426 |
| 427 struct InliningPhase { | 427 struct InliningPhase { |
| 428 static const char* phase_name() { return "inlining"; } | 428 static const char* phase_name() { return "inlining"; } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 } | 505 } |
| 506 }; | 506 }; |
| 507 | 507 |
| 508 | 508 |
| 509 struct ChangeLoweringPhase { | 509 struct ChangeLoweringPhase { |
| 510 static const char* phase_name() { return "change lowering"; } | 510 static const char* phase_name() { return "change lowering"; } |
| 511 | 511 |
| 512 void Run(PipelineData* data, Zone* temp_zone) { | 512 void Run(PipelineData* data, Zone* temp_zone) { |
| 513 SourcePositionTable::Scope pos(data->source_positions(), | 513 SourcePositionTable::Scope pos(data->source_positions(), |
| 514 SourcePosition::Unknown()); | 514 SourcePosition::Unknown()); |
| 515 Linkage linkage(data->graph_zone(), data->info()); | |
| 516 ValueNumberingReducer vn_reducer(temp_zone); | 515 ValueNumberingReducer vn_reducer(temp_zone); |
| 517 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); | 516 SimplifiedOperatorReducer simple_reducer(data->jsgraph()); |
| 518 ChangeLowering lowering(data->jsgraph(), &linkage); | 517 ChangeLowering lowering(data->jsgraph()); |
| 519 MachineOperatorReducer machine_reducer(data->jsgraph()); | 518 MachineOperatorReducer machine_reducer(data->jsgraph()); |
| 520 CommonOperatorReducer common_reducer; | 519 CommonOperatorReducer common_reducer; |
| 521 GraphReducer graph_reducer(data->graph(), temp_zone); | 520 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 522 graph_reducer.AddReducer(&vn_reducer); | 521 graph_reducer.AddReducer(&vn_reducer); |
| 523 AddReducer(data, &graph_reducer, &simple_reducer); | 522 AddReducer(data, &graph_reducer, &simple_reducer); |
| 524 AddReducer(data, &graph_reducer, &lowering); | 523 AddReducer(data, &graph_reducer, &lowering); |
| 525 AddReducer(data, &graph_reducer, &machine_reducer); | 524 AddReducer(data, &graph_reducer, &machine_reducer); |
| 526 AddReducer(data, &graph_reducer, &common_reducer); | 525 AddReducer(data, &graph_reducer, &common_reducer); |
| 527 graph_reducer.ReduceGraph(); | 526 graph_reducer.ReduceGraph(); |
| 528 } | 527 } |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 } | 563 } |
| 565 }; | 564 }; |
| 566 | 565 |
| 567 | 566 |
| 568 struct GenericLoweringPhase { | 567 struct GenericLoweringPhase { |
| 569 static const char* phase_name() { return "generic lowering"; } | 568 static const char* phase_name() { return "generic lowering"; } |
| 570 | 569 |
| 571 void Run(PipelineData* data, Zone* temp_zone) { | 570 void Run(PipelineData* data, Zone* temp_zone) { |
| 572 SourcePositionTable::Scope pos(data->source_positions(), | 571 SourcePositionTable::Scope pos(data->source_positions(), |
| 573 SourcePosition::Unknown()); | 572 SourcePosition::Unknown()); |
| 574 JSGenericLowering generic(data->info(), data->jsgraph()); | 573 JSGenericLowering generic(data->info()->is_typing_enabled(), |
| 574 data->jsgraph()); |
| 575 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); | 575 SelectLowering select(data->jsgraph()->graph(), data->jsgraph()->common()); |
| 576 GraphReducer graph_reducer(data->graph(), temp_zone); | 576 GraphReducer graph_reducer(data->graph(), temp_zone); |
| 577 AddReducer(data, &graph_reducer, &generic); | 577 AddReducer(data, &graph_reducer, &generic); |
| 578 AddReducer(data, &graph_reducer, &select); | 578 AddReducer(data, &graph_reducer, &select); |
| 579 graph_reducer.ReduceGraph(); | 579 graph_reducer.ReduceGraph(); |
| 580 } | 580 } |
| 581 }; | 581 }; |
| 582 | 582 |
| 583 | 583 |
| 584 struct ComputeSchedulePhase { | 584 struct ComputeSchedulePhase { |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 | 947 |
| 948 BeginPhaseKind("block building"); | 948 BeginPhaseKind("block building"); |
| 949 | 949 |
| 950 data.source_positions()->RemoveDecorator(); | 950 data.source_positions()->RemoveDecorator(); |
| 951 | 951 |
| 952 // Compute a schedule. | 952 // Compute a schedule. |
| 953 Run<ComputeSchedulePhase>(); | 953 Run<ComputeSchedulePhase>(); |
| 954 | 954 |
| 955 { | 955 { |
| 956 // Generate optimized code. | 956 // Generate optimized code. |
| 957 Linkage linkage(data.instruction_zone(), info()); | 957 Linkage linkage(Linkage::ComputeIncoming(data.instruction_zone(), info())); |
| 958 GenerateCode(&linkage); | 958 GenerateCode(&linkage); |
| 959 } | 959 } |
| 960 Handle<Code> code = data.code(); | 960 Handle<Code> code = data.code(); |
| 961 info()->SetCode(code); | 961 info()->SetCode(code); |
| 962 | 962 |
| 963 // Print optimized code. | 963 // Print optimized code. |
| 964 v8::internal::CodeGenerator::PrintCode(code, info()); | 964 v8::internal::CodeGenerator::PrintCode(code, info()); |
| 965 | 965 |
| 966 if (FLAG_trace_turbo) { | 966 if (FLAG_trace_turbo) { |
| 967 FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "a+"); | 967 FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "a+"); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 pipeline.data_ = &data; | 1019 pipeline.data_ = &data; |
| 1020 data.InitializeTorTesting(graph, schedule); | 1020 data.InitializeTorTesting(graph, schedule); |
| 1021 if (schedule == NULL) { | 1021 if (schedule == NULL) { |
| 1022 // TODO(rossberg): Should this really be untyped? | 1022 // TODO(rossberg): Should this really be untyped? |
| 1023 pipeline.RunPrintAndVerify("Machine", true); | 1023 pipeline.RunPrintAndVerify("Machine", true); |
| 1024 pipeline.Run<ComputeSchedulePhase>(); | 1024 pipeline.Run<ComputeSchedulePhase>(); |
| 1025 } else { | 1025 } else { |
| 1026 TraceSchedule(schedule); | 1026 TraceSchedule(schedule); |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 Linkage linkage(info->isolate(), info->zone(), call_descriptor); | 1029 Linkage linkage(call_descriptor); |
| 1030 pipeline.GenerateCode(&linkage); | 1030 pipeline.GenerateCode(&linkage); |
| 1031 Handle<Code> code = data.code(); | 1031 Handle<Code> code = data.code(); |
| 1032 | 1032 |
| 1033 #if ENABLE_DISASSEMBLER | 1033 #if ENABLE_DISASSEMBLER |
| 1034 if (!code.is_null() && FLAG_print_opt_code) { | 1034 if (!code.is_null() && FLAG_print_opt_code) { |
| 1035 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); | 1035 CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
| 1036 OFStream os(tracing_scope.file()); | 1036 OFStream os(tracing_scope.file()); |
| 1037 code->Disassemble("test code", os); | 1037 code->Disassemble("test code", os); |
| 1038 } | 1038 } |
| 1039 #endif | 1039 #endif |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1176 | 1176 |
| 1177 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { | 1177 if (FLAG_trace_turbo && !data->MayHaveUnverifiableGraph()) { |
| 1178 TurboCfgFile tcf(data->isolate()); | 1178 TurboCfgFile tcf(data->isolate()); |
| 1179 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); | 1179 tcf << AsC1VAllocator("CodeGen", data->register_allocator()); |
| 1180 } | 1180 } |
| 1181 } | 1181 } |
| 1182 | 1182 |
| 1183 } // namespace compiler | 1183 } // namespace compiler |
| 1184 } // namespace internal | 1184 } // namespace internal |
| 1185 } // namespace v8 | 1185 } // namespace v8 |
| OLD | NEW |