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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 return ""; | 100 return ""; |
101 } | 101 } |
102 | 102 |
103 | 103 |
104 const char* StringsStorage::GetName(int index) { | 104 const char* StringsStorage::GetName(int index) { |
105 return GetFormatted("%d", index); | 105 return GetFormatted("%d", index); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 const char* StringsStorage::GetFunctionName(Name* name) { | 109 const char* StringsStorage::GetFunctionName(Name* name) { |
110 return BeautifyFunctionName(GetName(name)); | 110 return GetName(name); |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 const char* StringsStorage::GetFunctionName(const char* name) { | 114 const char* StringsStorage::GetFunctionName(const char* name) { |
115 return BeautifyFunctionName(GetCopy(name)); | 115 return GetCopy(name); |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 const char* StringsStorage::BeautifyFunctionName(const char* name) { | |
120 return (*name == 0) ? ProfileGenerator::kAnonymousFunctionName : name; | |
121 } | |
122 | |
123 | |
124 size_t StringsStorage::GetUsedMemorySize() const { | 119 size_t StringsStorage::GetUsedMemorySize() const { |
125 size_t size = sizeof(*this); | 120 size_t size = sizeof(*this); |
126 size += sizeof(HashMap::Entry) * names_.capacity(); | 121 size += sizeof(HashMap::Entry) * names_.capacity(); |
127 for (HashMap::Entry* p = names_.Start(); p != NULL; p = names_.Next(p)) { | 122 for (HashMap::Entry* p = names_.Start(); p != NULL; p = names_.Next(p)) { |
128 size += strlen(reinterpret_cast<const char*>(p->value)) + 1; | 123 size += strlen(reinterpret_cast<const char*>(p->value)) + 1; |
129 } | 124 } |
130 return size; | 125 return size; |
131 } | 126 } |
132 | 127 |
133 | 128 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 name, | 540 name, |
546 name_prefix, | 541 name_prefix, |
547 resource_name, | 542 resource_name, |
548 line_number, | 543 line_number, |
549 column_number); | 544 column_number); |
550 code_entries_.Add(code_entry); | 545 code_entries_.Add(code_entry); |
551 return code_entry; | 546 return code_entry; |
552 } | 547 } |
553 | 548 |
554 | 549 |
555 const char* const ProfileGenerator::kAnonymousFunctionName = | |
556 "(anonymous function)"; | |
557 const char* const ProfileGenerator::kProgramEntryName = | 550 const char* const ProfileGenerator::kProgramEntryName = |
558 "(program)"; | 551 "(program)"; |
559 const char* const ProfileGenerator::kIdleEntryName = | 552 const char* const ProfileGenerator::kIdleEntryName = |
560 "(idle)"; | 553 "(idle)"; |
561 const char* const ProfileGenerator::kGarbageCollectorEntryName = | 554 const char* const ProfileGenerator::kGarbageCollectorEntryName = |
562 "(garbage collector)"; | 555 "(garbage collector)"; |
563 const char* const ProfileGenerator::kUnresolvedFunctionName = | 556 const char* const ProfileGenerator::kUnresolvedFunctionName = |
564 "(unresolved function)"; | 557 "(unresolved function)"; |
565 | 558 |
566 | 559 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 case OTHER: | 660 case OTHER: |
668 case EXTERNAL: | 661 case EXTERNAL: |
669 return program_entry_; | 662 return program_entry_; |
670 case IDLE: | 663 case IDLE: |
671 return idle_entry_; | 664 return idle_entry_; |
672 default: return NULL; | 665 default: return NULL; |
673 } | 666 } |
674 } | 667 } |
675 | 668 |
676 } } // namespace v8::internal | 669 } } // namespace v8::internal |
OLD | NEW |