OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 #else | 450 #else |
451 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker | 451 #define EAGERLY_FINALIZE() typedef int IsEagerlyFinalizedMarker |
452 #endif | 452 #endif |
453 | 453 |
454 #if !ENABLE(OILPAN) && ENABLE(LAZY_SWEEPING) | 454 #if !ENABLE(OILPAN) && ENABLE(LAZY_SWEEPING) |
455 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() EAGERLY_FINALIZE() | 455 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() EAGERLY_FINALIZE() |
456 #else | 456 #else |
457 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() | 457 #define EAGERLY_FINALIZE_WILL_BE_REMOVED() |
458 #endif | 458 #endif |
459 | 459 |
| 460 /* |
460 inline Address Heap::allocateOnHeapIndex(ThreadState* state, size_t size, int he
apIndex, size_t gcInfoIndex) | 461 inline Address Heap::allocateOnHeapIndex(ThreadState* state, size_t size, int he
apIndex, size_t gcInfoIndex) |
461 { | 462 { |
462 ASSERT(state->isAllocationAllowed()); | 463 ASSERT(state->isAllocationAllowed()); |
463 ASSERT(heapIndex != ThreadState::LargeObjectHeapIndex); | 464 ASSERT(heapIndex != ThreadState::LargeObjectHeapIndex); |
464 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->heap(heapIndex)); | 465 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->heap(heapIndex)); |
465 return heap->allocateObject(allocationSizeFromSize(size), gcInfoIndex); | 466 return heap->allocateObject(allocationSizeFromSize(size), gcInfoIndex); |
466 } | 467 } |
| 468 */ |
467 | 469 |
468 template<typename T> | 470 template<typename T> |
469 Address Heap::allocate(size_t size, bool eagerlySweep) | 471 Address Heap::allocate(size_t size, bool eagerlySweep) |
470 { | 472 { |
471 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); | 473 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); |
472 return Heap::allocateOnHeapIndex(state, size, eagerlySweep ? ThreadState::Ea
gerSweepHeapIndex : Heap::heapIndexForObjectSize(size), GCInfoTrait<T>::index())
; | 474 return Heap::allocateOnHeapIndex(state, size, eagerlySweep ? ThreadState::Ea
gerSweepHeapIndex : Heap::heapIndexForObjectSize(size), GCInfoTrait<T>::index())
; |
473 } | 475 } |
474 | 476 |
475 template<typename T> | 477 template<typename T> |
476 Address Heap::reallocate(void* previous, size_t size) | 478 Address Heap::reallocate(void* previous, size_t size) |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) | 512 void VisitorHelper<Derived>::handleWeakCell(Visitor* self, void* object) |
511 { | 513 { |
512 T** cell = reinterpret_cast<T**>(object); | 514 T** cell = reinterpret_cast<T**>(object); |
513 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 515 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
514 *cell = nullptr; | 516 *cell = nullptr; |
515 } | 517 } |
516 | 518 |
517 } // namespace blink | 519 } // namespace blink |
518 | 520 |
519 #endif // Heap_h | 521 #endif // Heap_h |
OLD | NEW |