| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 StringHasher::AddCharacterCore(raw_allocations_hash_, c2); | 280 StringHasher::AddCharacterCore(raw_allocations_hash_, c2); |
| 281 } | 281 } |
| 282 | 282 |
| 283 | 283 |
| 284 void Heap::PrintAlloctionsHash() { | 284 void Heap::PrintAlloctionsHash() { |
| 285 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); | 285 uint32_t hash = StringHasher::GetHashCore(raw_allocations_hash_); |
| 286 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count_, hash); | 286 PrintF("\n### Allocations = %u, hash = 0x%08x\n", allocations_count_, hash); |
| 287 } | 287 } |
| 288 | 288 |
| 289 | 289 |
| 290 void Heap::FinalizeExternalString(String* string) { | |
| 291 DCHECK(string->IsExternalString()); | |
| 292 v8::String::ExternalStringResourceBase** resource_addr = | |
| 293 reinterpret_cast<v8::String::ExternalStringResourceBase**>( | |
| 294 reinterpret_cast<byte*>(string) + ExternalString::kResourceOffset - | |
| 295 kHeapObjectTag); | |
| 296 | |
| 297 // Dispose of the C++ object if it has not already been disposed. | |
| 298 if (*resource_addr != NULL) { | |
| 299 (*resource_addr)->Dispose(); | |
| 300 *resource_addr = NULL; | |
| 301 } | |
| 302 } | |
| 303 | |
| 304 | |
| 305 bool Heap::InNewSpace(Object* object) { | 290 bool Heap::InNewSpace(Object* object) { |
| 306 bool result = new_space_.Contains(object); | 291 bool result = new_space_.Contains(object); |
| 307 DCHECK(!result || // Either not in new space | 292 DCHECK(!result || // Either not in new space |
| 308 gc_state_ != NOT_IN_GC || // ... or in the middle of GC | 293 gc_state_ != NOT_IN_GC || // ... or in the middle of GC |
| 309 InToSpace(object)); // ... or in to-space (where we allocate). | 294 InToSpace(object)); // ... or in to-space (where we allocate). |
| 310 return result; | 295 return result; |
| 311 } | 296 } |
| 312 | 297 |
| 313 | 298 |
| 314 bool Heap::InNewSpace(Address address) { return new_space_.Contains(address); } | 299 bool Heap::InNewSpace(Address address) { return new_space_.Contains(address); } |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 | 667 |
| 683 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 668 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
| 684 for (Object** current = start; current < end; current++) { | 669 for (Object** current = start; current < end; current++) { |
| 685 CHECK((*current)->IsSmi()); | 670 CHECK((*current)->IsSmi()); |
| 686 } | 671 } |
| 687 } | 672 } |
| 688 } | 673 } |
| 689 } // namespace v8::internal | 674 } // namespace v8::internal |
| 690 | 675 |
| 691 #endif // V8_HEAP_HEAP_INL_H_ | 676 #endif // V8_HEAP_HEAP_INL_H_ |
| OLD | NEW |