| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 MaybeObject* Heap::CopyFixedArray(FixedArray* src) { | 199 MaybeObject* Heap::CopyFixedArray(FixedArray* src) { |
| 200 return CopyFixedArrayWithMap(src, src->map()); | 200 return CopyFixedArrayWithMap(src, src->map()); |
| 201 } | 201 } |
| 202 | 202 |
| 203 | 203 |
| 204 MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) { | 204 MaybeObject* Heap::CopyFixedDoubleArray(FixedDoubleArray* src) { |
| 205 return CopyFixedDoubleArrayWithMap(src, src->map()); | 205 return CopyFixedDoubleArrayWithMap(src, src->map()); |
| 206 } | 206 } |
| 207 | 207 |
| 208 | 208 |
| 209 MaybeObject* Heap::CopyConstantPoolArray(ConstantPoolArray* src) { |
| 210 return CopyConstantPoolArrayWithMap(src, src->map()); |
| 211 } |
| 212 |
| 213 |
| 209 MaybeObject* Heap::AllocateRaw(int size_in_bytes, | 214 MaybeObject* Heap::AllocateRaw(int size_in_bytes, |
| 210 AllocationSpace space, | 215 AllocationSpace space, |
| 211 AllocationSpace retry_space) { | 216 AllocationSpace retry_space) { |
| 212 ASSERT(AllowHandleAllocation::IsAllowed()); | 217 ASSERT(AllowHandleAllocation::IsAllowed()); |
| 213 ASSERT(AllowHeapAllocation::IsAllowed()); | 218 ASSERT(AllowHeapAllocation::IsAllowed()); |
| 214 ASSERT(gc_state_ == NOT_IN_GC); | 219 ASSERT(gc_state_ == NOT_IN_GC); |
| 215 ASSERT(space != NEW_SPACE || | 220 ASSERT(space != NEW_SPACE || |
| 216 retry_space == OLD_POINTER_SPACE || | 221 retry_space == OLD_POINTER_SPACE || |
| 217 retry_space == OLD_DATA_SPACE || | 222 retry_space == OLD_DATA_SPACE || |
| 218 retry_space == LO_SPACE); | 223 retry_space == LO_SPACE); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 kHeapObjectTag); | 289 kHeapObjectTag); |
| 285 | 290 |
| 286 // Dispose of the C++ object if it has not already been disposed. | 291 // Dispose of the C++ object if it has not already been disposed. |
| 287 if (*resource_addr != NULL) { | 292 if (*resource_addr != NULL) { |
| 288 (*resource_addr)->Dispose(); | 293 (*resource_addr)->Dispose(); |
| 289 *resource_addr = NULL; | 294 *resource_addr = NULL; |
| 290 } | 295 } |
| 291 } | 296 } |
| 292 | 297 |
| 293 | 298 |
| 294 MaybeObject* Heap::AllocateRawMap() { | |
| 295 #ifdef DEBUG | |
| 296 isolate_->counters()->objs_since_last_full()->Increment(); | |
| 297 isolate_->counters()->objs_since_last_young()->Increment(); | |
| 298 #endif | |
| 299 MaybeObject* result = map_space_->AllocateRaw(Map::kSize); | |
| 300 if (result->IsFailure()) old_gen_exhausted_ = true; | |
| 301 return result; | |
| 302 } | |
| 303 | |
| 304 | |
| 305 MaybeObject* Heap::AllocateRawCell() { | |
| 306 #ifdef DEBUG | |
| 307 isolate_->counters()->objs_since_last_full()->Increment(); | |
| 308 isolate_->counters()->objs_since_last_young()->Increment(); | |
| 309 #endif | |
| 310 MaybeObject* result = cell_space_->AllocateRaw(Cell::kSize); | |
| 311 if (result->IsFailure()) old_gen_exhausted_ = true; | |
| 312 return result; | |
| 313 } | |
| 314 | |
| 315 | |
| 316 MaybeObject* Heap::AllocateRawPropertyCell() { | |
| 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(PropertyCell::kSize); | |
| 323 if (result->IsFailure()) old_gen_exhausted_ = true; | |
| 324 return result; | |
| 325 } | |
| 326 | |
| 327 | |
| 328 bool Heap::InNewSpace(Object* object) { | 299 bool Heap::InNewSpace(Object* object) { |
| 329 bool result = new_space_.Contains(object); | 300 bool result = new_space_.Contains(object); |
| 330 ASSERT(!result || // Either not in new space | 301 ASSERT(!result || // Either not in new space |
| 331 gc_state_ != NOT_IN_GC || // ... or in the middle of GC | 302 gc_state_ != NOT_IN_GC || // ... or in the middle of GC |
| 332 InToSpace(object)); // ... or in to-space (where we allocate). | 303 InToSpace(object)); // ... or in to-space (where we allocate). |
| 333 return result; | 304 return result; |
| 334 } | 305 } |
| 335 | 306 |
| 336 | 307 |
| 337 bool Heap::InNewSpace(Address address) { | 308 bool Heap::InNewSpace(Address address) { |
| (...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 #ifdef DEBUG | 859 #ifdef DEBUG |
| 889 Isolate* isolate = Isolate::Current(); | 860 Isolate* isolate = Isolate::Current(); |
| 890 isolate->heap()->disallow_allocation_failure_ = old_state_; | 861 isolate->heap()->disallow_allocation_failure_ = old_state_; |
| 891 #endif | 862 #endif |
| 892 } | 863 } |
| 893 | 864 |
| 894 | 865 |
| 895 } } // namespace v8::internal | 866 } } // namespace v8::internal |
| 896 | 867 |
| 897 #endif // V8_HEAP_INL_H_ | 868 #endif // V8_HEAP_INL_H_ |
| OLD | NEW |