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 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 kHeapObjectTag); | 289 kHeapObjectTag); |
290 | 290 |
291 // 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. |
292 if (*resource_addr != NULL) { | 292 if (*resource_addr != NULL) { |
293 (*resource_addr)->Dispose(); | 293 (*resource_addr)->Dispose(); |
294 *resource_addr = NULL; | 294 *resource_addr = NULL; |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 | 298 |
299 MaybeObject* Heap::AllocateRawMap() { | |
300 #ifdef DEBUG | |
301 isolate_->counters()->objs_since_last_full()->Increment(); | |
302 isolate_->counters()->objs_since_last_young()->Increment(); | |
303 #endif | |
304 MaybeObject* result = map_space_->AllocateRaw(Map::kSize); | |
305 if (result->IsFailure()) old_gen_exhausted_ = true; | |
306 return result; | |
307 } | |
308 | |
309 | |
310 MaybeObject* Heap::AllocateRawCell() { | |
311 #ifdef DEBUG | |
312 isolate_->counters()->objs_since_last_full()->Increment(); | |
313 isolate_->counters()->objs_since_last_young()->Increment(); | |
314 #endif | |
315 MaybeObject* result = cell_space_->AllocateRaw(Cell::kSize); | |
316 if (result->IsFailure()) old_gen_exhausted_ = true; | |
317 return result; | |
318 } | |
319 | |
320 | |
321 MaybeObject* Heap::AllocateRawPropertyCell() { | |
322 #ifdef DEBUG | |
323 isolate_->counters()->objs_since_last_full()->Increment(); | |
324 isolate_->counters()->objs_since_last_young()->Increment(); | |
325 #endif | |
326 MaybeObject* result = | |
327 property_cell_space_->AllocateRaw(PropertyCell::kSize); | |
328 if (result->IsFailure()) old_gen_exhausted_ = true; | |
329 return result; | |
330 } | |
331 | |
332 | |
333 bool Heap::InNewSpace(Object* object) { | 299 bool Heap::InNewSpace(Object* object) { |
334 bool result = new_space_.Contains(object); | 300 bool result = new_space_.Contains(object); |
335 ASSERT(!result || // Either not in new space | 301 ASSERT(!result || // Either not in new space |
336 gc_state_ != NOT_IN_GC || // ... or in the middle of GC | 302 gc_state_ != NOT_IN_GC || // ... or in the middle of GC |
337 InToSpace(object)); // ... or in to-space (where we allocate). | 303 InToSpace(object)); // ... or in to-space (where we allocate). |
338 return result; | 304 return result; |
339 } | 305 } |
340 | 306 |
341 | 307 |
342 bool Heap::InNewSpace(Address address) { | 308 bool Heap::InNewSpace(Address address) { |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 #ifdef DEBUG | 859 #ifdef DEBUG |
894 Isolate* isolate = Isolate::Current(); | 860 Isolate* isolate = Isolate::Current(); |
895 isolate->heap()->disallow_allocation_failure_ = old_state_; | 861 isolate->heap()->disallow_allocation_failure_ = old_state_; |
896 #endif | 862 #endif |
897 } | 863 } |
898 | 864 |
899 | 865 |
900 } } // namespace v8::internal | 866 } } // namespace v8::internal |
901 | 867 |
902 #endif // V8_HEAP_INL_H_ | 868 #endif // V8_HEAP_INL_H_ |
OLD | NEW |