| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
| 6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 2710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2721 static intptr_t ObjectSizeFor(intptr_t chunk_size) { | 2721 static intptr_t ObjectSizeFor(intptr_t chunk_size) { |
| 2722 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0; | 2722 if (chunk_size <= (Page::kPageSize + Page::kObjectStartOffset)) return 0; |
| 2723 return chunk_size - Page::kPageSize - Page::kObjectStartOffset; | 2723 return chunk_size - Page::kPageSize - Page::kObjectStartOffset; |
| 2724 } | 2724 } |
| 2725 | 2725 |
| 2726 // Shared implementation of AllocateRaw, AllocateRawCode and | 2726 // Shared implementation of AllocateRaw, AllocateRawCode and |
| 2727 // AllocateRawFixedArray. | 2727 // AllocateRawFixedArray. |
| 2728 MUST_USE_RESULT AllocationResult | 2728 MUST_USE_RESULT AllocationResult |
| 2729 AllocateRaw(int object_size, Executability executable); | 2729 AllocateRaw(int object_size, Executability executable); |
| 2730 | 2730 |
| 2731 bool CanAllocateSize(int size) { return Size() + size <= max_capacity_; } |
| 2732 |
| 2731 // Available bytes for objects in this space. | 2733 // Available bytes for objects in this space. |
| 2732 inline intptr_t Available(); | 2734 inline intptr_t Available(); |
| 2733 | 2735 |
| 2734 virtual intptr_t Size() { return size_; } | 2736 virtual intptr_t Size() { return size_; } |
| 2735 | 2737 |
| 2736 virtual intptr_t SizeOfObjects() { return objects_size_; } | 2738 virtual intptr_t SizeOfObjects() { return objects_size_; } |
| 2737 | 2739 |
| 2738 intptr_t MaximumCommittedMemory() { return maximum_committed_; } | 2740 intptr_t MaximumCommittedMemory() { return maximum_committed_; } |
| 2739 | 2741 |
| 2740 intptr_t CommittedMemory() { return Size(); } | 2742 intptr_t CommittedMemory() { return Size(); } |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2877 count = 0; | 2879 count = 0; |
| 2878 } | 2880 } |
| 2879 // Must be small, since an iteration is used for lookup. | 2881 // Must be small, since an iteration is used for lookup. |
| 2880 static const int kMaxComments = 64; | 2882 static const int kMaxComments = 64; |
| 2881 }; | 2883 }; |
| 2882 #endif | 2884 #endif |
| 2883 } | 2885 } |
| 2884 } // namespace v8::internal | 2886 } // namespace v8::internal |
| 2885 | 2887 |
| 2886 #endif // V8_HEAP_SPACES_H_ | 2888 #endif // V8_HEAP_SPACES_H_ |
| OLD | NEW |