Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(265)

Side by Side Diff: src/compiler/pipeline.cc

Issue 2173403002: Replace SmartArrayPointer<T> with unique_ptr<T[]> (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/compiler/pipeline-statistics.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 299
299 void EndPhaseKind() { 300 void EndPhaseKind() {
300 if (pipeline_statistics() != nullptr) { 301 if (pipeline_statistics() != nullptr) {
301 pipeline_statistics()->EndPhaseKind(); 302 pipeline_statistics()->EndPhaseKind();
302 } 303 }
303 } 304 }
304 305
305 private: 306 private:
306 Isolate* const isolate_; 307 Isolate* const isolate_;
307 CompilationInfo* const info_; 308 CompilationInfo* const info_;
308 base::SmartArrayPointer<char> debug_name_; 309 std::unique_ptr<char[]> debug_name_;
309 Zone* outer_zone_ = nullptr; 310 Zone* outer_zone_ = nullptr;
310 ZonePool* const zone_pool_; 311 ZonePool* const zone_pool_;
311 PipelineStatistics* pipeline_statistics_ = nullptr; 312 PipelineStatistics* pipeline_statistics_ = nullptr;
312 bool compilation_failed_ = false; 313 bool compilation_failed_ = false;
313 Handle<Code> code_ = Handle<Code>::null(); 314 Handle<Code> code_ = Handle<Code>::null();
314 315
315 // All objects in the following group of fields are allocated in graph_zone_. 316 // All objects in the following group of fields are allocated in graph_zone_.
316 // They are all set to nullptr when the graph_zone_ is destroyed. 317 // They are all set to nullptr when the graph_zone_ is destroyed.
317 ZonePool::Scope graph_zone_scope_; 318 ZonePool::Scope graph_zone_scope_;
318 Zone* graph_zone_ = nullptr; 319 Zone* graph_zone_ = nullptr;
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 PipelineStatistics* pipeline_statistics = nullptr; 526 PipelineStatistics* pipeline_statistics = nullptr;
526 527
527 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) { 528 if (FLAG_turbo_stats || FLAG_turbo_stats_nvp) {
528 pipeline_statistics = new PipelineStatistics(info, zone_pool); 529 pipeline_statistics = new PipelineStatistics(info, zone_pool);
529 pipeline_statistics->BeginPhaseKind("initializing"); 530 pipeline_statistics->BeginPhaseKind("initializing");
530 } 531 }
531 532
532 if (FLAG_trace_turbo) { 533 if (FLAG_trace_turbo) {
533 TurboJsonFile json_of(info, std::ios_base::trunc); 534 TurboJsonFile json_of(info, std::ios_base::trunc);
534 Handle<Script> script = info->script(); 535 Handle<Script> script = info->script();
535 base::SmartArrayPointer<char> function_name = info->GetDebugName(); 536 std::unique_ptr<char[]> function_name = info->GetDebugName();
536 int pos = info->shared_info()->start_position(); 537 int pos = info->shared_info()->start_position();
537 json_of << "{\"function\":\"" << function_name.get() 538 json_of << "{\"function\":\"" << function_name.get()
538 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; 539 << "\", \"sourcePosition\":" << pos << ", \"source\":\"";
539 Isolate* isolate = info->isolate(); 540 Isolate* isolate = info->isolate();
540 if (!script->IsUndefined(isolate) && 541 if (!script->IsUndefined(isolate) &&
541 !script->source()->IsUndefined(isolate)) { 542 !script->source()->IsUndefined(isolate)) {
542 DisallowHeapAllocation no_allocation; 543 DisallowHeapAllocation no_allocation;
543 int start = info->shared_info()->start_position(); 544 int start = info->shared_info()->start_position();
544 int len = info->shared_info()->end_position() - start; 545 int len = info->shared_info()->end_position() - start;
545 String::SubStringRange source(String::cast(script->source()), start, len); 546 String::SubStringRange source(String::cast(script->source()), start, len);
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 data->DeleteRegisterAllocationZone(); 1867 data->DeleteRegisterAllocationZone();
1867 } 1868 }
1868 1869
1869 CompilationInfo* PipelineImpl::info() const { return data_->info(); } 1870 CompilationInfo* PipelineImpl::info() const { return data_->info(); }
1870 1871
1871 Isolate* PipelineImpl::isolate() const { return info()->isolate(); } 1872 Isolate* PipelineImpl::isolate() const { return info()->isolate(); }
1872 1873
1873 } // namespace compiler 1874 } // namespace compiler
1874 } // namespace internal 1875 } // namespace internal
1875 } // namespace v8 1876 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/compiler/pipeline-statistics.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698