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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 return size; | 125 return size; |
126 } | 126 } |
127 | 127 |
128 | 128 |
129 HashMap::Entry* StringsStorage::GetEntry(const char* str, int len) { | 129 HashMap::Entry* StringsStorage::GetEntry(const char* str, int len) { |
130 uint32_t hash = StringHasher::HashSequentialString(str, len, hash_seed_); | 130 uint32_t hash = StringHasher::HashSequentialString(str, len, hash_seed_); |
131 return names_.Lookup(const_cast<char*>(str), hash, true); | 131 return names_.Lookup(const_cast<char*>(str), hash, true); |
132 } | 132 } |
133 | 133 |
134 | 134 |
| 135 JITLineInfoTable::JITLineInfoTable() {} |
| 136 |
| 137 |
| 138 JITLineInfoTable::~JITLineInfoTable() {} |
| 139 |
| 140 |
| 141 void JITLineInfoTable::SetPosition(int pc_offset, int line) { |
| 142 DCHECK(pc_offset >= 0); |
| 143 DCHECK(line > 0); // The 1-based number of the source line. |
| 144 if (GetSourceLineNumber(pc_offset) != line) { |
| 145 pc_offset_map_.insert(std::make_pair(pc_offset, line)); |
| 146 } |
| 147 } |
| 148 |
| 149 |
| 150 int JITLineInfoTable::GetSourceLineNumber(int pc_offset) const { |
| 151 PcOffsetMap::const_iterator it = pc_offset_map_.lower_bound(pc_offset); |
| 152 if (it == pc_offset_map_.end()) { |
| 153 if (pc_offset_map_.empty()) return v8::CpuProfileNode::kNoLineNumberInfo; |
| 154 return (--pc_offset_map_.end())->second; |
| 155 } |
| 156 return it->second; |
| 157 } |
| 158 |
| 159 |
135 const char* const CodeEntry::kEmptyNamePrefix = ""; | 160 const char* const CodeEntry::kEmptyNamePrefix = ""; |
136 const char* const CodeEntry::kEmptyResourceName = ""; | 161 const char* const CodeEntry::kEmptyResourceName = ""; |
137 const char* const CodeEntry::kEmptyBailoutReason = ""; | 162 const char* const CodeEntry::kEmptyBailoutReason = ""; |
138 | 163 |
139 | 164 |
140 CodeEntry::~CodeEntry() { | 165 CodeEntry::~CodeEntry() { |
141 delete no_frame_ranges_; | 166 delete no_frame_ranges_; |
| 167 delete line_info_; |
142 } | 168 } |
143 | 169 |
144 | 170 |
145 uint32_t CodeEntry::GetCallUid() const { | 171 uint32_t CodeEntry::GetCallUid() const { |
146 uint32_t hash = ComputeIntegerHash(tag(), v8::internal::kZeroHashSeed); | 172 uint32_t hash = ComputeIntegerHash(tag(), v8::internal::kZeroHashSeed); |
147 if (shared_id_ != 0) { | 173 if (shared_id_ != 0) { |
148 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), | 174 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), |
149 v8::internal::kZeroHashSeed); | 175 v8::internal::kZeroHashSeed); |
150 } else { | 176 } else { |
151 hash ^= ComputeIntegerHash( | 177 hash ^= ComputeIntegerHash( |
(...skipping 20 matching lines...) Expand all Loading... |
172 line_number_ == entry->line_number_))); | 198 line_number_ == entry->line_number_))); |
173 } | 199 } |
174 | 200 |
175 | 201 |
176 void CodeEntry::SetBuiltinId(Builtins::Name id) { | 202 void CodeEntry::SetBuiltinId(Builtins::Name id) { |
177 bit_field_ = TagField::update(bit_field_, Logger::BUILTIN_TAG); | 203 bit_field_ = TagField::update(bit_field_, Logger::BUILTIN_TAG); |
178 bit_field_ = BuiltinIdField::update(bit_field_, id); | 204 bit_field_ = BuiltinIdField::update(bit_field_, id); |
179 } | 205 } |
180 | 206 |
181 | 207 |
| 208 int CodeEntry::GetSourceLine(int pc_offset) const { |
| 209 if (line_info_ && !line_info_->empty()) { |
| 210 return line_info_->GetSourceLineNumber(pc_offset); |
| 211 } |
| 212 return v8::CpuProfileNode::kNoLineNumberInfo; |
| 213 } |
| 214 |
| 215 |
182 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { | 216 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { |
183 HashMap::Entry* map_entry = | 217 HashMap::Entry* map_entry = |
184 children_.Lookup(entry, CodeEntryHash(entry), false); | 218 children_.Lookup(entry, CodeEntryHash(entry), false); |
185 return map_entry != NULL ? | 219 return map_entry != NULL ? |
186 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; | 220 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; |
187 } | 221 } |
188 | 222 |
189 | 223 |
190 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { | 224 ProfileNode* ProfileNode::FindOrAddChild(CodeEntry* entry) { |
191 HashMap::Entry* map_entry = | 225 HashMap::Entry* map_entry = |
192 children_.Lookup(entry, CodeEntryHash(entry), true); | 226 children_.Lookup(entry, CodeEntryHash(entry), true); |
193 if (map_entry->value == NULL) { | 227 if (map_entry->value == NULL) { |
194 // New node added. | 228 // New node added. |
195 ProfileNode* new_node = new ProfileNode(tree_, entry); | 229 ProfileNode* new_node = new ProfileNode(tree_, entry); |
196 map_entry->value = new_node; | 230 map_entry->value = new_node; |
197 children_list_.Add(new_node); | 231 children_list_.Add(new_node); |
198 } | 232 } |
199 return reinterpret_cast<ProfileNode*>(map_entry->value); | 233 return reinterpret_cast<ProfileNode*>(map_entry->value); |
200 } | 234 } |
201 | 235 |
202 | 236 |
| 237 void ProfileNode::IncrementLineTicks(int src_line) { |
| 238 if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) return; |
| 239 // Increment a hit counter of a certain source line. |
| 240 // Add a new source line if not found. |
| 241 HashMap::Entry* e = |
| 242 line_ticks_.Lookup(reinterpret_cast<void*>(src_line), src_line, true); |
| 243 DCHECK(e); |
| 244 e->value = reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(e->value) + 1); |
| 245 } |
| 246 |
| 247 |
| 248 bool ProfileNode::GetLineTicks(v8::CpuProfileNode::LineTick* entries, |
| 249 unsigned int length) const { |
| 250 if (entries == NULL || length == 0) return false; |
| 251 |
| 252 unsigned line_count = line_ticks_.occupancy(); |
| 253 |
| 254 if (line_count == 0) return true; |
| 255 if (length < line_count) return false; |
| 256 |
| 257 v8::CpuProfileNode::LineTick* entry = entries; |
| 258 |
| 259 for (HashMap::Entry* p = line_ticks_.Start(); p != NULL; |
| 260 p = line_ticks_.Next(p), entry++) { |
| 261 entry->line = |
| 262 static_cast<unsigned int>(reinterpret_cast<uintptr_t>(p->key)); |
| 263 entry->hit_count = |
| 264 static_cast<unsigned int>(reinterpret_cast<uintptr_t>(p->value)); |
| 265 } |
| 266 |
| 267 return true; |
| 268 } |
| 269 |
| 270 |
203 void ProfileNode::Print(int indent) { | 271 void ProfileNode::Print(int indent) { |
204 base::OS::Print("%5u %*s %s%s %d #%d %s", self_ticks_, indent, "", | 272 base::OS::Print("%5u %*s %s%s %d #%d %s", self_ticks_, indent, "", |
205 entry_->name_prefix(), entry_->name(), entry_->script_id(), | 273 entry_->name_prefix(), entry_->name(), entry_->script_id(), |
206 id(), entry_->bailout_reason()); | 274 id(), entry_->bailout_reason()); |
207 if (entry_->resource_name()[0] != '\0') | 275 if (entry_->resource_name()[0] != '\0') |
208 base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); | 276 base::OS::Print(" %s:%d", entry_->resource_name(), entry_->line_number()); |
209 base::OS::Print("\n"); | 277 base::OS::Print("\n"); |
210 for (HashMap::Entry* p = children_.Start(); | 278 for (HashMap::Entry* p = children_.Start(); |
211 p != NULL; | 279 p != NULL; |
212 p = children_.Next(p)) { | 280 p = children_.Next(p)) { |
(...skipping 20 matching lines...) Expand all Loading... |
233 root_(new ProfileNode(this, &root_entry_)) { | 301 root_(new ProfileNode(this, &root_entry_)) { |
234 } | 302 } |
235 | 303 |
236 | 304 |
237 ProfileTree::~ProfileTree() { | 305 ProfileTree::~ProfileTree() { |
238 DeleteNodesCallback cb; | 306 DeleteNodesCallback cb; |
239 TraverseDepthFirst(&cb); | 307 TraverseDepthFirst(&cb); |
240 } | 308 } |
241 | 309 |
242 | 310 |
243 ProfileNode* ProfileTree::AddPathFromEnd(const Vector<CodeEntry*>& path) { | 311 ProfileNode* ProfileTree::AddPathFromEnd(const Vector<CodeEntry*>& path, |
| 312 int src_line) { |
244 ProfileNode* node = root_; | 313 ProfileNode* node = root_; |
245 for (CodeEntry** entry = path.start() + path.length() - 1; | 314 for (CodeEntry** entry = path.start() + path.length() - 1; |
246 entry != path.start() - 1; | 315 entry != path.start() - 1; |
247 --entry) { | 316 --entry) { |
248 if (*entry != NULL) { | 317 if (*entry != NULL) { |
249 node = node->FindOrAddChild(*entry); | 318 node = node->FindOrAddChild(*entry); |
250 } | 319 } |
251 } | 320 } |
252 node->IncrementSelfTicks(); | 321 node->IncrementSelfTicks(); |
| 322 if (src_line != v8::CpuProfileNode::kNoLineNumberInfo) { |
| 323 node->IncrementLineTicks(src_line); |
| 324 } |
253 return node; | 325 return node; |
254 } | 326 } |
255 | 327 |
256 | 328 |
257 void ProfileTree::AddPathFromStart(const Vector<CodeEntry*>& path) { | 329 void ProfileTree::AddPathFromStart(const Vector<CodeEntry*>& path, |
| 330 int src_line) { |
258 ProfileNode* node = root_; | 331 ProfileNode* node = root_; |
259 for (CodeEntry** entry = path.start(); | 332 for (CodeEntry** entry = path.start(); |
260 entry != path.start() + path.length(); | 333 entry != path.start() + path.length(); |
261 ++entry) { | 334 ++entry) { |
262 if (*entry != NULL) { | 335 if (*entry != NULL) { |
263 node = node->FindOrAddChild(*entry); | 336 node = node->FindOrAddChild(*entry); |
264 } | 337 } |
265 } | 338 } |
266 node->IncrementSelfTicks(); | 339 node->IncrementSelfTicks(); |
| 340 if (src_line != v8::CpuProfileNode::kNoLineNumberInfo) { |
| 341 node->IncrementLineTicks(src_line); |
| 342 } |
267 } | 343 } |
268 | 344 |
269 | 345 |
270 struct NodesPair { | 346 struct NodesPair { |
271 NodesPair(ProfileNode* src, ProfileNode* dst) | 347 NodesPair(ProfileNode* src, ProfileNode* dst) |
272 : src(src), dst(dst) { } | 348 : src(src), dst(dst) { } |
273 ProfileNode* src; | 349 ProfileNode* src; |
274 ProfileNode* dst; | 350 ProfileNode* dst; |
275 }; | 351 }; |
276 | 352 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 | 394 |
319 | 395 |
320 CpuProfile::CpuProfile(const char* title, bool record_samples) | 396 CpuProfile::CpuProfile(const char* title, bool record_samples) |
321 : title_(title), | 397 : title_(title), |
322 record_samples_(record_samples), | 398 record_samples_(record_samples), |
323 start_time_(base::TimeTicks::HighResolutionNow()) { | 399 start_time_(base::TimeTicks::HighResolutionNow()) { |
324 } | 400 } |
325 | 401 |
326 | 402 |
327 void CpuProfile::AddPath(base::TimeTicks timestamp, | 403 void CpuProfile::AddPath(base::TimeTicks timestamp, |
328 const Vector<CodeEntry*>& path) { | 404 const Vector<CodeEntry*>& path, int src_line) { |
329 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path); | 405 ProfileNode* top_frame_node = top_down_.AddPathFromEnd(path, src_line); |
330 if (record_samples_) { | 406 if (record_samples_) { |
331 timestamps_.Add(timestamp); | 407 timestamps_.Add(timestamp); |
332 samples_.Add(top_frame_node); | 408 samples_.Add(top_frame_node); |
333 } | 409 } |
334 } | 410 } |
335 | 411 |
336 | 412 |
337 void CpuProfile::CalculateTotalTicksAndSamplingRate() { | 413 void CpuProfile::CalculateTotalTicksAndSamplingRate() { |
338 end_time_ = base::TimeTicks::HighResolutionNow(); | 414 end_time_ = base::TimeTicks::HighResolutionNow(); |
339 } | 415 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 if (profile == finished_profiles_[i]) { | 584 if (profile == finished_profiles_[i]) { |
509 finished_profiles_.Remove(i); | 585 finished_profiles_.Remove(i); |
510 return; | 586 return; |
511 } | 587 } |
512 } | 588 } |
513 UNREACHABLE(); | 589 UNREACHABLE(); |
514 } | 590 } |
515 | 591 |
516 | 592 |
517 void CpuProfilesCollection::AddPathToCurrentProfiles( | 593 void CpuProfilesCollection::AddPathToCurrentProfiles( |
518 base::TimeTicks timestamp, const Vector<CodeEntry*>& path) { | 594 base::TimeTicks timestamp, const Vector<CodeEntry*>& path, int src_line) { |
519 // As starting / stopping profiles is rare relatively to this | 595 // As starting / stopping profiles is rare relatively to this |
520 // method, we don't bother minimizing the duration of lock holding, | 596 // method, we don't bother minimizing the duration of lock holding, |
521 // e.g. copying contents of the list to a local vector. | 597 // e.g. copying contents of the list to a local vector. |
522 current_profiles_semaphore_.Wait(); | 598 current_profiles_semaphore_.Wait(); |
523 for (int i = 0; i < current_profiles_.length(); ++i) { | 599 for (int i = 0; i < current_profiles_.length(); ++i) { |
524 current_profiles_[i]->AddPath(timestamp, path); | 600 current_profiles_[i]->AddPath(timestamp, path, src_line); |
525 } | 601 } |
526 current_profiles_semaphore_.Signal(); | 602 current_profiles_semaphore_.Signal(); |
527 } | 603 } |
528 | 604 |
529 | 605 |
530 CodeEntry* CpuProfilesCollection::NewCodeEntry( | 606 CodeEntry* CpuProfilesCollection::NewCodeEntry( |
531 Logger::LogEventsAndTags tag, | 607 Logger::LogEventsAndTags tag, const char* name, const char* name_prefix, |
532 const char* name, | 608 const char* resource_name, int line_number, int column_number, |
533 const char* name_prefix, | 609 JITLineInfoTable* line_info, Address instruction_start) { |
534 const char* resource_name, | 610 CodeEntry* code_entry = |
535 int line_number, | 611 new CodeEntry(tag, name, name_prefix, resource_name, line_number, |
536 int column_number) { | 612 column_number, line_info, instruction_start); |
537 CodeEntry* code_entry = new CodeEntry(tag, | |
538 name, | |
539 name_prefix, | |
540 resource_name, | |
541 line_number, | |
542 column_number); | |
543 code_entries_.Add(code_entry); | 613 code_entries_.Add(code_entry); |
544 return code_entry; | 614 return code_entry; |
545 } | 615 } |
546 | 616 |
547 | 617 |
548 const char* const ProfileGenerator::kProgramEntryName = | 618 const char* const ProfileGenerator::kProgramEntryName = |
549 "(program)"; | 619 "(program)"; |
550 const char* const ProfileGenerator::kIdleEntryName = | 620 const char* const ProfileGenerator::kIdleEntryName = |
551 "(idle)"; | 621 "(idle)"; |
552 const char* const ProfileGenerator::kGarbageCollectorEntryName = | 622 const char* const ProfileGenerator::kGarbageCollectorEntryName = |
(...skipping 17 matching lines...) Expand all Loading... |
570 } | 640 } |
571 | 641 |
572 | 642 |
573 void ProfileGenerator::RecordTickSample(const TickSample& sample) { | 643 void ProfileGenerator::RecordTickSample(const TickSample& sample) { |
574 // Allocate space for stack frames + pc + function + vm-state. | 644 // Allocate space for stack frames + pc + function + vm-state. |
575 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); | 645 ScopedVector<CodeEntry*> entries(sample.frames_count + 3); |
576 // As actual number of decoded code entries may vary, initialize | 646 // As actual number of decoded code entries may vary, initialize |
577 // entries vector with NULL values. | 647 // entries vector with NULL values. |
578 CodeEntry** entry = entries.start(); | 648 CodeEntry** entry = entries.start(); |
579 memset(entry, 0, entries.length() * sizeof(*entry)); | 649 memset(entry, 0, entries.length() * sizeof(*entry)); |
| 650 |
| 651 // The ProfileNode knows nothing about all versions of generated code for |
| 652 // the same JS function. The line number information associated with |
| 653 // the latest version of generated code is used to find a source line number |
| 654 // for a JS function. Then, the detected source line is passed to |
| 655 // ProfileNode to increase the tick count for this source line. |
| 656 int src_line = v8::CpuProfileNode::kNoLineNumberInfo; |
| 657 bool src_line_not_found = true; |
| 658 |
580 if (sample.pc != NULL) { | 659 if (sample.pc != NULL) { |
581 if (sample.has_external_callback && sample.state == EXTERNAL && | 660 if (sample.has_external_callback && sample.state == EXTERNAL && |
582 sample.top_frame_type == StackFrame::EXIT) { | 661 sample.top_frame_type == StackFrame::EXIT) { |
583 // Don't use PC when in external callback code, as it can point | 662 // Don't use PC when in external callback code, as it can point |
584 // inside callback's code, and we will erroneously report | 663 // inside callback's code, and we will erroneously report |
585 // that a callback calls itself. | 664 // that a callback calls itself. |
586 *entry++ = code_map_.FindEntry(sample.external_callback); | 665 *entry++ = code_map_.FindEntry(sample.external_callback); |
587 } else { | 666 } else { |
588 Address start; | 667 Address start; |
589 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); | 668 CodeEntry* pc_entry = code_map_.FindEntry(sample.pc, &start); |
590 // If pc is in the function code before it set up stack frame or after the | 669 // If pc is in the function code before it set up stack frame or after the |
591 // frame was destroyed SafeStackFrameIterator incorrectly thinks that | 670 // frame was destroyed SafeStackFrameIterator incorrectly thinks that |
592 // ebp contains return address of the current function and skips caller's | 671 // ebp contains return address of the current function and skips caller's |
593 // frame. Check for this case and just skip such samples. | 672 // frame. Check for this case and just skip such samples. |
594 if (pc_entry) { | 673 if (pc_entry) { |
595 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); | 674 List<OffsetRange>* ranges = pc_entry->no_frame_ranges(); |
| 675 int pc_offset = |
| 676 static_cast<int>(sample.pc - pc_entry->instruction_start()); |
596 if (ranges) { | 677 if (ranges) { |
597 Code* code = Code::cast(HeapObject::FromAddress(start)); | |
598 int pc_offset = static_cast<int>( | |
599 sample.pc - code->instruction_start()); | |
600 for (int i = 0; i < ranges->length(); i++) { | 678 for (int i = 0; i < ranges->length(); i++) { |
601 OffsetRange& range = ranges->at(i); | 679 OffsetRange& range = ranges->at(i); |
602 if (range.from <= pc_offset && pc_offset < range.to) { | 680 if (range.from <= pc_offset && pc_offset < range.to) { |
603 return; | 681 return; |
604 } | 682 } |
605 } | 683 } |
606 } | 684 } |
| 685 src_line = pc_entry->GetSourceLine(pc_offset); |
| 686 if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) { |
| 687 src_line = pc_entry->line_number(); |
| 688 } |
| 689 src_line_not_found = false; |
607 *entry++ = pc_entry; | 690 *entry++ = pc_entry; |
608 | 691 |
609 if (pc_entry->builtin_id() == Builtins::kFunctionCall || | 692 if (pc_entry->builtin_id() == Builtins::kFunctionCall || |
610 pc_entry->builtin_id() == Builtins::kFunctionApply) { | 693 pc_entry->builtin_id() == Builtins::kFunctionApply) { |
611 // When current function is FunctionCall or FunctionApply builtin the | 694 // When current function is FunctionCall or FunctionApply builtin the |
612 // top frame is either frame of the calling JS function or internal | 695 // top frame is either frame of the calling JS function or internal |
613 // frame. In the latter case we know the caller for sure but in the | 696 // frame. In the latter case we know the caller for sure but in the |
614 // former case we don't so we simply replace the frame with | 697 // former case we don't so we simply replace the frame with |
615 // 'unresolved' entry. | 698 // 'unresolved' entry. |
616 if (sample.top_frame_type == StackFrame::JAVA_SCRIPT) { | 699 if (sample.top_frame_type == StackFrame::JAVA_SCRIPT) { |
617 *entry++ = unresolved_entry_; | 700 *entry++ = unresolved_entry_; |
618 } | 701 } |
619 } | 702 } |
620 } | 703 } |
621 } | 704 } |
622 | 705 |
623 for (const Address* stack_pos = sample.stack, | 706 for (const Address* stack_pos = sample.stack, |
624 *stack_end = stack_pos + sample.frames_count; | 707 *stack_end = stack_pos + sample.frames_count; |
625 stack_pos != stack_end; | 708 stack_pos != stack_end; |
626 ++stack_pos) { | 709 ++stack_pos) { |
627 *entry++ = code_map_.FindEntry(*stack_pos); | 710 Address start = NULL; |
| 711 *entry = code_map_.FindEntry(*stack_pos, &start); |
| 712 |
| 713 // Skip unresolved frames (e.g. internal frame) and get source line of |
| 714 // the first JS caller. |
| 715 if (src_line_not_found && *entry) { |
| 716 int pc_offset = |
| 717 static_cast<int>(*stack_pos - (*entry)->instruction_start()); |
| 718 src_line = (*entry)->GetSourceLine(pc_offset); |
| 719 if (src_line == v8::CpuProfileNode::kNoLineNumberInfo) { |
| 720 src_line = (*entry)->line_number(); |
| 721 } |
| 722 src_line_not_found = false; |
| 723 } |
| 724 |
| 725 entry++; |
628 } | 726 } |
629 } | 727 } |
630 | 728 |
631 if (FLAG_prof_browser_mode) { | 729 if (FLAG_prof_browser_mode) { |
632 bool no_symbolized_entries = true; | 730 bool no_symbolized_entries = true; |
633 for (CodeEntry** e = entries.start(); e != entry; ++e) { | 731 for (CodeEntry** e = entries.start(); e != entry; ++e) { |
634 if (*e != NULL) { | 732 if (*e != NULL) { |
635 no_symbolized_entries = false; | 733 no_symbolized_entries = false; |
636 break; | 734 break; |
637 } | 735 } |
638 } | 736 } |
639 // If no frames were symbolized, put the VM state entry in. | 737 // If no frames were symbolized, put the VM state entry in. |
640 if (no_symbolized_entries) { | 738 if (no_symbolized_entries) { |
641 *entry++ = EntryForVMState(sample.state); | 739 *entry++ = EntryForVMState(sample.state); |
642 } | 740 } |
643 } | 741 } |
644 | 742 |
645 profiles_->AddPathToCurrentProfiles(sample.timestamp, entries); | 743 profiles_->AddPathToCurrentProfiles(sample.timestamp, entries, src_line); |
646 } | 744 } |
647 | 745 |
648 | 746 |
649 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { | 747 CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) { |
650 switch (tag) { | 748 switch (tag) { |
651 case GC: | 749 case GC: |
652 return gc_entry_; | 750 return gc_entry_; |
653 case JS: | 751 case JS: |
654 case COMPILER: | 752 case COMPILER: |
655 // DOM events handlers are reported as OTHER / EXTERNAL entries. | 753 // DOM events handlers are reported as OTHER / EXTERNAL entries. |
656 // To avoid confusing people, let's put all these entries into | 754 // To avoid confusing people, let's put all these entries into |
657 // one bucket. | 755 // one bucket. |
658 case OTHER: | 756 case OTHER: |
659 case EXTERNAL: | 757 case EXTERNAL: |
660 return program_entry_; | 758 return program_entry_; |
661 case IDLE: | 759 case IDLE: |
662 return idle_entry_; | 760 return idle_entry_; |
663 default: return NULL; | 761 default: return NULL; |
664 } | 762 } |
665 } | 763 } |
666 | 764 |
667 } } // namespace v8::internal | 765 } } // namespace v8::internal |
OLD | NEW |