| Index: Source/wtf/WTF.cpp
|
| diff --git a/Source/wtf/WTF.cpp b/Source/wtf/WTF.cpp
|
| index bddb3c0902f685c6f19360fe3748933df7e59b69..ac31ca2d7741dc76959c24e117c25b1665cee18b 100644
|
| --- a/Source/wtf/WTF.cpp
|
| +++ b/Source/wtf/WTF.cpp
|
| @@ -41,8 +41,12 @@ namespace WTF {
|
|
|
| extern void initializeThreading();
|
|
|
| +PartitionAllocator<4096> Partitions::m_bufferAllocator;
|
| +unsigned short QuantizedAllocation::table[QuantizedAllocation::kTableSize];
|
| +
|
| void initialize(TimeFunction currentTimeFunction, TimeFunction monotonicallyIncreasingTimeFunction)
|
| {
|
| + QuantizedAllocation::init();
|
| Partitions::initialize();
|
| setCurrentTimeFunction(currentTimeFunction);
|
| setMonotonicallyIncreasingTimeFunction(monotonicallyIncreasingTimeFunction);
|
| @@ -64,6 +68,20 @@ void Partitions::shutdown()
|
| m_bufferAllocator.shutdown();
|
| }
|
|
|
| -PartitionAllocator<4096> Partitions::m_bufferAllocator;
|
| +void QuantizedAllocation::init()
|
| +{
|
| + size_t currAllocation = 0;
|
| + size_t currRounding = kMinRounding;
|
| + size_t currRoundingLimit = kMinRoundingLimit / 2;
|
| + size_t numCurrRounding = 0;
|
| + for (size_t i = 0; i < kTableSize; ++i) {
|
| + table[i] = currRounding - 1;
|
| + currAllocation += kMinRoundingLimit;
|
| + if (currAllocation == currRoundingLimit * 2) {
|
| + currRoundingLimit *= 2;
|
| + currRounding *= 2;
|
| + }
|
| + }
|
| +}
|
|
|
| } // namespace WTF
|
|
|