+2007-11-07 Mark Rowe <mrowe@apple.com>
+
+ Reviewed by Eric.
+
+ Fix up initialization after being mangled in r27572, and remove the
+ ternary expression as extraCost will always be zero for the numeric
+ heap.
+
+ * kjs/collector.cpp:
+ (KJS::Collector::heapAllocate):
+
2007-11-07 Mark Rowe <mrowe@apple.com>
Gtk build fix.
UNUSED_PARAM(s); // s is now only used for the above assert
ASSERT(heap.operationInProgress == NoOperation);
+ ASSERT(heapType == PrimaryHeap || heap.extraCost == 0);
// FIXME: If another global variable access here doesn't hurt performance
// too much, we could abort() in NDEBUG builds, which could help ensure we
// don't spend any time debugging cases where we allocate inside an object's
if (heapType == PrimaryHeap && heap.extraCost > ALLOCATIONS_PER_COLLECTION) {
size_t numLiveObjectsAtLastCollect = heap.numLiveObjectsAtLastCollect;
size_t numNewObjects = numLiveObjects - numLiveObjectsAtLastCollect;
- const size_t newCost = heapType == numNewObjects + heap.extraCost;
+ const size_t newCost = numNewObjects + heap.extraCost;
if (newCost >= ALLOCATIONS_PER_COLLECTION && newCost >= numLiveObjectsAtLastCollect)
goto collect;
}
collect:
size_t numLiveObjectsAtLastCollect = heap.numLiveObjectsAtLastCollect;
size_t numNewObjects = numLiveObjects - numLiveObjectsAtLastCollect;
- const size_t newCost = heapType == PrimaryHeap ? numNewObjects + heap.extraCost : numNewObjects;
-
+ const size_t newCost = numNewObjects + heap.extraCost;
+
if (newCost >= ALLOCATIONS_PER_COLLECTION && newCost >= numLiveObjectsAtLastCollect) {
#ifndef NDEBUG
heap.operationInProgress = NoOperation;