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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 if (size_in_bytes <= code_space()->AreaSize()) { | 191 if (size_in_bytes <= code_space()->AreaSize()) { |
192 allocation = code_space_->AllocateRaw(size_in_bytes); | 192 allocation = code_space_->AllocateRaw(size_in_bytes); |
193 } else { | 193 } else { |
194 // Large code objects are allocated in large object space. | 194 // Large code objects are allocated in large object space. |
195 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); | 195 allocation = lo_space_->AllocateRaw(size_in_bytes, EXECUTABLE); |
196 } | 196 } |
197 } else if (LO_SPACE == space) { | 197 } else if (LO_SPACE == space) { |
198 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); | 198 allocation = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); |
199 } else if (CELL_SPACE == space) { | 199 } else if (CELL_SPACE == space) { |
200 allocation = cell_space_->AllocateRaw(size_in_bytes); | 200 allocation = cell_space_->AllocateRaw(size_in_bytes); |
201 } else if (PROPERTY_CELL_SPACE == space) { | |
202 allocation = property_cell_space_->AllocateRaw(size_in_bytes); | |
203 } else { | 201 } else { |
204 DCHECK(MAP_SPACE == space); | 202 DCHECK(MAP_SPACE == space); |
205 allocation = map_space_->AllocateRaw(size_in_bytes); | 203 allocation = map_space_->AllocateRaw(size_in_bytes); |
206 } | 204 } |
207 if (allocation.To(&object)) { | 205 if (allocation.To(&object)) { |
208 OnAllocationEvent(object, size_in_bytes); | 206 OnAllocationEvent(object, size_in_bytes); |
209 } else { | 207 } else { |
210 old_gen_exhausted_ = true; | 208 old_gen_exhausted_ = true; |
211 } | 209 } |
212 return allocation; | 210 return allocation; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 // Heap numbers and sequential strings are promoted to old data space, all | 386 // Heap numbers and sequential strings are promoted to old data space, all |
389 // other object types are promoted to old pointer space. We do not use | 387 // other object types are promoted to old pointer space. We do not use |
390 // object->IsHeapNumber() and object->IsSeqString() because we already | 388 // object->IsHeapNumber() and object->IsSeqString() because we already |
391 // know that object has the heap object tag. | 389 // know that object has the heap object tag. |
392 | 390 |
393 // These objects are never allocated in new space. | 391 // These objects are never allocated in new space. |
394 DCHECK(type != MAP_TYPE); | 392 DCHECK(type != MAP_TYPE); |
395 DCHECK(type != CODE_TYPE); | 393 DCHECK(type != CODE_TYPE); |
396 DCHECK(type != ODDBALL_TYPE); | 394 DCHECK(type != ODDBALL_TYPE); |
397 DCHECK(type != CELL_TYPE); | 395 DCHECK(type != CELL_TYPE); |
398 DCHECK(type != PROPERTY_CELL_TYPE); | |
399 | 396 |
400 if (type <= LAST_NAME_TYPE) { | 397 if (type <= LAST_NAME_TYPE) { |
401 if (type == SYMBOL_TYPE) return OLD_POINTER_SPACE; | 398 if (type == SYMBOL_TYPE) return OLD_POINTER_SPACE; |
402 DCHECK(type < FIRST_NONSTRING_TYPE); | 399 DCHECK(type < FIRST_NONSTRING_TYPE); |
403 // There are four string representations: sequential strings, external | 400 // There are four string representations: sequential strings, external |
404 // strings, cons strings, and sliced strings. | 401 // strings, cons strings, and sliced strings. |
405 // Only the latter two contain non-map-word pointers to heap objects. | 402 // Only the latter two contain non-map-word pointers to heap objects. |
406 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag) | 403 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag) |
407 ? OLD_POINTER_SPACE | 404 ? OLD_POINTER_SPACE |
408 : OLD_DATA_SPACE; | 405 : OLD_DATA_SPACE; |
(...skipping 27 matching lines...) Expand all Loading... |
436 return dst == src || dst == TargetSpaceId(type); | 433 return dst == src || dst == TargetSpaceId(type); |
437 case OLD_POINTER_SPACE: | 434 case OLD_POINTER_SPACE: |
438 return dst == src && (dst == TargetSpaceId(type) || obj->IsFiller() || | 435 return dst == src && (dst == TargetSpaceId(type) || obj->IsFiller() || |
439 obj->IsExternalString()); | 436 obj->IsExternalString()); |
440 case OLD_DATA_SPACE: | 437 case OLD_DATA_SPACE: |
441 return dst == src && dst == TargetSpaceId(type); | 438 return dst == src && dst == TargetSpaceId(type); |
442 case CODE_SPACE: | 439 case CODE_SPACE: |
443 return dst == src && type == CODE_TYPE; | 440 return dst == src && type == CODE_TYPE; |
444 case MAP_SPACE: | 441 case MAP_SPACE: |
445 case CELL_SPACE: | 442 case CELL_SPACE: |
446 case PROPERTY_CELL_SPACE: | |
447 case LO_SPACE: | 443 case LO_SPACE: |
448 return false; | 444 return false; |
449 } | 445 } |
450 UNREACHABLE(); | 446 UNREACHABLE(); |
451 return false; | 447 return false; |
452 } | 448 } |
453 | 449 |
454 | 450 |
455 void Heap::CopyBlock(Address dst, Address src, int byte_size) { | 451 void Heap::CopyBlock(Address dst, Address src, int byte_size) { |
456 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), | 452 CopyWords(reinterpret_cast<Object**>(dst), reinterpret_cast<Object**>(src), |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
743 | 739 |
744 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { | 740 void VerifySmisVisitor::VisitPointers(Object** start, Object** end) { |
745 for (Object** current = start; current < end; current++) { | 741 for (Object** current = start; current < end; current++) { |
746 CHECK((*current)->IsSmi()); | 742 CHECK((*current)->IsSmi()); |
747 } | 743 } |
748 } | 744 } |
749 } | 745 } |
750 } // namespace v8::internal | 746 } // namespace v8::internal |
751 | 747 |
752 #endif // V8_HEAP_HEAP_INL_H_ | 748 #endif // V8_HEAP_HEAP_INL_H_ |
OLD | NEW |