Ignore:
Timestamp:
Aug 26, 2009, 4:00:39 PM (16 years ago)
Author:
[email protected]
Message:

A bit of Collector refatoring.

Patch by Geoffrey Garen <[email protected]> on 2009-08-26
Reviewed by Oliver Hunt.

SunSpider says no change. v8 says 1.003x faster (1.02x faster on splay).

  • runtime/JSCell.cpp:

(JSC::JSCell::toPrimitive):
(JSC::JSCell::getPrimitiveNumber):
(JSC::JSCell::toBoolean):
(JSC::JSCell::toNumber):
(JSC::JSCell::toString):
(JSC::JSCell::toObject): Removed pure virtual functions from
JSCell, so the collector can construct one. This allowed
me to remove a bunch of ASSERT_NOT_REACHED throughout the
code, too.

  • runtime/JSCell.h:

(JSC::JSCell::JSCell): ditto
(JSC::Heap::heap): Inlined this function because it's trivial.

  • runtime/Collector.cpp:

(JSC::Heap::destroy):
(JSC::Heap::allocateBlock):
(JSC::Heap::freeBlock):
(JSC::Heap::freeBlocks): Renamed freeHeap to freeBlocks, since
it doesn't actually free the Heap object.
(JSC::Heap::heapAllocate):
(JSC::Heap::sweep):

  • runtime/Collector.h: Refactored block allocation and destruction

into helper functions.

  • runtime/GetterSetter.cpp:
  • runtime/JSAPIValueWrapper.cpp:
  • runtime/JSPropertyNameIterator.cpp: Removed dummy implementations

of pure virtual functions. (See above.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSCell.cpp

    r46598 r47799  
    198198}
    199199
     200JSValue JSCell::toPrimitive(ExecState*, PreferredPrimitiveType) const
     201{
     202    ASSERT_NOT_REACHED();
     203    return JSValue();
     204}
     205
     206bool JSCell::getPrimitiveNumber(ExecState*, double&, JSValue&)
     207{
     208    ASSERT_NOT_REACHED();
     209    return false;
     210}
     211
     212bool JSCell::toBoolean(ExecState*) const
     213{
     214    ASSERT_NOT_REACHED();
     215    return false;
     216}
     217
     218double JSCell::toNumber(ExecState*) const
     219{
     220    ASSERT_NOT_REACHED();
     221    return 0;
     222}
     223
     224UString JSCell::toString(ExecState*) const
     225{
     226    ASSERT_NOT_REACHED();
     227    return UString();
     228}
     229
     230JSObject* JSCell::toObject(ExecState*) const
     231{
     232    ASSERT_NOT_REACHED();
     233    return 0;
     234}
     235
    200236} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.