Title: [87441] trunk/Source/_javascript_Core
- Revision
- 87441
- Author
- [email protected]
- Date
- 2011-05-26 15:43:07 -0700 (Thu, 26 May 2011)
Log Message
2011-05-26 Geoffrey Garen <[email protected]>
Reviewed by Oliver Hunt.
Moved Heap-related functions out of JSCell.h and into respective header files
https://bugs.webkit.org/show_bug.cgi?id=61567
* heap/Heap.h:
(JSC::Heap::allocate):
(JSC::Heap::heap):
* heap/MarkedBlock.h:
(JSC::MarkedBlock::allocate):
* heap/MarkedSpace.h:
(JSC::MarkedSpace::sizeClassFor):
(JSC::MarkedSpace::allocate):
* runtime/JSCell.h:
(JSC::JSCell::destructor):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (87440 => 87441)
--- trunk/Source/_javascript_Core/ChangeLog 2011-05-26 22:37:11 UTC (rev 87440)
+++ trunk/Source/_javascript_Core/ChangeLog 2011-05-26 22:43:07 UTC (rev 87441)
@@ -1,5 +1,23 @@
2011-05-26 Geoffrey Garen <[email protected]>
+ Reviewed by Oliver Hunt.
+
+ Moved Heap-related functions out of JSCell.h and into respective header files
+ https://bugs.webkit.org/show_bug.cgi?id=61567
+
+ * heap/Heap.h:
+ (JSC::Heap::allocate):
+ (JSC::Heap::heap):
+ * heap/MarkedBlock.h:
+ (JSC::MarkedBlock::allocate):
+ * heap/MarkedSpace.h:
+ (JSC::MarkedSpace::sizeClassFor):
+ (JSC::MarkedSpace::allocate):
+ * runtime/JSCell.h:
+ (JSC::JSCell::destructor):
+
+2011-05-26 Geoffrey Garen <[email protected]>
+
Try to fix Windows build.
* _javascript_Core.vcproj/_javascript_Core/_javascript_Core.def:
Modified: trunk/Source/_javascript_Core/heap/Heap.h (87440 => 87441)
--- trunk/Source/_javascript_Core/heap/Heap.h 2011-05-26 22:37:11 UTC (rev 87440)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2011-05-26 22:43:07 UTC (rev 87441)
@@ -193,6 +193,31 @@
m_markedSpace.forEach(functor);
}
+ inline void* Heap::allocate(size_t bytes)
+ {
+ ASSERT(isValidAllocation(bytes));
+
+ m_operationInProgress = Allocation;
+ void* result = m_markedSpace.allocate(bytes);
+ m_operationInProgress = NoOperation;
+ if (result)
+ return result;
+
+ return allocateSlowCase(bytes);
+ }
+
+ inline Heap* Heap::heap(JSValue v)
+ {
+ if (!v.isCell())
+ return 0;
+ return heap(v.asCell());
+ }
+
+ inline Heap* Heap::heap(JSCell* c)
+ {
+ return MarkedSpace::heap(c);
+ }
+
} // namespace JSC
#endif // Heap_h
Modified: trunk/Source/_javascript_Core/heap/MarkedBlock.h (87440 => 87441)
--- trunk/Source/_javascript_Core/heap/MarkedBlock.h 2011-05-26 22:37:11 UTC (rev 87440)
+++ trunk/Source/_javascript_Core/heap/MarkedBlock.h 2011-05-26 22:43:07 UTC (rev 87441)
@@ -36,6 +36,8 @@
typedef uintptr_t Bits;
static const size_t KB = 1024;
+
+ void destructor(JSCell*); // Defined in JSCell.h.
class MarkedBlock : public DoublyLinkedListNode<MarkedBlock> {
friend class WTF::DoublyLinkedListNode<MarkedBlock>;
@@ -197,6 +199,21 @@
}
}
+ inline void* MarkedBlock::allocate()
+ {
+ while (m_nextAtom < m_endAtom) {
+ if (!m_marks.testAndSet(m_nextAtom)) {
+ JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[m_nextAtom]);
+ m_nextAtom += m_atomsPerCell;
+ destructor(cell);
+ return cell;
+ }
+ m_nextAtom += m_atomsPerCell;
+ }
+
+ return 0;
+ }
+
} // namespace JSC
#endif // MarkedSpace_h
Modified: trunk/Source/_javascript_Core/heap/MarkedSpace.h (87440 => 87441)
--- trunk/Source/_javascript_Core/heap/MarkedSpace.h 2011-05-26 22:37:11 UTC (rev 87440)
+++ trunk/Source/_javascript_Core/heap/MarkedSpace.h 2011-05-26 22:43:07 UTC (rev 87441)
@@ -172,6 +172,20 @@
m_highWaterMark = highWaterMark;
}
+ inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes)
+ {
+ ASSERT(bytes && bytes < maxCellSize);
+ if (bytes < preciseCutoff)
+ return m_preciseSizeClasses[(bytes - 1) / preciseStep];
+ return m_impreciseSizeClasses[(bytes - 1) / impreciseStep];
+ }
+
+ inline void* MarkedSpace::allocate(size_t bytes)
+ {
+ SizeClass& sizeClass = sizeClassFor(bytes);
+ return allocateFromSizeClass(sizeClass);
+ }
+
inline MarkedSpace::SizeClass::SizeClass()
: nextBlock(0)
, cellSize(0)
Modified: trunk/Source/_javascript_Core/runtime/JSCell.h (87440 => 87441)
--- trunk/Source/_javascript_Core/runtime/JSCell.h 2011-05-26 22:37:11 UTC (rev 87440)
+++ trunk/Source/_javascript_Core/runtime/JSCell.h 2011-05-26 22:43:07 UTC (rev 87441)
@@ -72,6 +72,8 @@
friend class Structure;
friend class StructureChain;
friend class RegExp;
+ friend void destructor(JSCell*);
+
enum CreatingEarlyCellTag { CreatingEarlyCell };
protected:
@@ -345,18 +347,6 @@
return isCell() ? asCell()->toThisObject(exec) : toThisObjectSlowCase(exec);
}
- inline Heap* Heap::heap(JSValue v)
- {
- if (!v.isCell())
- return 0;
- return heap(v.asCell());
- }
-
- inline Heap* Heap::heap(JSCell* c)
- {
- return MarkedSpace::heap(c);
- }
-
#if ENABLE(JSC_ZOMBIES)
inline bool JSValue::isZombie() const
{
@@ -364,48 +354,6 @@
}
#endif
- inline void* MarkedBlock::allocate()
- {
- while (m_nextAtom < m_endAtom) {
- if (!m_marks.testAndSet(m_nextAtom)) {
- JSCell* cell = reinterpret_cast<JSCell*>(&atoms()[m_nextAtom]);
- m_nextAtom += m_atomsPerCell;
- cell->~JSCell();
- return cell;
- }
- m_nextAtom += m_atomsPerCell;
- }
-
- return 0;
- }
-
- inline MarkedSpace::SizeClass& MarkedSpace::sizeClassFor(size_t bytes)
- {
- ASSERT(bytes && bytes < maxCellSize);
- if (bytes < preciseCutoff)
- return m_preciseSizeClasses[(bytes - 1) / preciseStep];
- return m_impreciseSizeClasses[(bytes - 1) / impreciseStep];
- }
-
- inline void* MarkedSpace::allocate(size_t bytes)
- {
- SizeClass& sizeClass = sizeClassFor(bytes);
- return allocateFromSizeClass(sizeClass);
- }
-
- inline void* Heap::allocate(size_t bytes)
- {
- ASSERT(isValidAllocation(bytes));
-
- m_operationInProgress = Allocation;
- void* result = m_markedSpace.allocate(bytes);
- m_operationInProgress = NoOperation;
- if (result)
- return result;
-
- return allocateSlowCase(bytes);
- }
-
inline void* JSCell::operator new(size_t size, JSGlobalData* globalData)
{
return globalData->heap.allocate(size);
@@ -415,6 +363,11 @@
{
return exec->heap()->allocate(size);
}
+
+ inline void destructor(JSCell* cell)
+ {
+ cell->~JSCell();
+ }
} // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes