| 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 <memory> |
| 8 #include <sstream> | 9 #include <sstream> |
| 9 | 10 |
| 10 #include "src/base/adapters.h" | 11 #include "src/base/adapters.h" |
| 11 #include "src/base/platform/elapsed-timer.h" | 12 #include "src/base/platform/elapsed-timer.h" |
| 12 #include "src/compiler/ast-graph-builder.h" | 13 #include "src/compiler/ast-graph-builder.h" |
| 13 #include "src/compiler/ast-loop-assignment-analyzer.h" | 14 #include "src/compiler/ast-loop-assignment-analyzer.h" |
| 14 #include "src/compiler/basic-block-instrumentor.h" | 15 #include "src/compiler/basic-block-instrumentor.h" |
| 15 #include "src/compiler/branch-elimination.h" | 16 #include "src/compiler/branch-elimination.h" |
| 16 #include "src/compiler/bytecode-graph-builder.h" | 17 #include "src/compiler/bytecode-graph-builder.h" |
| 17 #include "src/compiler/checkpoint-elimination.h" | 18 #include "src/compiler/checkpoint-elimination.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 298 |
| 298 void EndPhaseKind() { | 299 void EndPhaseKind() { |
| 299 if (pipeline_statistics() != nullptr) { | 300 if (pipeline_statistics() != nullptr) { |
| 300 pipeline_statistics()->EndPhaseKind(); | 301 pipeline_statistics()->EndPhaseKind(); |
| 301 } | 302 } |
| 302 } | 303 } |
| 303 | 304 |
| 304 private: | 305 private: |
| 305 Isolate* const isolate_; | 306 Isolate* const isolate_; |
| 306 CompilationInfo* const info_; | 307 CompilationInfo* const info_; |
| 307 base::SmartArrayPointer<char> debug_name_; | 308 std::unique_ptr<char[]> debug_name_; |
| 308 Zone* outer_zone_ = nullptr; | 309 Zone* outer_zone_ = nullptr; |
| 309 ZonePool* const zone_pool_; | 310 ZonePool* const zone_pool_; |
| 310 PipelineStatistics* pipeline_statistics_ = nullptr; | 311 PipelineStatistics* pipeline_statistics_ = nullptr; |
| 311 bool compilation_failed_ = false; | 312 bool compilation_failed_ = false; |
| 312 Handle<Code> code_ = Handle<Code>::null(); | 313 Handle<Code> code_ = Handle<Code>::null(); |
| 313 | 314 |
| 314 // All objects in the following group of fields are allocated in graph_zone_. | 315 // All objects in the following group of fields are allocated in graph_zone_. |
| 315 // They are all set to nullptr when the graph_zone_ is destroyed. | 316 // They are all set to nullptr when the graph_zone_ is destroyed. |
| 316 ZonePool::Scope graph_zone_scope_; | 317 ZonePool::Scope graph_zone_scope_; |
| 317 Zone* graph_zone_ = nullptr; | 318 Zone* graph_zone_ = nullptr; |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 PipelineStatistics* pipeline_statistics = nullptr; | 525 PipelineStatistics* pipeline_statistics = nullptr; |
| 525 | 526 |
| 526 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { | 527 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { |
| 527 pipeline_statistics = new PipelineStatistics(info, zone_pool); | 528 pipeline_statistics = new PipelineStatistics(info, zone_pool); |
| 528 pipeline_statistics->BeginPhaseKind("initializing"); | 529 pipeline_statistics->BeginPhaseKind("initializing"); |
| 529 } | 530 } |
| 530 | 531 |
| 531 if (FLAG_trace_turbo) { | 532 if (FLAG_trace_turbo) { |
| 532 TurboJsonFile json_of(info, std::ios_base::trunc); | 533 TurboJsonFile json_of(info, std::ios_base::trunc); |
| 533 Handle<Script> script = info->script(); | 534 Handle<Script> script = info->script(); |
| 534 base::SmartArrayPointer<char> function_name = info->GetDebugName(); | 535 std::unique_ptr<char[]> function_name = info->GetDebugName(); |
| 535 int pos = info->shared_info()->start_position(); | 536 int pos = info->shared_info()->start_position(); |
| 536 json_of << "{\"function\":\"" << function_name.get() | 537 json_of << "{\"function\":\"" << function_name.get() |
| 537 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; | 538 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; |
| 538 Isolate* isolate = info->isolate(); | 539 Isolate* isolate = info->isolate(); |
| 539 if (!script->IsUndefined(isolate) && | 540 if (!script->IsUndefined(isolate) && |
| 540 !script->source()->IsUndefined(isolate)) { | 541 !script->source()->IsUndefined(isolate)) { |
| 541 DisallowHeapAllocation no_allocation; | 542 DisallowHeapAllocation no_allocation; |
| 542 int start = info->shared_info()->start_position(); | 543 int start = info->shared_info()->start_position(); |
| 543 int len = info->shared_info()->end_position() - start; | 544 int len = info->shared_info()->end_position() - start; |
| 544 String::SubStringRange source(String::cast(script->source()), start, len); | 545 String::SubStringRange source(String::cast(script->source()), start, len); |
| (...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1865 data->DeleteRegisterAllocationZone(); | 1866 data->DeleteRegisterAllocationZone(); |
| 1866 } | 1867 } |
| 1867 | 1868 |
| 1868 CompilationInfo* PipelineImpl::info() const { return data_->info(); } | 1869 CompilationInfo* PipelineImpl::info() const { return data_->info(); } |
| 1869 | 1870 |
| 1870 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } | 1871 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } |
| 1871 | 1872 |
| 1872 } // namespace compiler | 1873 } // namespace compiler |
| 1873 } // namespace internal | 1874 } // namespace internal |
| 1874 } // namespace v8 | 1875 } // namespace v8 |
| OLD | NEW |