Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/profile-generator-inl.h" | 7 #include "src/profile-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
| 10 #include "src/debug.h" | 10 #include "src/debug.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 } | 132 } |
| 133 | 133 |
| 134 | 134 |
| 135 const char* const CodeEntry::kEmptyNamePrefix = ""; | 135 const char* const CodeEntry::kEmptyNamePrefix = ""; |
| 136 const char* const CodeEntry::kEmptyResourceName = ""; | 136 const char* const CodeEntry::kEmptyResourceName = ""; |
| 137 const char* const CodeEntry::kEmptyBailoutReason = ""; | 137 const char* const CodeEntry::kEmptyBailoutReason = ""; |
| 138 | 138 |
| 139 | 139 |
| 140 CodeEntry::~CodeEntry() { | 140 CodeEntry::~CodeEntry() { |
| 141 delete no_frame_ranges_; | 141 delete no_frame_ranges_; |
| 142 delete line_info_; | |
| 142 } | 143 } |
| 143 | 144 |
| 144 | 145 |
| 145 uint32_t CodeEntry::GetCallUid() const { | 146 uint32_t CodeEntry::GetCallUid() const { |
| 146 uint32_t hash = ComputeIntegerHash(tag_, v8::internal::kZeroHashSeed); | 147 uint32_t hash = ComputeIntegerHash(tag_, v8::internal::kZeroHashSeed); |
| 147 if (shared_id_ != 0) { | 148 if (shared_id_ != 0) { |
| 148 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), | 149 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), |
| 149 v8::internal::kZeroHashSeed); | 150 v8::internal::kZeroHashSeed); |
| 150 } else { | 151 } else { |
| 151 hash ^= ComputeIntegerHash( | 152 hash ^= ComputeIntegerHash( |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 174 && line_number_ == entry->line_number_))); | 175 && line_number_ == entry->line_number_))); |
| 175 } | 176 } |
| 176 | 177 |
| 177 | 178 |
| 178 void CodeEntry::SetBuiltinId(Builtins::Name id) { | 179 void CodeEntry::SetBuiltinId(Builtins::Name id) { |
| 179 tag_ = Logger::BUILTIN_TAG; | 180 tag_ = Logger::BUILTIN_TAG; |
| 180 builtin_id_ = id; | 181 builtin_id_ = id; |
| 181 } | 182 } |
| 182 | 183 |
| 183 | 184 |
| 185 int CodeEntry::GetSourceLine(int pc_offset) const { | |
| 186 if (line_info_ && !line_info_->Empty()) { | |
| 187 return line_info_->GetSourceLineNumber(pc_offset); | |
| 188 } | |
| 189 return v8::CpuProfileNode::kNoLineNumberInfo; | |
| 190 } | |
| 191 | |
| 192 | |
| 184 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { | 193 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { |
| 185 HashMap::Entry* map_entry = | 194 HashMap::Entry* map_entry = |
| 186 children_.Lookup(entry, CodeEntryHash(entry), false); | 195 children_.Lookup(entry, CodeEntryHash(entry), false); |
| 187 return map_entry != NULL ? | 196 return map_entry != NULL ? |
| 188 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; | 197 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; |
| 189 } | 198 } |
| 190 | 199 |
| 191 | 200 |
| 192 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { | 201 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { |
| 193 HashMap::Entry* map_entry = | 202 HashMap::Entry* map_entry = |
| 194 children_.Lookup(entry, CodeEntryHash(entry), true); | 203 children_.Lookup(entry, CodeEntryHash(entry), true); |
| 195 if (map_entry->value == NULL) { | 204 if (map_entry->value == NULL) { |
| 196 // New node added. | 205 // New node added. |
| 197 ProfileNode* new_node = new ProfileNode(tree_, entry); | 206 ProfileNode* new_node = new ProfileNode(tree_, entry); |
| 198 map_entry->value = new_node; | 207 map_entry->value = new_node; |
| 199 children_list_.Add(new_node); | 208 children_list_.Add(new_node); |
| 200 } | 209 } |
| 201 return reinterpret_cast<ProfileNode*>(map_entry->value); | 210 return reinterpret_cast<ProfileNode*>(map_entry->value); |
| 202 } | 211 } |
| 203 | 212 |
| 204 | 213 |
| 214 void ProfileNode::IncrementLineTicks(int src_line) { | |
| 215 if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) return; | |
| 216 // Increment a hit counter of a certain source line. | |
| 217 // Add a new source line if not found. | |
| 218 HashMap::Entry* e = | |
| 219 line_ticks_.Lookup(reinterpret_cast<void*>(src_line), src_line, true); | |
| 220 DCHECK(e); | |
| 221 e->value = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(e->value) + 1); | |
| 222 } | |
| 223 | |
| 224 | |
| 225 bool ProfileNode::GetLineTicks(v8::CpuProfileNode::LineTick* entries, | |
| 226 unsigned int length) const { | |
| 227 if (entries == NULL || length == 0) return false; | |
| 228 | |
| 229 unsigned line_count = line_ticks_.occupancy(); | |
| 230 | |
| 231 if (line_count == 0) return false; | |
| 232 if (length < line_count) return false; | |
| 233 | |
| 234 v8::CpuProfileNode::LineTick* entry = entries; | |
| 235 | |
| 236 for (HashMap::Entry* p = line_ticks_.Start(); p != NULL; | |
| 237 p = line_ticks_.Next(p), entry++) { | |
| 238 entry->line = | |
| 239 static_cast<unsigned int>(reinterpret_cast<uintptr_t>(p->key)); | |
| 240 entry->hit_count = | |
| 241 static_cast<unsigned int>(reinterpret_cast<uintptr_t>(p->value)); | |
| 242 } | |
| 243 | |
| 244 return true; | |
| 245 } | |
| 246 | |
| 247 | |
| 205 void ProfileNode::Print(int indent) { | 248 void ProfileNode::Print(int indent) { |
| 206 base::OS::Print("%5u %*s %s%s %d #%d %s", self_ticks_, indent, "", | 249 base::OS::Print("%5u %*s %s%s %d #%d %s", self_ticks_, indent, "", |
| 207 entry_->name_prefix(), entry_->name(), entry_->script_id(), | 250 entry_->name_prefix(), entry_->name(), entry_->script_id(), |
| 208 id(), entry_->bailout_reason()); | 251 id(), entry_->bailout_reason()); |
| 209 if (entry_->resource_name()[0] != '\0') | 252 if (entry_->resource_name()[0] != '\0') |
| 210 base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); | 253 base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); |
| 211 base::OS::Print("\n"); | 254 base::OS::Print("\n"); |
| 212 for (HashMap::Entry* p = children_.Start(); | 255 for (HashMap::Entry* p = children_.Start(); |
| 213 p != NULL; | 256 p != NULL; |
| 214 p = children_.Next(p)) { | 257 p = children_.Next(p)) { |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 235 root_(new ProfileNode(this, &root_entry_)) { | 278 root_(new ProfileNode(this, &root_entry_)) { |
| 236 } | 279 } |
| 237 | 280 |
| 238 | 281 |
| 239 ProfileTree::~ProfileTree() { | 282 ProfileTree::~ProfileTree() { |
| 240 DeleteNodesCallback cb; | 283 DeleteNodesCallback cb; |
| 241 TraverseDepthFirst(&cb); | 284 TraverseDepthFirst(&cb); |
| 242 } | 285 } |
| 243 | 286 |
| 244 | 287 |
| 245 ProfileNode* ProfileTree::AddPathFromEnd(const Vector<CodeEntry*>& path) { | 288 ProfileNode* ProfileTree::AddPathFromEnd(const Vector<CodeEntry*>& path, |
| 289 int src_line) { | |
| 246 ProfileNode* node = root_; | 290 ProfileNode* node = root_; |
| 247 for (CodeEntry** entry = path.start() + path.length() - 1; | 291 for (CodeEntry** entry = path.start() + path.length() - 1; |
| 248 entry != path.start() - 1; | 292 entry != path.start() - 1; |
| 249 --entry) { | 293 --entry) { |
| 250 if (*entry != NULL) { | 294 if (*entry != NULL) { |
| 251 node = node->FindOrAddChild(*entry); | 295 node = node->FindOrAddChild(*entry); |
| 252 } | 296 } |
| 253 } | 297 } |
| 254 node->IncrementSelfTicks(); | 298 node->IncrementSelfTicks(); |
| 299 if (src_line != v8::CpuProfileNode::kNoLineNumberInfo) { | |
| 300 node->IncrementLineTicks(src_line); | |
| 301 } | |
| 255 return node; | 302 return node; |
| 256 } | 303 } |
| 257 | 304 |
| 258 | 305 |
| 259 void ProfileTree::AddPathFromStart(const Vector<CodeEntry*>& path) { | 306 void ProfileTree::AddPathFromStart(const Vector<CodeEntry*>& path, |
| 307 int src_line) { | |
| 260 ProfileNode* node = root_; | 308 ProfileNode* node = root_; |
| 261 for (CodeEntry** entry = path.start(); | 309 for (CodeEntry** entry = path.start(); |
| 262 entry != path.start() + path.length(); | 310 entry != path.start() + path.length(); |
| 263 ++entry) { | 311 ++entry) { |
| 264 if (*entry != NULL) { | 312 if (*entry != NULL) { |
| 265 node = node->FindOrAddChild(*entry); | 313 node = node->FindOrAddChild(*entry); |
| 266 } | 314 } |
| 267 } | 315 } |
| 268 node->IncrementSelfTicks(); | 316 node->IncrementSelfTicks(); |
| 317 if (src_line != v8::CpuProfileNode::kNoLineNumberInfo) { | |
| 318 node->IncrementLineTicks(src_line); | |
| 319 } | |
| 269 } | 320 } |
| 270 | 321 |
| 271 | 322 |
| 272 struct NodesPair { | 323 struct NodesPair { |
| 273 NodesPair(ProfileNode* src, ProfileNode* dst) | 324 NodesPair(ProfileNode* src, ProfileNode* dst) |
| 274 : src(src), dst(dst) { } | 325 : src(src), dst(dst) { } |
| 275 ProfileNode* src; | 326 ProfileNode* src; |
| 276 ProfileNode* dst; | 327 ProfileNode* dst; |
| 277 }; | 328 }; |
| 278 | 329 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 320 | 371 |
| 321 | 372 |
| 322 CpuProfile::CpuProfile(const char* title, bool record_samples) | 373 CpuProfile::CpuProfile(const char* title, bool record_samples) |
| 323 : title_(title), | 374 : title_(title), |
| 324 record_samples_(record_samples), | 375 record_samples_(record_samples), |
| 325 start_time_(base::TimeTicks::HighResolutionNow()) { | 376 start_time_(base::TimeTicks::HighResolutionNow()) { |
| 326 } | 377 } |
| 327 | 378 |
| 328 | 379 |
| 329 void CpuProfile::AddPath(base::TimeTicks timestamp, | 380 void CpuProfile::AddPath(base::TimeTicks timestamp, |
| 330 const Vector<CodeEntry*>& path) { | 381 const Vector<CodeEntry*>& path, int src_line) { |
| 331 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); | 382 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path, src_line); |
| 332 if (record_samples_) { | 383 if (record_samples_) { |
| 333 timestamps_.Add(timestamp); | 384 timestamps_.Add(timestamp); |
| 334 samples_.Add(top_frame_node); | 385 samples_.Add(top_frame_node); |
| 335 } | 386 } |
| 336 } | 387 } |
| 337 | 388 |
| 338 | 389 |
| 339 void CpuProfile::CalculateTotalTicksAndSamplingRate() { | 390 void CpuProfile::CalculateTotalTicksAndSamplingRate() { |
| 340 end_time_ = base::TimeTicks::HighResolutionNow(); | 391 end_time_ = base::TimeTicks::HighResolutionNow(); |
| 341 } | 392 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 if (profile == finished_profiles_[i]) { | 561 if (profile == finished_profiles_[i]) { |
| 511 finished_profiles_.Remove(i); | 562 finished_profiles_.Remove(i); |
| 512 return; | 563 return; |
| 513 } | 564 } |
| 514 } | 565 } |
| 515 UNREACHABLE(); | 566 UNREACHABLE(); |
| 516 } | 567 } |
| 517 | 568 |
| 518 | 569 |
| 519 void CpuProfilesCollection::AddPathToCurrentProfiles( | 570 void CpuProfilesCollection::AddPathToCurrentProfiles( |
| 520 base::TimeTicks timestamp, const Vector<CodeEntry*>& path) { | 571 base::TimeTicks timestamp, const Vector<CodeEntry*>& path, int src_line) { |
| 521 // As starting / stopping profiles is rare relatively to this | 572 // As starting / stopping profiles is rare relatively to this |
| 522 // method, we don't bother minimizing the duration of lock holding, | 573 // method, we don't bother minimizing the duration of lock holding, |
| 523 // e.g. copying contents of the list to a local vector. | 574 // e.g. copying contents of the list to a local vector. |
| 524 current_profiles_semaphore_.Wait(); | 575 current_profiles_semaphore_.Wait(); |
| 525 for (int i = 0; i < current_profiles_.length(); ++i) { | 576 for (int i = 0; i < current_profiles_.length(); ++i) { |
| 526 current_profiles_[i]->AddPath(timestamp, path); | 577 current_profiles_[i]->AddPath(timestamp, path, src_line); |
| 527 } | 578 } |
| 528 current_profiles_semaphore_.Signal(); | 579 current_profiles_semaphore_.Signal(); |
| 529 } | 580 } |
| 530 | 581 |
| 531 | 582 |
| 532 CodeEntry* CpuProfilesCollection::NewCodeEntry( | 583 CodeEntry* CpuProfilesCollection::NewCodeEntry( |
| 533 Logger::LogEventsAndTags tag, | 584 Logger::LogEventsAndTags tag, const char* name, const char* name_prefix, |
| 534 const char* name, | 585 const char* resource_name, int line_number, int column_number, |
| 535 const char* name_prefix, | 586 JITLineInfoTable* line_info) { |
| 536 const char* resource_name, | 587 CodeEntry* code_entry = new CodeEntry(tag, name, name_prefix, resource_name, |
| 537 int line_number, | 588 line_number, column_number, line_info); |
| 538 int column_number) { | |
| 539 CodeEntry* code_entry = new CodeEntry(tag, | |
| 540 name, | |
| 541 name_prefix, | |
| 542 resource_name, | |
| 543 line_number, | |
| 544 column_number); | |
| 545 code_entries_.Add(code_entry); | 589 code_entries_.Add(code_entry); |
| 546 return code_entry; | 590 return code_entry; |
| 547 } | 591 } |
| 548 | 592 |
| 549 | 593 |
| 550 const char* const ProfileGenerator::kProgramEntryName = | 594 const char* const ProfileGenerator::kProgramEntryName = |
| 551 "(program)"; | 595 "(program)"; |
| 552 const char* const ProfileGenerator::kIdleEntryName = | 596 const char* const ProfileGenerator::kIdleEntryName = |
| 553 "(idle)"; | 597 "(idle)"; |
| 554 const char* const ProfileGenerator::kGarbageCollectorEntryName = | 598 const char* const ProfileGenerator::kGarbageCollectorEntryName = |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 572 } | 616 } |
| 573 | 617 |
| 574 | 618 |
| 575 void ProfileGenerator::RecordTickSample(const TickSample& sample) { | 619 void ProfileGenerator::RecordTickSample(const TickSample& sample) { |
| 576 // Allocate space for stack frames + pc + function + vm-state. | 620 // Allocate space for stack frames + pc + function + vm-state. |
| 577 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); | 621 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); |
| 578 // As actual number of decoded code entries may vary, initialize | 622 // As actual number of decoded code entries may vary, initialize |
| 579 // entries vector with NULL values. | 623 // entries vector with NULL values. |
| 580 CodeEntry** entry = entries.start(); | 624 CodeEntry** entry = entries.start(); |
| 581 memset(entry, 0, entries.length() * sizeof(*entry)); | 625 memset(entry, 0, entries.length() * sizeof(*entry)); |
| 626 | |
| 627 // The ProfileNode knows nothing about all versions of generated code for | |
| 628 // the same JS function. The line number information associated with | |
| 629 // the latest version of generated code is used to find a source line number | |
| 630 // for a JS function. Then, the detected source line is passed to | |
| 631 // ProfileNode to accumulate the samples. | |
| 632 int src_line = v8::CpuProfileNode::kNoLineNumberInfo; | |
| 633 | |
| 582 if (sample.pc != NULL) { | 634 if (sample.pc != NULL) { |
| 583 if (sample.has_external_callback && sample.state == EXTERNAL && | 635 if (sample.has_external_callback && sample.state == EXTERNAL && |
| 584 sample.top_frame_type == StackFrame::EXIT) { | 636 sample.top_frame_type == StackFrame::EXIT) { |
| 585 // Don't use PC when in external callback code, as it can point | 637 // Don't use PC when in external callback code, as it can point |
| 586 // inside callback's code, and we will erroneously report | 638 // inside callback's code, and we will erroneously report |
| 587 // that a callback calls itself. | 639 // that a callback calls itself. |
| 588 *entry++ = code_map_.FindEntry(sample.external_callback); | 640 *entry++ = code_map_.FindEntry(sample.external_callback); |
| 589 } else { | 641 } else { |
| 590 Address start; | 642 Address start; |
| 591 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); | 643 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); |
| 592 // If pc is in the function code before it set up stack frame or after the | 644 // If pc is in the function code before it set up stack frame or after the |
| 593 // frame was destroyed SafeStackFrameIterator incorrectly thinks that | 645 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
| 594 // ebp contains return address of the current function and skips caller's | 646 // ebp contains return address of the current function and skips caller's |
| 595 // frame. Check for this case and just skip such samples. | 647 // frame. Check for this case and just skip such samples. |
| 596 if (pc_entry) { | 648 if (pc_entry) { |
| 597 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); | 649 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); |
| 650 Code* code = Code::cast(HeapObject::FromAddress(start)); | |
| 651 int pc_offset = static_cast<int>(sample.pc - code->instruction_start()); | |
| 652 src_line = pc_entry->GetSourceLine(pc_offset); | |
|
yurys
2014/09/10 08:05:14
nit: move assignment to src_line after the "if" be
| |
| 598 if (ranges) { | 653 if (ranges) { |
| 599 Code* code = Code::cast(HeapObject::FromAddress(start)); | |
| 600 int pc_offset = static_cast<int>( | |
| 601 sample.pc - code->instruction_start()); | |
| 602 for (int i = 0; i < ranges->length(); i++) { | 654 for (int i = 0; i < ranges->length(); i++) { |
| 603 OffsetRange& range = ranges->at(i); | 655 OffsetRange& range = ranges->at(i); |
| 604 if (range.from <= pc_offset && pc_offset < range.to) { | 656 if (range.from <= pc_offset && pc_offset < range.to) { |
| 605 return; | 657 return; |
| 606 } | 658 } |
| 607 } | 659 } |
| 608 } | 660 } |
| 609 *entry++ = pc_entry; | 661 *entry++ = pc_entry; |
| 610 | 662 |
| 611 if (pc_entry->builtin_id() == Builtins::kFunctionCall || | 663 if (pc_entry->builtin_id() == Builtins::kFunctionCall || |
| 612 pc_entry->builtin_id() == Builtins::kFunctionApply) { | 664 pc_entry->builtin_id() == Builtins::kFunctionApply) { |
| 613 // When current function is FunctionCall or FunctionApply builtin the | 665 // When current function is FunctionCall or FunctionApply builtin the |
| 614 // top frame is either frame of the calling JS function or internal | 666 // top frame is either frame of the calling JS function or internal |
| 615 // frame. In the latter case we know the caller for sure but in the | 667 // frame. In the latter case we know the caller for sure but in the |
| 616 // former case we don't so we simply replace the frame with | 668 // former case we don't so we simply replace the frame with |
| 617 // 'unresolved' entry. | 669 // 'unresolved' entry. |
| 618 if (sample.top_frame_type == StackFrame::JAVA_SCRIPT) { | 670 if (sample.top_frame_type == StackFrame::JAVA_SCRIPT) { |
| 619 *entry++ = unresolved_entry_; | 671 *entry++ = unresolved_entry_; |
| 620 } | 672 } |
| 621 } | 673 } |
| 622 } | 674 } |
| 623 } | 675 } |
| 624 | 676 |
| 677 bool src_line_not_found = src_line == v8::CpuProfileNode::kNoLineNumberInfo; | |
| 678 | |
| 625 for (const Address* stack_pos = sample.stack, | 679 for (const Address* stack_pos = sample.stack, |
| 626 *stack_end = stack_pos + sample.frames_count; | 680 *stack_end = stack_pos + sample.frames_count; |
| 627 stack_pos != stack_end; | 681 stack_pos != stack_end; |
| 628 ++stack_pos) { | 682 ++stack_pos) { |
| 629 *entry++ = code_map_.FindEntry(*stack_pos); | 683 Address start = NULL; |
| 684 *entry = code_map_.FindEntry(*stack_pos, &start); | |
| 685 | |
| 686 // Skip unresolved frames (e.g. internal frame) and get source line of | |
| 687 // the JS caller. | |
| 688 if (src_line_not_found && *entry) { | |
|
yurys
2014/09/10 08:05:14
With this approach we may end up with top entry be
Denis Pravdin
2014/09/11 08:14:44
pc_offset that used to calculate src_line is taken
yurys
2014/09/12 13:46:28
If src_line = pc_entry->GetSourceLine(pc_offset);
| |
| 689 Code* code = Code::cast(HeapObject::FromAddress(start)); | |
| 690 int pc_offset = | |
| 691 static_cast<int>(*stack_pos - code->instruction_start()); | |
| 692 src_line = (*entry)->GetSourceLine(pc_offset); | |
| 693 if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) { | |
| 694 src_line = (*entry)->line_number(); | |
| 695 } | |
| 696 src_line_not_found = false; | |
| 697 } | |
| 698 | |
| 699 entry++; | |
| 630 } | 700 } |
| 631 } | 701 } |
| 632 | 702 |
| 633 if (FLAG_prof_browser_mode) { | 703 if (FLAG_prof_browser_mode) { |
| 634 bool no_symbolized_entries = true; | 704 bool no_symbolized_entries = true; |
| 635 for (CodeEntry** e = entries.start(); e != entry; ++e) { | 705 for (CodeEntry** e = entries.start(); e != entry; ++e) { |
| 636 if (*e != NULL) { | 706 if (*e != NULL) { |
| 637 no_symbolized_entries = false; | 707 no_symbolized_entries = false; |
| 638 break; | 708 break; |
| 639 } | 709 } |
| 640 } | 710 } |
| 641 // If no frames were symbolized, put the VM state entry in. | 711 // If no frames were symbolized, put the VM state entry in. |
| 642 if (no_symbolized_entries) { | 712 if (no_symbolized_entries) { |
| 643 *entry++ = EntryForVMState(sample.state); | 713 *entry++ = EntryForVMState(sample.state); |
| 644 } | 714 } |
| 645 } | 715 } |
| 646 | 716 |
| 647 profiles_->AddPathToCurrentProfiles(sample.timestamp, entries); | 717 profiles_->AddPathToCurrentProfiles(sample.timestamp, entries, src_line); |
| 648 } | 718 } |
| 649 | 719 |
| 650 | 720 |
| 651 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { | 721 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { |
| 652 switch (tag) { | 722 switch (tag) { |
| 653 case GC: | 723 case GC: |
| 654 return gc_entry_; | 724 return gc_entry_; |
| 655 case JS: | 725 case JS: |
| 656 case COMPILER: | 726 case COMPILER: |
| 657 // DOM events handlers are reported as OTHER / EXTERNAL entries. | 727 // DOM events handlers are reported as OTHER / EXTERNAL entries. |
| 658 // To avoid confusing people, let's put all these entries into | 728 // To avoid confusing people, let's put all these entries into |
| 659 // one bucket. | 729 // one bucket. |
| 660 case OTHER: | 730 case OTHER: |
| 661 case EXTERNAL: | 731 case EXTERNAL: |
| 662 return program_entry_; | 732 return program_entry_; |
| 663 case IDLE: | 733 case IDLE: |
| 664 return idle_entry_; | 734 return idle_entry_; |
| 665 default: return NULL; | 735 default: return NULL; |
| 666 } | 736 } |
| 667 } | 737 } |
| 668 | 738 |
| 669 } } // namespace v8::internal | 739 } } // namespace v8::internal |
| OLD | NEW |