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/adapters.h" | 10 #include "src/base/adapters.h" |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) { | 352 base::SmartArrayPointer<char> GetDebugName(CompilationInfo* info) { |
353 if (info->code_stub() != NULL) { | 353 if (info->code_stub() != NULL) { |
354 CodeStub::Major major_key = info->code_stub()->MajorKey(); | 354 CodeStub::Major major_key = info->code_stub()->MajorKey(); |
355 const char* major_name = CodeStub::MajorName(major_key, false); | 355 const char* major_name = CodeStub::MajorName(major_key, false); |
356 size_t len = strlen(major_name) + 1; | 356 size_t len = strlen(major_name) + 1; |
357 base::SmartArrayPointer<char> name(new char[len]); | 357 base::SmartArrayPointer<char> name(new char[len]); |
358 memcpy(name.get(), major_name, len); | 358 memcpy(name.get(), major_name, len); |
359 return name; | 359 return name; |
360 } else { | 360 } else { |
361 AllowHandleDereference allow_deref; | 361 AllowHandleDereference allow_deref; |
362 return info->function()->debug_name()->ToCString(); | 362 return info->literal()->debug_name()->ToCString(); |
363 } | 363 } |
364 } | 364 } |
365 | 365 |
366 | 366 |
367 class AstGraphBuilderWithPositions final : public AstGraphBuilder { | 367 class AstGraphBuilderWithPositions final : public AstGraphBuilder { |
368 public: | 368 public: |
369 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, | 369 AstGraphBuilderWithPositions(Zone* local_zone, CompilationInfo* info, |
370 JSGraph* jsgraph, | 370 JSGraph* jsgraph, |
371 LoopAssignmentAnalysis* loop_assignment, | 371 LoopAssignmentAnalysis* loop_assignment, |
372 JSTypeFeedbackTable* js_type_feedback, | 372 JSTypeFeedbackTable* js_type_feedback, |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 if (FLAG_turbo_stats) { | 1007 if (FLAG_turbo_stats) { |
1008 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); | 1008 pipeline_statistics.Reset(new PipelineStatistics(info(), &zone_pool)); |
1009 pipeline_statistics->BeginPhaseKind("initializing"); | 1009 pipeline_statistics->BeginPhaseKind("initializing"); |
1010 } | 1010 } |
1011 | 1011 |
1012 if (FLAG_trace_turbo) { | 1012 if (FLAG_trace_turbo) { |
1013 FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "w+"); | 1013 FILE* json_file = OpenVisualizerLogFile(info(), NULL, "json", "w+"); |
1014 if (json_file != nullptr) { | 1014 if (json_file != nullptr) { |
1015 OFStream json_of(json_file); | 1015 OFStream json_of(json_file); |
1016 Handle<Script> script = info()->script(); | 1016 Handle<Script> script = info()->script(); |
1017 FunctionLiteral* function = info()->function(); | 1017 FunctionLiteral* function = info()->literal(); |
1018 base::SmartArrayPointer<char> function_name = | 1018 base::SmartArrayPointer<char> function_name = |
1019 info()->shared_info()->DebugName()->ToCString(); | 1019 info()->shared_info()->DebugName()->ToCString(); |
1020 int pos = info()->shared_info()->start_position(); | 1020 int pos = info()->shared_info()->start_position(); |
1021 json_of << "{\"function\":\"" << function_name.get() | 1021 json_of << "{\"function\":\"" << function_name.get() |
1022 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; | 1022 << "\", \"sourcePosition\":" << pos << ", \"source\":\""; |
1023 if (!script->IsUndefined() && !script->source()->IsUndefined()) { | 1023 if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
1024 DisallowHeapAllocation no_allocation; | 1024 DisallowHeapAllocation no_allocation; |
1025 int start = function->start_position(); | 1025 int start = function->start_position(); |
1026 int len = function->end_position() - start; | 1026 int len = function->end_position() - start; |
1027 String::SubStringRange source(String::cast(script->source()), start, | 1027 String::SubStringRange source(String::cast(script->source()), start, |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1378 tcf << AsC1VRegisterAllocationData("CodeGen", | 1378 tcf << AsC1VRegisterAllocationData("CodeGen", |
1379 data->register_allocation_data()); | 1379 data->register_allocation_data()); |
1380 } | 1380 } |
1381 | 1381 |
1382 data->DeleteRegisterAllocationZone(); | 1382 data->DeleteRegisterAllocationZone(); |
1383 } | 1383 } |
1384 | 1384 |
1385 } // namespace compiler | 1385 } // namespace compiler |
1386 } // namespace internal | 1386 } // namespace internal |
1387 } // namespace v8 | 1387 } // namespace v8 |
OLD | NEW |