Changeset 37215 in webkit for trunk/JavaScriptCore/API


Ignore:
Timestamp:
Oct 2, 2008, 4:48:47 PM (17 years ago)
Author:
Darin Adler
Message:

JavaScriptCore:

2008-10-02 Darin Adler <Darin Adler>

Reviewed by Geoff Garen.

1.019x as fast on SunSpider.

  • API/JSBase.cpp: (JSEvaluateScript): Use heap. instead of heap-> to work with the heap. (JSCheckScriptSyntax): Ditto. (JSGarbageCollect): Ditto. (JSReportExtraMemoryCost): Ditto.
  • API/JSContextRef.cpp: (JSGlobalContextRetain): Ditto. (JSGlobalContextRelease): Destroy the heap with the destroy function instead of the delete operator. (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
  • API/JSObjectRef.cpp: (JSObjectMake): Use heap. instead of heap-> to work with the heap. (JSObjectMakeFunctionWithCallback): Ditto. (JSObjectMakeConstructor): Ditto. (JSObjectMakeFunction): Ditto. (JSObjectMakeArray): Ditto. (JSObjectMakeDate): Ditto. (JSObjectMakeError): Ditto. (JSObjectMakeRegExp): Ditto. (JSObjectHasProperty): Ditto. (JSObjectGetProperty): Ditto. (JSObjectSetProperty): Ditto. (JSObjectGetPropertyAtIndex): Ditto. (JSObjectSetPropertyAtIndex): Ditto. (JSObjectDeleteProperty): Ditto. (JSObjectCallAsFunction): Ditto. (JSObjectCallAsConstructor): Ditto. (JSObjectCopyPropertyNames): Ditto. (JSPropertyNameAccumulatorAddName): Ditto.
  • API/JSValueRef.cpp: (JSValueIsEqual): Ditto. (JSValueIsInstanceOfConstructor): Ditto. (JSValueMakeNumber): Ditto. (JSValueMakeString): Ditto. (JSValueToNumber): Ditto. (JSValueToStringCopy): Ditto. (JSValueToObject): Ditto. (JSValueProtect): Ditto. (JSValueUnprotect): Ditto.
  • kjs/ExecState.h: (JSC::ExecState::heap): Update to use the & operator.
  • kjs/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member instead of calling new to make a heap. (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy function instead of the delete operator.
  • kjs/JSGlobalData.h: Change from Heap* to a Heap.
  • kjs/JSGlobalObject.cpp: (JSC::JSGlobalObject::mark): Use the & operator here. (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work with the heap.

WebCore:

2008-10-02 Darin Adler <Darin Adler>

Reviewed by Geoff Garen.

  • bindings/js/GCController.cpp: (WebCore::collect): Use heap. instead of heap-> to work with the heap. (WebCore::GCController::gcTimerFired): Ditto. (WebCore::GCController::garbageCollectNow): Ditto.
  • bindings/js/JSDOMWindowShell.cpp: (WebCore::JSDOMWindowShell::operator new): Ditto.
  • storage/Database.cpp: (WebCore::Database::Database): Ditto.

WebKit/mac:

2008-10-02 Darin Adler <Darin Adler>

Reviewed by Geoff Garen.

  • Misc/WebCoreStatistics.mm: (+[WebCoreStatistics javaScriptObjectsCount]): Use heap. instead of heap-> to work with the heap. (+[WebCoreStatistics javaScriptGlobalObjectsCount]): Ditto. (+[WebCoreStatistics javaScriptProtectedObjectsCount]): Ditto. (+[WebCoreStatistics javaScriptProtectedGlobalObjectsCount]): Ditto. (+[WebCoreStatistics javaScriptProtectedObjectTypeCounts]): Ditto. (+[WebCoreStatistics javaScriptReferencedObjectsCount]): Ditto.

WebKit/win:

2008-10-02 Darin Adler <Darin Adler>

  • WebCoreStatistics.cpp: (WebCoreStatistics::javaScriptObjectsCount): Use heap. instead of heap-> to work with the heap. (WebCoreStatistics::javaScriptGlobalObjectsCount): Ditto. (WebCoreStatistics::javaScriptProtectedObjectsCount): Ditto. (WebCoreStatistics::javaScriptProtectedGlobalObjectsCount): Ditto. (WebCoreStatistics::javaScriptProtectedObjectTypeCounts): Ditto.
  • WebJavaScriptCollector.cpp: (WebJavaScriptCollector::objectCount): Ditto.
Location:
trunk/JavaScriptCore/API
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/API/JSBase.cpp

    r37184 r37215  
    4444{
    4545    ExecState* exec = toJS(ctx);
    46     exec->globalData().heap->registerThread();
     46    exec->globalData().heap.registerThread();
    4747    JSLock lock(exec);
    4848
     
    7070{
    7171    ExecState* exec = toJS(ctx);
    72     exec->globalData().heap->registerThread();
     72    exec->globalData().heap.registerThread();
    7373    JSLock lock(exec);
    7474
     
    9696    ExecState* exec = toJS(ctx);
    9797    JSGlobalData& globalData = exec->globalData();
    98     Heap* heap = globalData.heap;
    9998
    10099    JSLock lock(globalData.isSharedInstance);
    101100
    102     if (!heap->isBusy())
    103         heap->collect();
     101    if (!globalData.heap.isBusy())
     102        globalData.heap.collect();
    104103
    105104    // FIXME: Perhaps we should trigger a second mark and sweep
     
    111110{
    112111    ExecState* exec = toJS(ctx);
    113     exec->globalData().heap->registerThread();
     112    exec->globalData().heap.registerThread();
    114113    JSLock lock(exec);
    115114
    116     exec->globalData().heap->reportExtraMemoryCost(size);
     115    exec->globalData().heap.reportExtraMemoryCost(size);
    117116}
  • trunk/JavaScriptCore/API/JSContextRef.cpp

    r36263 r37215  
    8888    JSGlobalData& globalData = exec->globalData();
    8989
    90     globalData.heap->registerThread();
     90    globalData.heap.registerThread();
    9191
    9292    gcProtect(exec->dynamicGlobalObject());
     
    105105    if (globalData.refCount() == 2) { // One reference is held by JSGlobalObject, another added by JSGlobalContextRetain().
    106106        // The last reference was released, this is our last chance to collect.
    107         Heap* heap = globalData.heap;
    108 
    109         ASSERT(!heap->protectedObjectCount());
    110         ASSERT(!heap->isBusy());
    111 
    112         delete heap;
    113         globalData.heap = 0;
     107        ASSERT(!globalData.heap.protectedObjectCount());
     108        ASSERT(!globalData.heap.isBusy());
     109        globalData.heap.destroy();
    114110    } else
    115         globalData.heap->collect();
     111        globalData.heap.collect();
    116112
    117113    globalData.deref();
     
    121117{
    122118    ExecState* exec = toJS(ctx);
    123     exec->globalData().heap->registerThread();
     119    exec->globalData().heap.registerThread();
    124120    JSLock lock(exec);
    125121
  • trunk/JavaScriptCore/API/JSObjectRef.cpp

    r37175 r37215  
    7474{
    7575    ExecState* exec = toJS(ctx);
    76     exec->globalData().heap->registerThread();
     76    exec->globalData().heap.registerThread();
    7777    JSLock lock(exec);
    7878
     
    9090{
    9191    ExecState* exec = toJS(ctx);
    92     exec->globalData().heap->registerThread();
     92    exec->globalData().heap.registerThread();
    9393    JSLock lock(exec);
    9494
     
    101101{
    102102    ExecState* exec = toJS(ctx);
    103     exec->globalData().heap->registerThread();
     103    exec->globalData().heap.registerThread();
    104104    JSLock lock(exec);
    105105
     
    116116{
    117117    ExecState* exec = toJS(ctx);
    118     exec->globalData().heap->registerThread();
     118    exec->globalData().heap.registerThread();
    119119    JSLock lock(exec);
    120120
     
    139139{
    140140    ExecState* exec = toJS(ctx);
    141     exec->globalData().heap->registerThread();
     141    exec->globalData().heap.registerThread();
    142142    JSLock lock(exec);
    143143
     
    165165{
    166166    ExecState* exec = toJS(ctx);
    167     exec->globalData().heap->registerThread();
     167    exec->globalData().heap.registerThread();
    168168    JSLock lock(exec);
    169169
     
    186186{
    187187    ExecState* exec = toJS(ctx);
    188     exec->globalData().heap->registerThread();
     188    exec->globalData().heap.registerThread();
    189189    JSLock lock(exec);
    190190
     
    207207{
    208208    ExecState* exec = toJS(ctx);
    209     exec->globalData().heap->registerThread();
     209    exec->globalData().heap.registerThread();
    210210    JSLock lock(exec);
    211211
     
    242242{
    243243    ExecState* exec = toJS(ctx);
    244     exec->globalData().heap->registerThread();
     244    exec->globalData().heap.registerThread();
    245245    JSLock lock(exec);
    246246
     
    253253{
    254254    ExecState* exec = toJS(ctx);
    255     exec->globalData().heap->registerThread();
     255    exec->globalData().heap.registerThread();
    256256    JSLock lock(exec);
    257257
     
    270270{
    271271    ExecState* exec = toJS(ctx);
    272     exec->globalData().heap->registerThread();
     272    exec->globalData().heap.registerThread();
    273273    JSLock lock(exec);
    274274
     
    294294{
    295295    ExecState* exec = toJS(ctx);
    296     exec->globalData().heap->registerThread();
     296    exec->globalData().heap.registerThread();
    297297    JSLock lock(exec);
    298298
     
    312312{
    313313    ExecState* exec = toJS(ctx);
    314     exec->globalData().heap->registerThread();
     314    exec->globalData().heap.registerThread();
    315315    JSLock lock(exec);
    316316
     
    329329{
    330330    ExecState* exec = toJS(ctx);
    331     exec->globalData().heap->registerThread();
     331    exec->globalData().heap.registerThread();
    332332    JSLock lock(exec);
    333333
     
    379379{
    380380    ExecState* exec = toJS(ctx);
    381     exec->globalData().heap->registerThread();
     381    exec->globalData().heap.registerThread();
    382382    JSLock lock(exec);
    383383
     
    417417{
    418418    ExecState* exec = toJS(ctx);
    419     exec->globalData().heap->registerThread();
     419    exec->globalData().heap.registerThread();
    420420    JSLock lock(exec);
    421421
     
    456456    JSObject* jsObject = toJS(object);
    457457    ExecState* exec = toJS(ctx);
    458     exec->globalData().heap->registerThread();
     458    exec->globalData().heap.registerThread();
    459459    JSLock lock(exec);
    460460
     
    501501    PropertyNameArray* propertyNames = toJS(array);
    502502
    503     propertyNames->globalData()->heap->registerThread();
     503    propertyNames->globalData()->heap.registerThread();
    504504    JSLock lock(propertyNames->globalData()->isSharedInstance);
    505505
  • trunk/JavaScriptCore/API/JSValueRef.cpp

    r36766 r37215  
    113113{
    114114    ExecState* exec = toJS(ctx);
    115     exec->globalData().heap->registerThread();
     115    exec->globalData().heap.registerThread();
    116116    JSLock lock(exec);
    117117
     
    140140{
    141141    ExecState* exec = toJS(ctx);
    142     exec->globalData().heap->registerThread();
     142    exec->globalData().heap.registerThread();
    143143    JSLock lock(exec);
    144144
     
    174174{
    175175    ExecState* exec = toJS(ctx);
    176     exec->globalData().heap->registerThread();
     176    exec->globalData().heap.registerThread();
    177177    JSLock lock(exec);
    178178
     
    183183{
    184184    ExecState* exec = toJS(ctx);
    185     exec->globalData().heap->registerThread();
     185    exec->globalData().heap.registerThread();
    186186    JSLock lock(exec);
    187187
     
    199199{
    200200    ExecState* exec = toJS(ctx);
    201     exec->globalData().heap->registerThread();
     201    exec->globalData().heap.registerThread();
    202202    JSLock lock(exec);
    203203
     
    217217{
    218218    ExecState* exec = toJS(ctx);
    219     exec->globalData().heap->registerThread();
     219    exec->globalData().heap.registerThread();
    220220    JSLock lock(exec);
    221221
     
    235235{
    236236    ExecState* exec = toJS(ctx);
    237     exec->globalData().heap->registerThread();
     237    exec->globalData().heap.registerThread();
    238238    JSLock lock(exec);
    239239
     
    253253{
    254254    ExecState* exec = toJS(ctx);
    255     exec->globalData().heap->registerThread();
     255    exec->globalData().heap.registerThread();
    256256    JSLock lock(exec);
    257257
     
    263263{
    264264    ExecState* exec = toJS(ctx);
    265     exec->globalData().heap->registerThread();
     265    exec->globalData().heap.registerThread();
    266266    JSLock lock(exec);
    267267
Note: See TracChangeset for help on using the changeset viewer.