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

Side by Side Diff: src/compiler.cc

Issue 1012633002: CpuProfiler: Push inlining data forward to cpu profiler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebaselined Created 5 years, 9 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.h ('k') | src/cpu-profiler.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Mode mode, 109 Mode mode,
110 Zone* zone) { 110 Zone* zone) {
111 isolate_ = isolate; 111 isolate_ = isolate;
112 zone_ = zone; 112 zone_ = zone;
113 deferred_handles_ = NULL; 113 deferred_handles_ = NULL;
114 code_stub_ = NULL; 114 code_stub_ = NULL;
115 prologue_offset_ = Code::kPrologueOffsetNotSet; 115 prologue_offset_ = Code::kPrologueOffsetNotSet;
116 opt_count_ = has_shared_info() ? shared_info()->opt_count() : 0; 116 opt_count_ = has_shared_info() ? shared_info()->opt_count() : 0;
117 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling() 117 no_frame_ranges_ = isolate->cpu_profiler()->is_profiling()
118 ? new List<OffsetRange>(2) : NULL; 118 ? new List<OffsetRange>(2) : NULL;
119 if (FLAG_hydrogen_track_positions) { 119 if (FLAG_hydrogen_track_positions ||
120 isolate_->cpu_profiler()->is_profiling()) {
120 inlined_function_infos_ = new std::vector<InlinedFunctionInfo>(); 121 inlined_function_infos_ = new std::vector<InlinedFunctionInfo>();
121 track_positions_ = true; 122 track_positions_ = true;
122 } else { 123 } else {
123 inlined_function_infos_ = NULL; 124 inlined_function_infos_ = NULL;
124 track_positions_ = false; 125 track_positions_ = false;
125 } 126 }
126 127
127 for (int i = 0; i < DependentCode::kGroupCount; i++) { 128 for (int i = 0; i < DependentCode::kGroupCount; i++) {
128 dependencies_[i] = NULL; 129 dependencies_[i] = NULL;
129 } 130 }
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 { 297 {
297 DisallowHeapAllocation no_allocation; 298 DisallowHeapAllocation no_allocation;
298 int start = shared->start_position(); 299 int start = shared->start_position();
299 int len = shared->end_position() - start; 300 int len = shared->end_position() - start;
300 String::SubStringRange source(String::cast(script->source()), start, 301 String::SubStringRange source(String::cast(script->source()), start,
301 len); 302 len);
302 for (const auto& c : source) { 303 for (const auto& c : source) {
303 os << AsReversiblyEscapedUC16(c); 304 os << AsReversiblyEscapedUC16(c);
304 } 305 }
305 } 306 }
306
307 os << "\n--- END ---\n"; 307 os << "\n--- END ---\n";
308 } 308 }
309 } 309 }
310 310
311 inlined_function_infos_->push_back(info); 311 inlined_function_infos_->push_back(info);
312 312
313 if (FLAG_hydrogen_track_positions && inline_id != 0) { 313 if (FLAG_hydrogen_track_positions && inline_id != 0) {
314 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer()); 314 CodeTracer::Scope tracing_scope(isolate()->GetCodeTracer());
315 OFStream os(tracing_scope.file()); 315 OFStream os(tracing_scope.file());
316 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{" 316 os << "INLINE (" << shared->DebugName()->ToCString().get() << ") id{"
317 << optimization_id() << "," << inline_id << "} AS " << inline_id 317 << optimization_id() << "," << inline_id << "} AS " << inline_id
318 << " AT " << position << std::endl; 318 << " AT " << position << std::endl;
319 } 319 }
320 320
321 return inline_id; 321 return inline_id;
322 } 322 }
323 323
324 324
325 void CompilationInfo::LogDeoptCallPosition(int pc_offset, int inlining_id) {
326 if (!track_positions_ || IsStub()) return;
327 DCHECK_LT(static_cast<size_t>(inlining_id), inlined_function_infos_->size());
328 inlined_function_infos_->at(inlining_id)
329 .deopt_pc_offsets.push_back(pc_offset);
330 }
331
332
325 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder { 333 class HOptimizedGraphBuilderWithPositions: public HOptimizedGraphBuilder {
326 public: 334 public:
327 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info) 335 explicit HOptimizedGraphBuilderWithPositions(CompilationInfo* info)
328 : HOptimizedGraphBuilder(info) { 336 : HOptimizedGraphBuilder(info) {
329 } 337 }
330 338
331 #define DEF_VISIT(type) \ 339 #define DEF_VISIT(type) \
332 void Visit##type(type* node) OVERRIDE { \ 340 void Visit##type(type* node) OVERRIDE { \
333 SourcePosition old_position = SourcePosition::Unknown(); \ 341 SourcePosition old_position = SourcePosition::Unknown(); \
334 if (node->position() != RelocInfo::kNoPosition) { \ 342 if (node->position() != RelocInfo::kNoPosition) { \
(...skipping 1262 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 parse_info_ = nullptr; 1605 parse_info_ = nullptr;
1598 } 1606 }
1599 1607
1600 #if DEBUG 1608 #if DEBUG
1601 void CompilationInfo::PrintAstForTesting() { 1609 void CompilationInfo::PrintAstForTesting() {
1602 PrintF("--- Source from AST ---\n%s\n", 1610 PrintF("--- Source from AST ---\n%s\n",
1603 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1611 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1604 } 1612 }
1605 #endif 1613 #endif
1606 } } // namespace v8::internal 1614 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/cpu-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698