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 #ifndef V8_HEAP_HEAP_INL_H_ | 5 #ifndef V8_HEAP_HEAP_INL_H_ |
6 #define V8_HEAP_HEAP_INL_H_ | 6 #define V8_HEAP_HEAP_INL_H_ |
7 | 7 |
8 #include <cmath> | 8 #include <cmath> |
9 | 9 |
10 #include "src/base/platform/platform.h" | 10 #include "src/base/platform/platform.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 void Heap::UpdateAllocationsHash(uint32_t value) { | 316 void Heap::UpdateAllocationsHash(uint32_t value) { |
317 uint16_t c1 = static_cast<uint16_t>(value); | 317 uint16_t c1 = static_cast<uint16_t>(value); |
318 uint16_t c2 = static_cast<uint16_t>(value >> 16); | 318 uint16_t c2 = static_cast<uint16_t>(value >> 16); |
319 raw_allocations_hash_ = | 319 raw_allocations_hash_ = |
320 StringHasher::AddCharacterCore(raw_allocations_hash_, c1); | 320 StringHasher::AddCharacterCore(raw_allocations_hash_, c1); |
321 raw_allocations_hash_ = | 321 raw_allocations_hash_ = |
322 StringHasher::AddCharacterCore(raw_allocations_hash_, c2); | 322 StringHasher::AddCharacterCore(raw_allocations_hash_, c2); |
323 } | 323 } |
324 | 324 |
325 | 325 |
326 void Heap::PrintAlloctionsHash() { | |
327 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); | |
328 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count_, hash); | |
329 } | |
330 | |
331 | |
332 void Heap::FinalizeExternalString(String* string) { | 326 void Heap::FinalizeExternalString(String* string) { |
333 DCHECK(string->IsExternalString()); | 327 DCHECK(string->IsExternalString()); |
334 v8::String::ExternalStringResourceBase** resource_addr = | 328 v8::String::ExternalStringResourceBase** resource_addr = |
335 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | 329 reinterpret_cast<v8::String::ExternalStringResourceBase**>( |
336 reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset - | 330 reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset - |
337 kHeapObjectTag); | 331 kHeapObjectTag); |
338 | 332 |
339 // Dispose of the C++ object if it has not already been disposed. | 333 // Dispose of the C++ object if it has not already been disposed. |
340 if (*resource_addr != NULL) { | 334 if (*resource_addr != NULL) { |
341 (*resource_addr)->Dispose(); | 335 (*resource_addr)->Dispose(); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
785 | 779 |
786 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 780 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
787 for (Object** current = start; current < end; current++) { | 781 for (Object** current = start; current < end; current++) { |
788 CHECK((*current)->IsSmi()); | 782 CHECK((*current)->IsSmi()); |
789 } | 783 } |
790 } | 784 } |
791 } | 785 } |
792 } // namespace v8::internal | 786 } // namespace v8::internal |
793 | 787 |
794 #endif // V8_HEAP_HEAP_INL_H_ | 788 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |