Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (190738 => 190739)
--- trunk/Source/_javascript_Core/ChangeLog 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/ChangeLog 2015-10-08 20:19:02 UTC (rev 190739)
@@ -1,3 +1,49 @@
+2015-10-08 Joseph Pecoraro <[email protected]>
+
+ Clean up Marked classes
+ https://bugs.webkit.org/show_bug.cgi?id=149853
+
+ Reviewed by Darin Adler.
+
+ * heap/Heap.h:
+ Move include here where it is really needed.
+
+ * heap/HeapStatistics.cpp:
+ * heap/HeapStatistics.h:
+ Simplify includes.
+
+ * heap/MarkedAllocator.h:
+ Add missing copyright header.
+
+ * heap/MarkedBlock.cpp:
+ * heap/MarkedBlock.h:
+ (JSC::MarkedBlock::needsSweeping):
+ Remove unused constants. Add some static asserts. Add some `const` ness.
+
+ * heap/MarkedSpace.h:
+ (JSC::MarkedSpace::isIterating):
+ Update comments to better reflect actual values.
+ Remove unimplemented method (moved to Heap).
+
+ * heap/MarkedSpace.cpp:
+ (JSC::Free::Free):
+ (JSC::Free::operator()):
+ (JSC::Free::returnValue): Deleted.
+ (JSC::FreeOrShrink::FreeOrShrink):
+ (JSC::FreeOrShrink::operator()):
+ (JSC::MarkedSpace::~MarkedSpace):
+ (JSC::MarkedSpace::shrink):
+ Replace conditional Functor that was not using return value
+ with simplified targeted VoidFunctors.
+
+ (JSC::Shrink::operator()): Deleted.
+ Remove unused functor.
+
+ * heap/WeakBlock.cpp:
+ * heap/WeakBlock.h:
+ * runtime/Options.cpp:
+ Remove dead code.
+
2015-10-08 Saam barati <[email protected]>
We should be able to inline getter/setter calls inside an inline cache even when the SpillRegistersMode is NeedsToSpill
Modified: trunk/Source/_javascript_Core/heap/Heap.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/Heap.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -31,6 +31,7 @@
#include "HeapOperation.h"
#include "JITStubRoutineSet.h"
#include "ListableHandler.h"
+#include "MachineStackMarker.h"
#include "MarkedAllocator.h"
#include "MarkedBlock.h"
#include "MarkedBlockSet.h"
Modified: trunk/Source/_javascript_Core/heap/HeapStatistics.cpp (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/HeapStatistics.cpp 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/HeapStatistics.cpp 2015-10-08 20:19:02 UTC (rev 190739)
@@ -32,12 +32,13 @@
#include "JSObject.h"
#include "Options.h"
#include <stdlib.h>
+#include <wtf/CurrentTime.h>
+#include <wtf/DataLog.h>
+#include <wtf/StdLibExtras.h>
+
#if OS(UNIX)
#include <sys/resource.h>
#endif
-#include <wtf/CurrentTime.h>
-#include <wtf/DataLog.h>
-#include <wtf/Deque.h>
namespace JSC {
Modified: trunk/Source/_javascript_Core/heap/HeapStatistics.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/HeapStatistics.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/HeapStatistics.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -27,7 +27,7 @@
#define HeapStatistics_h
#include "JSExportMacros.h"
-#include <wtf/Deque.h>
+#include <wtf/Vector.h>
namespace JSC {
@@ -43,10 +43,6 @@
static void showObjectStatistics(Heap*);
- static const size_t KB = 1024;
- static const size_t MB = 1024 * KB;
- static const size_t GB = 1024 * MB;
-
private:
static void logStatistics();
static Vector<double>* s_pauseTimeStarts;
Modified: trunk/Source/_javascript_Core/heap/MarkedAllocator.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/MarkedAllocator.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/MarkedAllocator.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -1,3 +1,28 @@
+/*
+ * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef MarkedAllocator_h
#define MarkedAllocator_h
@@ -10,10 +35,6 @@
class MarkedSpace;
class LLIntOffsetsExtractor;
-namespace DFG {
-class SpeculativeJIT;
-}
-
class MarkedAllocator {
friend class LLIntOffsetsExtractor;
@@ -145,4 +166,4 @@
} // namespace JSC
-#endif
+#endif // MarkedAllocator_h
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.cpp (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.cpp 2015-10-08 20:19:02 UTC (rev 190739)
@@ -26,7 +26,6 @@
#include "config.h"
#include "MarkedBlock.h"
-#include "IncrementalSweeper.h"
#include "JSCell.h"
#include "JSDestructibleObject.h"
#include "JSCInlines.h"
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -30,7 +30,6 @@
#include <wtf/DoublyLinkedList.h>
#include <wtf/HashFunctions.h>
#include <wtf/StdLibExtras.h>
-#include <wtf/Vector.h>
// Set to log state transitions of blocks.
#define HEAP_LOG_BLOCK_STATE_TRANSITIONS 0
@@ -54,8 +53,6 @@
typedef uintptr_t Bits;
- static const size_t MB = 1024 * 1024;
-
bool isZapped(const JSCell*);
// A marked block is a page-aligned container for heap-allocated objects.
@@ -72,14 +69,13 @@
friend struct VerifyMarkedOrRetired;
public:
static const size_t atomSize = 16; // bytes
- static const size_t atomShiftAmount = 4; // log_2(atomSize) FIXME: Change atomSize to 16.
static const size_t blockSize = 16 * KB;
static const size_t blockMask = ~(blockSize - 1); // blockSize must be a power of two.
static const size_t atomsPerBlock = blockSize / atomSize;
- static const size_t atomMask = atomsPerBlock - 1;
- static const size_t markByteShiftAmount = 3; // log_2(word size for m_marks) FIXME: Change word size for m_marks to uint8_t.
+ static_assert(!(MarkedBlock::atomSize & (MarkedBlock::atomSize - 1)), "MarkedBlock::atomSize must be a power of two.");
+ static_assert(!(MarkedBlock::blockSize & (MarkedBlock::blockSize - 1)), "MarkedBlock::blockSize must be a power of two.");
struct FreeCell {
FreeCell* next;
@@ -168,7 +164,7 @@
void clearNewlyAllocated(const void*);
bool isAllocated() const;
- bool needsSweeping();
+ bool needsSweeping() const;
void didRetireBlock(const FreeList&);
void willRemoveBlock();
@@ -177,7 +173,7 @@
template <typename Functor> IterationStatus forEachDeadCell(Functor&);
private:
- static const size_t atomAlignmentMask = atomSize - 1; // atomSize must be a power of two.
+ static const size_t atomAlignmentMask = atomSize - 1;
enum BlockState { New, FreeListed, Allocated, Marked, Retired };
template<bool callDestructors> FreeList sweepHelper(SweepMode = SweepOnly);
@@ -442,7 +438,7 @@
return IterationStatus::Continue;
}
- inline bool MarkedBlock::needsSweeping()
+ inline bool MarkedBlock::needsSweeping() const
{
return m_state == Marked;
}
Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.cpp (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/MarkedSpace.cpp 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.cpp 2015-10-08 20:19:02 UTC (rev 190739)
@@ -22,50 +22,25 @@
#include "MarkedSpace.h"
#include "IncrementalSweeper.h"
-#include "JSGlobalObject.h"
-#include "JSLock.h"
#include "JSObject.h"
#include "JSCInlines.h"
namespace JSC {
-class Structure;
+struct Free : MarkedBlock::VoidFunctor {
+ Free(MarkedSpace& space) : m_markedSpace(space) { }
+ void operator()(MarkedBlock* block) { m_markedSpace.freeBlock(block); }
+private:
+ MarkedSpace& m_markedSpace;
+};
-class Free {
-public:
- typedef MarkedBlock* ReturnType;
-
- enum FreeMode { FreeOrShrink, FreeAll };
-
- Free(FreeMode, MarkedSpace*);
- void operator()(MarkedBlock*);
- ReturnType returnValue();
-
+struct FreeOrShrink : MarkedBlock::VoidFunctor {
+ FreeOrShrink(MarkedSpace& space) : m_markedSpace(space) { }
+ void operator()(MarkedBlock* block) { m_markedSpace.freeOrShrinkBlock(block); }
private:
- FreeMode m_freeMode;
- MarkedSpace* m_markedSpace;
- DoublyLinkedList<MarkedBlock> m_blocks;
+ MarkedSpace& m_markedSpace;
};
-inline Free::Free(FreeMode freeMode, MarkedSpace* newSpace)
- : m_freeMode(freeMode)
- , m_markedSpace(newSpace)
-{
-}
-
-inline void Free::operator()(MarkedBlock* block)
-{
- if (m_freeMode == FreeOrShrink)
- m_markedSpace->freeOrShrinkBlock(block);
- else
- m_markedSpace->freeBlock(block);
-}
-
-inline Free::ReturnType Free::returnValue()
-{
- return m_blocks.head();
-}
-
struct VisitWeakSet : MarkedBlock::VoidFunctor {
VisitWeakSet(HeapRootVisitor& heapRootVisitor) : m_heapRootVisitor(heapRootVisitor) { }
void operator()(MarkedBlock* block) { block->visitWeakSet(m_heapRootVisitor); }
@@ -98,7 +73,7 @@
MarkedSpace::~MarkedSpace()
{
- Free free(Free::FreeAll, this);
+ Free free(*this);
forEachBlock(free);
ASSERT(!m_blocks.set().size());
}
@@ -247,13 +222,9 @@
freeBlock(block);
}
-struct Shrink : MarkedBlock::VoidFunctor {
- void operator()(MarkedBlock* block) { block->shrink(); }
-};
-
void MarkedSpace::shrink()
{
- Free freeOrShrink(Free::FreeOrShrink, this);
+ FreeOrShrink freeOrShrink(*this);
forEachBlock(freeOrShrink);
}
Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/MarkedSpace.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -22,13 +22,10 @@
#ifndef MarkedSpace_h
#define MarkedSpace_h
-#include "MachineStackMarker.h"
#include "MarkedAllocator.h"
#include "MarkedBlock.h"
#include "MarkedBlockSet.h"
#include <array>
-#include <wtf/Bitmap.h>
-#include <wtf/DoublyLinkedList.h>
#include <wtf/HashSet.h>
#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
@@ -38,11 +35,8 @@
class Heap;
class HeapIterationScope;
-class JSCell;
class LiveObjectIterator;
class LLIntOffsetsExtractor;
-class WeakGCHandle;
-class SlotVisitor;
struct ClearMarks : MarkedBlock::VoidFunctor {
void operator()(MarkedBlock* block)
@@ -74,12 +68,12 @@
class MarkedSpace {
WTF_MAKE_NONCOPYABLE(MarkedSpace);
public:
- // [ 32... 128 ]
+ // [ 16 ... 128 ]
static const size_t preciseStep = MarkedBlock::atomSize;
static const size_t preciseCutoff = 128;
static const size_t preciseCount = preciseCutoff / preciseStep;
- // [ 1024... blockSize ]
+ // [ 256 ... blockSize/2 ]
static const size_t impreciseStep = 2 * preciseCutoff;
static const size_t impreciseCutoff = MarkedBlock::blockSize / 2;
static const size_t impreciseCount = impreciseCutoff / impreciseStep;
@@ -110,21 +104,21 @@
MarkedBlockSet& blocks() { return m_blocks; }
void willStartIterating();
- bool isIterating() { return m_isIterating; }
+ bool isIterating() const { return m_isIterating; }
void didFinishIterating();
void stopAllocating();
void resumeAllocating(); // If we just stopped allocation but we didn't do a collection, we need to resume allocation.
typedef HashSet<MarkedBlock*>::iterator BlockIterator;
-
+
template<typename Functor> typename Functor::ReturnType forEachLiveCell(HeapIterationScope&, Functor&);
template<typename Functor> typename Functor::ReturnType forEachLiveCell(HeapIterationScope&);
template<typename Functor> typename Functor::ReturnType forEachDeadCell(HeapIterationScope&, Functor&);
template<typename Functor> typename Functor::ReturnType forEachDeadCell(HeapIterationScope&);
template<typename Functor> typename Functor::ReturnType forEachBlock(Functor&);
template<typename Functor> typename Functor::ReturnType forEachBlock();
-
+
void shrink();
void freeBlock(MarkedBlock*);
void freeOrShrinkBlock(MarkedBlock*);
@@ -143,10 +137,6 @@
bool isPagedOut(double deadline);
-#if USE(CF)
- template<typename T> void releaseSoon(RetainPtr<T>&&);
-#endif
-
const Vector<MarkedBlock*>& blocksWithNewObjects() const { return m_blocksWithNewObjects; }
private:
Modified: trunk/Source/_javascript_Core/heap/WeakBlock.cpp (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/WeakBlock.cpp 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/WeakBlock.cpp 2015-10-08 20:19:02 UTC (rev 190739)
@@ -28,9 +28,9 @@
#include "Heap.h"
#include "HeapRootVisitor.h"
+#include "JSCInlines.h"
#include "JSObject.h"
-#include "JSCInlines.h"
-#include "Structure.h"
+#include "WeakHandleOwner.h"
namespace JSC {
Modified: trunk/Source/_javascript_Core/heap/WeakBlock.h (190738 => 190739)
--- trunk/Source/_javascript_Core/heap/WeakBlock.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/heap/WeakBlock.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -26,8 +26,6 @@
#ifndef WeakBlock_h
#define WeakBlock_h
-#include <wtf/DoublyLinkedList.h>
-#include "WeakHandleOwner.h"
#include "WeakImpl.h"
#include <wtf/DoublyLinkedList.h>
#include <wtf/StdLibExtras.h>
@@ -35,9 +33,7 @@
namespace JSC {
class HeapRootVisitor;
-class JSValue;
class MarkedBlock;
-class WeakHandleOwner;
class WeakBlock : public DoublyLinkedListNode<WeakBlock> {
public:
Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (190738 => 190739)
--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm 2015-10-08 20:19:02 UTC (rev 190739)
@@ -369,9 +369,6 @@
const MarkedBlockSize = 16 * 1024
const MarkedBlockMask = ~(MarkedBlockSize - 1)
-# Constants for checking mark bits.
-const AtomNumberShift = 3
-const BitMapWordShift = 4
# Allocation constants
if JSVALUE64
Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (190738 => 190739)
--- trunk/Source/_javascript_Core/runtime/Options.cpp 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp 2015-10-08 20:19:02 UTC (rev 190739)
@@ -26,7 +26,6 @@
#include "config.h"
#include "Options.h"
-#include "HeapStatistics.h"
#include <algorithm>
#include <limits>
#include <math.h>
@@ -36,15 +35,10 @@
#include <wtf/ASCIICType.h>
#include <wtf/DataLog.h>
#include <wtf/NumberOfCores.h>
-#include <wtf/PageBlock.h>
#include <wtf/StdLibExtras.h>
#include <wtf/StringExtras.h>
#include <wtf/text/StringBuilder.h>
-#if OS(DARWIN)
-#include <sys/sysctl.h>
-#endif
-
#if OS(WINDOWS)
#include "MacroAssemblerX86.h"
#endif
Modified: trunk/Source/WTF/ChangeLog (190738 => 190739)
--- trunk/Source/WTF/ChangeLog 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/WTF/ChangeLog 2015-10-08 20:19:02 UTC (rev 190739)
@@ -1,5 +1,15 @@
2015-10-08 Joseph Pecoraro <[email protected]>
+ Clean up Marked classes
+ https://bugs.webkit.org/show_bug.cgi?id=149853
+
+ Reviewed by Darin Adler.
+
+ * wtf/PageBlock.h:
+ Remove duplicate using statement.
+
+2015-10-08 Joseph Pecoraro <[email protected]>
+
Remove PageReservation.h clang fixme that has been fixed for a while
https://bugs.webkit.org/show_bug.cgi?id=149908
Modified: trunk/Source/WTF/wtf/PageBlock.h (190738 => 190739)
--- trunk/Source/WTF/wtf/PageBlock.h 2015-10-08 20:17:32 UTC (rev 190738)
+++ trunk/Source/WTF/wtf/PageBlock.h 2015-10-08 20:19:02 UTC (rev 190739)
@@ -82,7 +82,6 @@
using WTF::pageSize;
using WTF::isPageAligned;
-using WTF::isPageAligned;
using WTF::isPowerOfTwo;
#endif // PageBlock_h