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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } | 142 } |
143 | 143 |
144 | 144 |
145 uint32_t CodeEntry::GetCallUid() const { | 145 uint32_t CodeEntry::GetCallUid() const { |
146 uint32_t hash = ComputeIntegerHash(tag_, v8::internal::kZeroHashSeed); | 146 uint32_t hash = ComputeIntegerHash(tag(), v8::internal::kZeroHashSeed); |
147 if (shared_id_ != 0) { | 147 if (shared_id_ != 0) { |
148 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), | 148 hash ^= ComputeIntegerHash(static_cast<uint32_t>(shared_id_), |
149 v8::internal::kZeroHashSeed); | 149 v8::internal::kZeroHashSeed); |
150 } else { | 150 } else { |
151 hash ^= ComputeIntegerHash( | 151 hash ^= ComputeIntegerHash( |
152 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_prefix_)), | 152 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_prefix_)), |
153 v8::internal::kZeroHashSeed); | 153 v8::internal::kZeroHashSeed); |
154 hash ^= ComputeIntegerHash( | 154 hash ^= ComputeIntegerHash( |
155 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_)), | 155 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(name_)), |
156 v8::internal::kZeroHashSeed); | 156 v8::internal::kZeroHashSeed); |
157 hash ^= ComputeIntegerHash( | 157 hash ^= ComputeIntegerHash( |
158 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(resource_name_)), | 158 static_cast<uint32_t>(reinterpret_cast<uintptr_t>(resource_name_)), |
159 v8::internal::kZeroHashSeed); | 159 v8::internal::kZeroHashSeed); |
160 hash ^= ComputeIntegerHash(line_number_, v8::internal::kZeroHashSeed); | 160 hash ^= ComputeIntegerHash(line_number_, v8::internal::kZeroHashSeed); |
161 } | 161 } |
162 return hash; | 162 return hash; |
163 } | 163 } |
164 | 164 |
165 | 165 |
166 bool CodeEntry::IsSameAs(CodeEntry* entry) const { | 166 bool CodeEntry::IsSameAs(CodeEntry* entry) const { |
167 return this == entry | 167 return this == entry || |
168 || (tag_ == entry->tag_ | 168 (tag() == entry->tag() && shared_id_ == entry->shared_id_ && |
169 && shared_id_ == entry->shared_id_ | 169 (shared_id_ != 0 || |
170 && (shared_id_ != 0 | 170 (name_prefix_ == entry->name_prefix_ && name_ == entry->name_ && |
171 || (name_prefix_ == entry->name_prefix_ | 171 resource_name_ == entry->resource_name_ && |
172 && name_ == entry->name_ | 172 line_number_ == entry->line_number_))); |
173 && resource_name_ == entry->resource_name_ | |
174 && line_number_ == entry->line_number_))); | |
175 } | 173 } |
176 | 174 |
177 | 175 |
178 void CodeEntry::SetBuiltinId(Builtins::Name id) { | 176 void CodeEntry::SetBuiltinId(Builtins::Name id) { |
179 tag_ = Logger::BUILTIN_TAG; | 177 bit_field_ = TagField::update(bit_field_, Logger::BUILTIN_TAG); |
180 builtin_id_ = id; | 178 bit_field_ = BuiltinIdField::update(bit_field_, id); |
181 } | 179 } |
182 | 180 |
183 | 181 |
184 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { | 182 ProfileNode* ProfileNode::FindChild(CodeEntry* entry) { |
185 HashMap::Entry* map_entry = | 183 HashMap::Entry* map_entry = |
186 children_.Lookup(entry, CodeEntryHash(entry), false); | 184 children_.Lookup(entry, CodeEntryHash(entry), false); |
187 return map_entry != NULL ? | 185 return map_entry != NULL ? |
188 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; | 186 reinterpret_cast<ProfileNode*>(map_entry->value) : NULL; |
189 } | 187 } |
190 | 188 |
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 case OTHER: | 658 case OTHER: |
661 case EXTERNAL: | 659 case EXTERNAL: |
662 return program_entry_; | 660 return program_entry_; |
663 case IDLE: | 661 case IDLE: |
664 return idle_entry_; | 662 return idle_entry_; |
665 default: return NULL; | 663 default: return NULL; |
666 } | 664 } |
667 } | 665 } |
668 | 666 |
669 } } // namespace v8::internal | 667 } } // namespace v8::internal |
OLD | NEW |