| 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 1555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 static const bool isGarbageCollected = true; | 1566 static const bool isGarbageCollected = true; |
| 1567 | 1567 |
| 1568 template <typename T> | 1568 template <typename T> |
| 1569 static T* allocateVectorBacking(size_t size) | 1569 static T* allocateVectorBacking(size_t size) |
| 1570 { | 1570 { |
| 1571 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); | 1571 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); |
| 1572 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, VectorHea
pIndex, gcInfoIndex)); | 1572 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, VectorHea
pIndex, gcInfoIndex)); |
| 1573 } | 1573 } |
| 1574 PLATFORM_EXPORT static void freeVectorBacking(void*); | 1574 PLATFORM_EXPORT static void freeVectorBacking(void*); |
| 1575 PLATFORM_EXPORT static bool expandVectorBacking(void*, size_t); | 1575 PLATFORM_EXPORT static bool expandVectorBacking(void*, size_t); |
| 1576 PLATFORM_EXPORT static bool shrinkVectorBacking(void*, size_t quantizedCurre
ntSize, size_t quantizedShrunkSize); | 1576 static inline bool shrinkVectorBacking(void* address, size_t quantizedCurren
tSize, size_t quantizedShrunkSize) |
| 1577 { |
| 1578 // Returns always true, so the inlining in turn enables call site simpli
fications. |
| 1579 backingShrink(address, quantizedCurrentSize, quantizedShrunkSize); |
| 1580 return true; |
| 1581 } |
| 1582 |
| 1577 template <typename T> | 1583 template <typename T> |
| 1578 static T* allocateInlineVectorBacking(size_t size) | 1584 static T* allocateInlineVectorBacking(size_t size) |
| 1579 { | 1585 { |
| 1580 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); | 1586 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); |
| 1581 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, InlineVec
torHeapIndex, gcInfoIndex)); | 1587 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, InlineVec
torHeapIndex, gcInfoIndex)); |
| 1582 } | 1588 } |
| 1583 PLATFORM_EXPORT static void freeInlineVectorBacking(void*); | 1589 PLATFORM_EXPORT static void freeInlineVectorBacking(void*); |
| 1584 PLATFORM_EXPORT static bool expandInlineVectorBacking(void*, size_t); | 1590 PLATFORM_EXPORT static bool expandInlineVectorBacking(void*, size_t); |
| 1585 PLATFORM_EXPORT static bool shrinkInlineVectorBacking(void*, size_t quantize
dCurrentSize, size_t quantizedShrinkedSize); | 1591 static inline bool shrinkInlineVectorBacking(void* address, size_t quantized
CurrentSize, size_t quantizedShrunkSize) |
| 1592 { |
| 1593 backingShrink(address, quantizedCurrentSize, quantizedShrunkSize); |
| 1594 return true; |
| 1595 } |
| 1586 | 1596 |
| 1587 template <typename T, typename HashTable> | 1597 template <typename T, typename HashTable> |
| 1588 static T* allocateHashTableBacking(size_t size) | 1598 static T* allocateHashTableBacking(size_t size) |
| 1589 { | 1599 { |
| 1590 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index
(); | 1600 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index
(); |
| 1591 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, HashTable
HeapIndex, gcInfoIndex)); | 1601 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex<T>(size, HashTable
HeapIndex, gcInfoIndex)); |
| 1592 } | 1602 } |
| 1593 template <typename T, typename HashTable> | 1603 template <typename T, typename HashTable> |
| 1594 static T* allocateZeroedHashTableBacking(size_t size) | 1604 static T* allocateZeroedHashTableBacking(size_t size) |
| 1595 { | 1605 { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1681 static void leaveNoAllocationScope() | 1691 static void leaveNoAllocationScope() |
| 1682 { | 1692 { |
| 1683 #if ENABLE(ASSERT) | 1693 #if ENABLE(ASSERT) |
| 1684 ThreadState::current()->leaveNoAllocationScope(); | 1694 ThreadState::current()->leaveNoAllocationScope(); |
| 1685 #endif | 1695 #endif |
| 1686 } | 1696 } |
| 1687 | 1697 |
| 1688 private: | 1698 private: |
| 1689 static void backingFree(void*); | 1699 static void backingFree(void*); |
| 1690 static bool backingExpand(void*, size_t); | 1700 static bool backingExpand(void*, size_t); |
| 1691 static void backingShrink(void*, size_t quantizedCurrentSize, size_t quantiz
edShrunkSize); | 1701 PLATFORM_EXPORT static void backingShrink(void*, size_t quantizedCurrentSize
, size_t quantizedShrunkSize); |
| 1692 | 1702 |
| 1693 template<typename T, size_t u, typename V> friend class WTF::Vector; | 1703 template<typename T, size_t u, typename V> friend class WTF::Vector; |
| 1694 template<typename T, typename U, typename V, typename W> friend class WTF::H
ashSet; | 1704 template<typename T, typename U, typename V, typename W> friend class WTF::H
ashSet; |
| 1695 template<typename T, typename U, typename V, typename W, typename X, typenam
e Y> friend class WTF::HashMap; | 1705 template<typename T, typename U, typename V, typename W, typename X, typenam
e Y> friend class WTF::HashMap; |
| 1696 }; | 1706 }; |
| 1697 | 1707 |
| 1698 template<typename VisitorDispatcher, typename Value> | 1708 template<typename VisitorDispatcher, typename Value> |
| 1699 static void traceListHashSetValue(VisitorDispatcher visitor, Value& value) | 1709 static void traceListHashSetValue(VisitorDispatcher visitor, Value& value) |
| 1700 { | 1710 { |
| 1701 // We use the default hash traits for the value in the node, because | 1711 // We use the default hash traits for the value in the node, because |
| (...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 template<typename T, size_t inlineCapacity> | 2566 template<typename T, size_t inlineCapacity> |
| 2557 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; | 2567 struct GCInfoTrait<HeapVector<T, inlineCapacity>> : public GCInfoTrait<Vector<T,
inlineCapacity, HeapAllocator>> { }; |
| 2558 template<typename T, size_t inlineCapacity> | 2568 template<typename T, size_t inlineCapacity> |
| 2559 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; | 2569 struct GCInfoTrait<HeapDeque<T, inlineCapacity>> : public GCInfoTrait<Deque<T, i
nlineCapacity, HeapAllocator>> { }; |
| 2560 template<typename T, typename U, typename V> | 2570 template<typename T, typename U, typename V> |
| 2561 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; | 2571 struct GCInfoTrait<HeapHashCountedSet<T, U, V>> : public GCInfoTrait<HashCounted
Set<T, U, V, HeapAllocator>> { }; |
| 2562 | 2572 |
| 2563 } // namespace blink | 2573 } // namespace blink |
| 2564 | 2574 |
| 2565 #endif // Heap_h | 2575 #endif // Heap_h |
| OLD | NEW |