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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 allocation = old_space_->AllocateRaw(size_in_bytes); | 187 allocation = old_space_->AllocateRaw(size_in_bytes); |
188 } else if (CODE_SPACE == space) { | 188 } else if (CODE_SPACE == space) { |
189 if (size_in_bytes <= code_space()->AreaSize()) { | 189 if (size_in_bytes <= code_space()->AreaSize()) { |
190 allocation = code_space_->AllocateRaw(size_in_bytes); | 190 allocation = code_space_->AllocateRaw(size_in_bytes); |
191 } else { | 191 } else { |
192 // Large code objects are allocated in large object space. | 192 // Large code objects are allocated in large object space. |
193 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); | 193 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); |
194 } | 194 } |
195 } else if (LO_SPACE == space) { | 195 } else if (LO_SPACE == space) { |
196 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); | 196 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); |
197 } else if (CELL_SPACE == space) { | |
198 allocation = cell_space_->AllocateRaw(size_in_bytes); | |
199 } else { | 197 } else { |
200 DCHECK(MAP_SPACE == space); | 198 DCHECK(MAP_SPACE == space); |
201 allocation = map_space_->AllocateRaw(size_in_bytes); | 199 allocation = map_space_->AllocateRaw(size_in_bytes); |
202 } | 200 } |
203 if (allocation.To(&object)) { | 201 if (allocation.To(&object)) { |
204 OnAllocationEvent(object, size_in_bytes); | 202 OnAllocationEvent(object, size_in_bytes); |
205 } else { | 203 } else { |
206 old_gen_exhausted_ = true; | 204 old_gen_exhausted_ = true; |
207 } | 205 } |
208 return allocation; | 206 return allocation; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 AllocationSpace src = chunk->owner()->identity(); | 378 AllocationSpace src = chunk->owner()->identity(); |
381 switch (src) { | 379 switch (src) { |
382 case NEW_SPACE: | 380 case NEW_SPACE: |
383 return dst == src || dst == OLD_SPACE; | 381 return dst == src || dst == OLD_SPACE; |
384 case OLD_SPACE: | 382 case OLD_SPACE: |
385 return dst == src && | 383 return dst == src && |
386 (dst == OLD_SPACE || obj->IsFiller() || obj->IsExternalString()); | 384 (dst == OLD_SPACE || obj->IsFiller() || obj->IsExternalString()); |
387 case CODE_SPACE: | 385 case CODE_SPACE: |
388 return dst == src && type == CODE_TYPE; | 386 return dst == src && type == CODE_TYPE; |
389 case MAP_SPACE: | 387 case MAP_SPACE: |
390 case CELL_SPACE: | |
391 case LO_SPACE: | 388 case LO_SPACE: |
392 return false; | 389 return false; |
393 } | 390 } |
394 UNREACHABLE(); | 391 UNREACHABLE(); |
395 return false; | 392 return false; |
396 } | 393 } |
397 | 394 |
398 | 395 |
399 void Heap::CopyBlock(Address dst, Address src, int byte_size) { | 396 void Heap::CopyBlock(Address dst, Address src, int byte_size) { |
400 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), | 397 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 | 678 |
682 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 679 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
683 for (Object** current = start; current < end; current++) { | 680 for (Object** current = start; current < end; current++) { |
684 CHECK((*current)->IsSmi()); | 681 CHECK((*current)->IsSmi()); |
685 } | 682 } |
686 } | 683 } |
687 } | 684 } |
688 } // namespace v8::internal | 685 } // namespace v8::internal |
689 | 686 |
690 #endif // V8_HEAP_HEAP_INL_H_ | 687 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |