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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 NO_SANITIZE_ADDRESS | 298 NO_SANITIZE_ADDRESS |
299 bool isPromptlyFreed() { return (m_size & promptlyFreedMask) == promptlyFree
dMask; } | 299 bool isPromptlyFreed() { return (m_size & promptlyFreedMask) == promptlyFree
dMask; } |
300 | 300 |
301 NO_SANITIZE_ADDRESS | 301 NO_SANITIZE_ADDRESS |
302 void markPromptlyFreed() { m_size |= promptlyFreedMask; } | 302 void markPromptlyFreed() { m_size |= promptlyFreedMask; } |
303 | 303 |
304 NO_SANITIZE_ADDRESS | 304 NO_SANITIZE_ADDRESS |
305 size_t size() const { return m_size & sizeMask; } | 305 size_t size() const { return m_size & sizeMask; } |
306 | 306 |
| 307 NO_SANITIZE_ADDRESS |
| 308 void setSize(size_t size) { m_size = (size | (m_size & ~sizeMask)); } |
| 309 |
307 #if ENABLE(GC_PROFILE_HEAP) | 310 #if ENABLE(GC_PROFILE_HEAP) |
308 NO_SANITIZE_ADDRESS | 311 NO_SANITIZE_ADDRESS |
309 size_t encodedSize() const { return m_size; } | 312 size_t encodedSize() const { return m_size; } |
310 | 313 |
311 NO_SANITIZE_ADDRESS | 314 NO_SANITIZE_ADDRESS |
312 size_t age() const { return m_size >> maxHeapObjectSizeLog2; } | 315 size_t age() const { return m_size >> maxHeapObjectSizeLog2; } |
313 | 316 |
314 NO_SANITIZE_ADDRESS | 317 NO_SANITIZE_ADDRESS |
315 void incAge() | 318 void incAge() |
316 { | 319 { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
806 virtual void prepareHeapForTermination() override; | 809 virtual void prepareHeapForTermination() override; |
807 | 810 |
808 virtual int normalPageCount() override { return m_numberOfNormalPages; } | 811 virtual int normalPageCount() override { return m_numberOfNormalPages; } |
809 | 812 |
810 virtual PassOwnPtr<BaseHeap> split(int numberOfNormalPages) override; | 813 virtual PassOwnPtr<BaseHeap> split(int numberOfNormalPages) override; |
811 virtual void merge(PassOwnPtr<BaseHeap> splitOffBase) override; | 814 virtual void merge(PassOwnPtr<BaseHeap> splitOffBase) override; |
812 | 815 |
813 void removePageFromHeap(HeapPage<Header>*); | 816 void removePageFromHeap(HeapPage<Header>*); |
814 | 817 |
815 PLATFORM_EXPORT void promptlyFreeObject(Header*); | 818 PLATFORM_EXPORT void promptlyFreeObject(Header*); |
| 819 PLATFORM_EXPORT bool expandObject(Header*, size_t); |
816 | 820 |
817 private: | 821 private: |
818 void addPageToHeap(const GCInfo*); | 822 void addPageToHeap(const GCInfo*); |
819 PLATFORM_EXPORT Address outOfLineAllocate(size_t, const GCInfo*); | 823 PLATFORM_EXPORT Address outOfLineAllocate(size_t, const GCInfo*); |
820 static size_t allocationSizeFromSize(size_t); | 824 static size_t allocationSizeFromSize(size_t); |
821 PLATFORM_EXPORT Address allocateLargeObject(size_t, const GCInfo*); | 825 PLATFORM_EXPORT Address allocateLargeObject(size_t, const GCInfo*); |
822 Address currentAllocationPoint() const { return m_currentAllocationPoint; } | 826 Address currentAllocationPoint() const { return m_currentAllocationPoint; } |
823 size_t remainingAllocationSize() const { return m_remainingAllocationSize; } | 827 size_t remainingAllocationSize() const { return m_remainingAllocationSize; } |
824 bool ownsNonEmptyAllocationArea() const { return currentAllocationPoint() &&
remainingAllocationSize(); } | 828 bool ownsNonEmptyAllocationArea() const { return currentAllocationPoint() &&
remainingAllocationSize(); } |
825 void setAllocationPoint(Address point, size_t size) | 829 void setAllocationPoint(Address point, size_t size) |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 static Return zeroedBackingMalloc(size_t size) | 1488 static Return zeroedBackingMalloc(size_t size) |
1485 { | 1489 { |
1486 return backingMalloc<Return, Metadata>(size); | 1490 return backingMalloc<Return, Metadata>(size); |
1487 } | 1491 } |
1488 template <typename Return, typename Metadata> | 1492 template <typename Return, typename Metadata> |
1489 static Return malloc(size_t size) | 1493 static Return malloc(size_t size) |
1490 { | 1494 { |
1491 return reinterpret_cast<Return>(Heap::allocate<Metadata>(size)); | 1495 return reinterpret_cast<Return>(Heap::allocate<Metadata>(size)); |
1492 } | 1496 } |
1493 PLATFORM_EXPORT static void backingFree(void* address); | 1497 PLATFORM_EXPORT static void backingFree(void* address); |
| 1498 PLATFORM_EXPORT static bool backingExpand(void*, size_t); |
1494 | 1499 |
1495 static void free(void* address) { } | 1500 static void free(void* address) { } |
1496 template<typename T> | 1501 template<typename T> |
1497 static void* newArray(size_t bytes) | 1502 static void* newArray(size_t bytes) |
1498 { | 1503 { |
1499 ASSERT_NOT_REACHED(); | 1504 ASSERT_NOT_REACHED(); |
1500 return 0; | 1505 return 0; |
1501 } | 1506 } |
1502 | 1507 |
1503 static void deleteArray(void* ptr) | 1508 static void deleteArray(void* ptr) |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2418 }; | 2423 }; |
2419 | 2424 |
2420 template<typename T> | 2425 template<typename T> |
2421 struct IfWeakMember<WeakMember<T> > { | 2426 struct IfWeakMember<WeakMember<T> > { |
2422 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } | 2427 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit
or->isAlive(t.get()); } |
2423 }; | 2428 }; |
2424 | 2429 |
2425 } // namespace blink | 2430 } // namespace blink |
2426 | 2431 |
2427 #endif // Heap_h | 2432 #endif // Heap_h |
OLD | NEW |