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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 arena->allocateObject(allocationSizeFromSize(size), gcInfoIndex); | 614 arena->allocateObject(allocationSizeFromSize(size), gcInfoIndex); |
615 HeapAllocHooks::allocationHookIfEnabled(address, size, typeName); | 615 HeapAllocHooks::allocationHookIfEnabled(address, size, typeName); |
616 return address; | 616 return address; |
617 } | 617 } |
618 | 618 |
619 template <typename T> | 619 template <typename T> |
620 Address ThreadHeap::allocate(size_t size, bool eagerlySweep) { | 620 Address ThreadHeap::allocate(size_t size, bool eagerlySweep) { |
621 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); | 621 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); |
622 const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T); | 622 const char* typeName = WTF_HEAP_PROFILER_TYPE_NAME(T); |
623 return ThreadHeap::allocateOnArenaIndex( | 623 return ThreadHeap::allocateOnArenaIndex( |
624 state, size, eagerlySweep ? BlinkGC::EagerSweepArenaIndex | 624 state, size, |
625 : ThreadHeap::arenaIndexForObjectSize(size), | 625 eagerlySweep ? BlinkGC::EagerSweepArenaIndex |
| 626 : ThreadHeap::arenaIndexForObjectSize(size), |
626 GCInfoTrait<T>::index(), typeName); | 627 GCInfoTrait<T>::index(), typeName); |
627 } | 628 } |
628 | 629 |
629 template <typename T> | 630 template <typename T> |
630 Address ThreadHeap::reallocate(void* previous, size_t size) { | 631 Address ThreadHeap::reallocate(void* previous, size_t size) { |
631 // Not intended to be a full C realloc() substitute; | 632 // Not intended to be a full C realloc() substitute; |
632 // realloc(nullptr, size) is not a supported alias for malloc(size). | 633 // realloc(nullptr, size) is not a supported alias for malloc(size). |
633 | 634 |
634 // TODO(sof): promptly free the previous object. | 635 // TODO(sof): promptly free the previous object. |
635 if (!size) { | 636 if (!size) { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 T** cell = reinterpret_cast<T**>(object); | 680 T** cell = reinterpret_cast<T**>(object); |
680 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) | 681 if (*cell && !ObjectAliveTrait<T>::isHeapObjectAlive(*cell)) |
681 *cell = nullptr; | 682 *cell = nullptr; |
682 } | 683 } |
683 | 684 |
684 } // namespace blink | 685 } // namespace blink |
685 | 686 |
686 #include "platform/heap/VisitorImpl.h" | 687 #include "platform/heap/VisitorImpl.h" |
687 | 688 |
688 #endif // Heap_h | 689 #endif // Heap_h |
OLD | NEW |