OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 if (OLD_POINTER_SPACE == space) { | 238 if (OLD_POINTER_SPACE == space) { |
239 result = old_pointer_space_->AllocateRaw(size_in_bytes); | 239 result = old_pointer_space_->AllocateRaw(size_in_bytes); |
240 } else if (OLD_DATA_SPACE == space) { | 240 } else if (OLD_DATA_SPACE == space) { |
241 result = old_data_space_->AllocateRaw(size_in_bytes); | 241 result = old_data_space_->AllocateRaw(size_in_bytes); |
242 } else if (CODE_SPACE == space) { | 242 } else if (CODE_SPACE == space) { |
243 result = code_space_->AllocateRaw(size_in_bytes); | 243 result = code_space_->AllocateRaw(size_in_bytes); |
244 } else if (LO_SPACE == space) { | 244 } else if (LO_SPACE == space) { |
245 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); | 245 result = lo_space_->AllocateRaw(size_in_bytes, NOT_EXECUTABLE); |
246 } else if (CELL_SPACE == space) { | 246 } else if (CELL_SPACE == space) { |
247 result = cell_space_->AllocateRaw(size_in_bytes); | 247 result = cell_space_->AllocateRaw(size_in_bytes); |
| 248 } else if (PROPERTY_CELL_SPACE == space) { |
| 249 result = property_cell_space_->AllocateRaw(size_in_bytes); |
248 } else { | 250 } else { |
249 ASSERT(MAP_SPACE == space); | 251 ASSERT(MAP_SPACE == space); |
250 result = map_space_->AllocateRaw(size_in_bytes); | 252 result = map_space_->AllocateRaw(size_in_bytes); |
251 } | 253 } |
252 if (result->IsFailure()) old_gen_exhausted_ = true; | 254 if (result->IsFailure()) old_gen_exhausted_ = true; |
253 return result; | 255 return result; |
254 } | 256 } |
255 | 257 |
256 | 258 |
257 MaybeObject* Heap::NumberFromInt32( | 259 MaybeObject* Heap::NumberFromInt32( |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 if (result->IsFailure()) old_gen_exhausted_ = true; | 300 if (result->IsFailure()) old_gen_exhausted_ = true; |
299 return result; | 301 return result; |
300 } | 302 } |
301 | 303 |
302 | 304 |
303 MaybeObject* Heap::AllocateRawCell() { | 305 MaybeObject* Heap::AllocateRawCell() { |
304 #ifdef DEBUG | 306 #ifdef DEBUG |
305 isolate_->counters()->objs_since_last_full()->Increment(); | 307 isolate_->counters()->objs_since_last_full()->Increment(); |
306 isolate_->counters()->objs_since_last_young()->Increment(); | 308 isolate_->counters()->objs_since_last_young()->Increment(); |
307 #endif | 309 #endif |
308 MaybeObject* result = cell_space_->AllocateRaw(JSGlobalPropertyCell::kSize); | 310 MaybeObject* result = cell_space_->AllocateRaw(Cell::kSize); |
309 if (result->IsFailure()) old_gen_exhausted_ = true; | 311 if (result->IsFailure()) old_gen_exhausted_ = true; |
310 return result; | 312 return result; |
311 } | 313 } |
| 314 |
| 315 |
| 316 MaybeObject* Heap::AllocateRawJSGlobalPropertyCell() { |
| 317 #ifdef DEBUG |
| 318 isolate_->counters()->objs_since_last_full()->Increment(); |
| 319 isolate_->counters()->objs_since_last_young()->Increment(); |
| 320 #endif |
| 321 MaybeObject* result = |
| 322 property_cell_space_->AllocateRaw(JSGlobalPropertyCell::kSize); |
| 323 if (result->IsFailure()) old_gen_exhausted_ = true; |
| 324 return result; |
| 325 } |
312 | 326 |
313 | 327 |
314 bool Heap::InNewSpace(Object* object) { | 328 bool Heap::InNewSpace(Object* object) { |
315 bool result = new_space_.Contains(object); | 329 bool result = new_space_.Contains(object); |
316 ASSERT(!result || // Either not in new space | 330 ASSERT(!result || // Either not in new space |
317 gc_state_ != NOT_IN_GC || // ... or in the middle of GC | 331 gc_state_ != NOT_IN_GC || // ... or in the middle of GC |
318 InToSpace(object)); // ... or in to-space (where we allocate). | 332 InToSpace(object)); // ... or in to-space (where we allocate). |
319 return result; | 333 return result; |
320 } | 334 } |
321 | 335 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 AllocationSpace Heap::TargetSpaceId(InstanceType type) { | 414 AllocationSpace Heap::TargetSpaceId(InstanceType type) { |
401 // Heap numbers and sequential strings are promoted to old data space, all | 415 // Heap numbers and sequential strings are promoted to old data space, all |
402 // other object types are promoted to old pointer space. We do not use | 416 // other object types are promoted to old pointer space. We do not use |
403 // object->IsHeapNumber() and object->IsSeqString() because we already | 417 // object->IsHeapNumber() and object->IsSeqString() because we already |
404 // know that object has the heap object tag. | 418 // know that object has the heap object tag. |
405 | 419 |
406 // These objects are never allocated in new space. | 420 // These objects are never allocated in new space. |
407 ASSERT(type != MAP_TYPE); | 421 ASSERT(type != MAP_TYPE); |
408 ASSERT(type != CODE_TYPE); | 422 ASSERT(type != CODE_TYPE); |
409 ASSERT(type != ODDBALL_TYPE); | 423 ASSERT(type != ODDBALL_TYPE); |
410 ASSERT(type != JS_GLOBAL_PROPERTY_CELL_TYPE); | 424 ASSERT(type != CELL_TYPE); |
| 425 ASSERT(type != PROPERTY_CELL_TYPE); |
411 | 426 |
412 if (type <= LAST_NAME_TYPE) { | 427 if (type <= LAST_NAME_TYPE) { |
413 if (type == SYMBOL_TYPE) return OLD_POINTER_SPACE; | 428 if (type == SYMBOL_TYPE) return OLD_POINTER_SPACE; |
414 ASSERT(type < FIRST_NONSTRING_TYPE); | 429 ASSERT(type < FIRST_NONSTRING_TYPE); |
415 // There are four string representations: sequential strings, external | 430 // There are four string representations: sequential strings, external |
416 // strings, cons strings, and sliced strings. | 431 // strings, cons strings, and sliced strings. |
417 // Only the latter two contain non-map-word pointers to heap objects. | 432 // Only the latter two contain non-map-word pointers to heap objects. |
418 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag) | 433 return ((type & kIsIndirectStringMask) == kIsIndirectStringTag) |
419 ? OLD_POINTER_SPACE | 434 ? OLD_POINTER_SPACE |
420 : OLD_DATA_SPACE; | 435 : OLD_DATA_SPACE; |
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 DisallowAllocationFailure::~DisallowAllocationFailure() { | 862 DisallowAllocationFailure::~DisallowAllocationFailure() { |
848 #ifdef DEBUG | 863 #ifdef DEBUG |
849 HEAP->disallow_allocation_failure_ = old_state_; | 864 HEAP->disallow_allocation_failure_ = old_state_; |
850 #endif | 865 #endif |
851 } | 866 } |
852 | 867 |
853 | 868 |
854 } } // namespace v8::internal | 869 } } // namespace v8::internal |
855 | 870 |
856 #endif // V8_HEAP_INL_H_ | 871 #endif // V8_HEAP_INL_H_ |
OLD | NEW |