Ignore:
Timestamp:
Sep 6, 2013, 3:32:08 PM (12 years ago)
Author:
[email protected]
Message:

Stop using fastNew/fastDelete in JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=120898

Reviewed by Oliver Hunt.

Source/JavaScriptCore:

Change all the hash table members in ExecState to be OwnPtrs and use
adoptPtr instead. Also, since none of the hash tables can be null, change their getters
to return references and propagate the reference types wherever we know that a HashTable can't be null.

  • interpreter/CallFrame.h:

(JSC::ExecState::arrayConstructorTable):
(JSC::ExecState::arrayPrototypeTable):
(JSC::ExecState::booleanPrototypeTable):
(JSC::ExecState::dataViewTable):
(JSC::ExecState::dateTable):
(JSC::ExecState::dateConstructorTable):
(JSC::ExecState::errorPrototypeTable):
(JSC::ExecState::globalObjectTable):
(JSC::ExecState::jsonTable):
(JSC::ExecState::numberConstructorTable):
(JSC::ExecState::numberPrototypeTable):
(JSC::ExecState::objectConstructorTable):
(JSC::ExecState::privateNamePrototypeTable):
(JSC::ExecState::regExpTable):
(JSC::ExecState::regExpConstructorTable):
(JSC::ExecState::regExpPrototypeTable):
(JSC::ExecState::stringConstructorTable):
(JSC::ExecState::promisePrototypeTable):
(JSC::ExecState::promiseConstructorTable):
(JSC::ExecState::promiseResolverPrototypeTable):

  • runtime/ClassInfo.h:

(JSC::ClassInfo::propHashTable):

  • runtime/Lookup.h:

(JSC::getStaticPropertySlot):
(JSC::getStaticFunctionSlot):
(JSC::getStaticValueSlot):
(JSC::lookupPut):

  • runtime/VM.cpp:

(JSC::VM::VM):
(JSC::VM::~VM):

  • runtime/VM.h:

Source/WebCore:

Update for changes to JavaScriptCore.

  • bindings/js/DOMObjectHashTableMap.h:

(WebCore::DOMObjectHashTableMap::get):

  • bindings/js/JSDOMBinding.cpp:

(WebCore::getHashTableForGlobalData):

  • bindings/js/JSDOMBinding.h:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::put):

  • bindings/js/JSPluginElementFunctions.h:

(WebCore::pluginElementCustomGetOwnPropertySlot):

  • bindings/js/JSStorageCustom.cpp:

(WebCore::JSStorage::deleteProperty):
(WebCore::JSStorage::putDelegate):

  • bindings/scripts/CodeGeneratorJS.pm:

(hashTableAccessor):
(prototypeHashTableAccessor):
(constructorHashTableAccessor):
(GenerateGetOwnPropertySlotBody):
(GenerateImplementation):
(GenerateConstructorHelperMethods):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/VM.cpp

    r155023 r155219  
    156156    , clientData(0)
    157157    , topCallFrame(CallFrame::noCaller()->removeHostCallFrameFlag())
    158     , arrayConstructorTable(fastNew<HashTable>(JSC::arrayConstructorTable))
    159     , arrayPrototypeTable(fastNew<HashTable>(JSC::arrayPrototypeTable))
    160     , booleanPrototypeTable(fastNew<HashTable>(JSC::booleanPrototypeTable))
    161     , dataViewTable(fastNew<HashTable>(JSC::dataViewTable))
    162     , dateTable(fastNew<HashTable>(JSC::dateTable))
    163     , dateConstructorTable(fastNew<HashTable>(JSC::dateConstructorTable))
    164     , errorPrototypeTable(fastNew<HashTable>(JSC::errorPrototypeTable))
    165     , globalObjectTable(fastNew<HashTable>(JSC::globalObjectTable))
    166     , jsonTable(fastNew<HashTable>(JSC::jsonTable))
    167     , numberConstructorTable(fastNew<HashTable>(JSC::numberConstructorTable))
    168     , numberPrototypeTable(fastNew<HashTable>(JSC::numberPrototypeTable))
    169     , objectConstructorTable(fastNew<HashTable>(JSC::objectConstructorTable))
    170     , privateNamePrototypeTable(fastNew<HashTable>(JSC::privateNamePrototypeTable))
    171     , regExpTable(fastNew<HashTable>(JSC::regExpTable))
    172     , regExpConstructorTable(fastNew<HashTable>(JSC::regExpConstructorTable))
    173     , regExpPrototypeTable(fastNew<HashTable>(JSC::regExpPrototypeTable))
    174     , stringConstructorTable(fastNew<HashTable>(JSC::stringConstructorTable))
     158    , arrayConstructorTable(adoptPtr(new HashTable(JSC::arrayConstructorTable)))
     159    , arrayPrototypeTable(adoptPtr(new HashTable(JSC::arrayPrototypeTable)))
     160    , booleanPrototypeTable(adoptPtr(new HashTable(JSC::booleanPrototypeTable)))
     161    , dataViewTable(adoptPtr(new HashTable(JSC::dataViewTable)))
     162    , dateTable(adoptPtr(new HashTable(JSC::dateTable)))
     163    , dateConstructorTable(adoptPtr(new HashTable(JSC::dateConstructorTable)))
     164    , errorPrototypeTable(adoptPtr(new HashTable(JSC::errorPrototypeTable)))
     165    , globalObjectTable(adoptPtr(new HashTable(JSC::globalObjectTable)))
     166    , jsonTable(adoptPtr(new HashTable(JSC::jsonTable)))
     167    , numberConstructorTable(adoptPtr(new HashTable(JSC::numberConstructorTable)))
     168    , numberPrototypeTable(adoptPtr(new HashTable(JSC::numberPrototypeTable)))
     169    , objectConstructorTable(adoptPtr(new HashTable(JSC::objectConstructorTable)))
     170    , privateNamePrototypeTable(adoptPtr(new HashTable(JSC::privateNamePrototypeTable)))
     171    , regExpTable(adoptPtr(new HashTable(JSC::regExpTable)))
     172    , regExpConstructorTable(adoptPtr(new HashTable(JSC::regExpConstructorTable)))
     173    , regExpPrototypeTable(adoptPtr(new HashTable(JSC::regExpPrototypeTable)))
     174    , stringConstructorTable(adoptPtr(new HashTable(JSC::stringConstructorTable)))
    175175#if ENABLE(PROMISES)
    176     , promisePrototypeTable(fastNew<HashTable>(JSC::promisePrototypeTable))
    177     , promiseConstructorTable(fastNew<HashTable>(JSC::promiseConstructorTable))
    178     , promiseResolverPrototypeTable(fastNew<HashTable>(JSC::promiseResolverPrototypeTable))
     176    , promisePrototypeTable(adoptPtr(new HashTable(JSC::promisePrototypeTable)))
     177    , promiseConstructorTable(adoptPtr(new HashTable(JSC::promiseConstructorTable)))
     178    , promiseResolverPrototypeTable(adoptPtr(new HashTable(JSC::promiseResolverPrototypeTable)))
    179179#endif
    180180    , identifierTable(vmType == Default ? wtfThreadData().currentIdentifierTable() : createIdentifierTable())
     
    333333#endif
    334334
    335     fastDelete(const_cast<HashTable*>(arrayConstructorTable));
    336     fastDelete(const_cast<HashTable*>(arrayPrototypeTable));
    337     fastDelete(const_cast<HashTable*>(booleanPrototypeTable));
    338     fastDelete(const_cast<HashTable*>(dataViewTable));
    339     fastDelete(const_cast<HashTable*>(dateTable));
    340     fastDelete(const_cast<HashTable*>(dateConstructorTable));
    341     fastDelete(const_cast<HashTable*>(errorPrototypeTable));
    342     fastDelete(const_cast<HashTable*>(globalObjectTable));
    343     fastDelete(const_cast<HashTable*>(jsonTable));
    344     fastDelete(const_cast<HashTable*>(numberConstructorTable));
    345     fastDelete(const_cast<HashTable*>(numberPrototypeTable));
    346     fastDelete(const_cast<HashTable*>(objectConstructorTable));
    347     fastDelete(const_cast<HashTable*>(privateNamePrototypeTable));
    348     fastDelete(const_cast<HashTable*>(regExpTable));
    349     fastDelete(const_cast<HashTable*>(regExpConstructorTable));
    350     fastDelete(const_cast<HashTable*>(regExpPrototypeTable));
    351     fastDelete(const_cast<HashTable*>(stringConstructorTable));
    352 #if ENABLE(PROMISES)
    353     fastDelete(const_cast<HashTable*>(promisePrototypeTable));
    354     fastDelete(const_cast<HashTable*>(promiseConstructorTable));
    355     fastDelete(const_cast<HashTable*>(promiseResolverPrototypeTable));
    356 #endif
    357 
    358335    delete emptyList;
    359336
Note: See TracChangeset for help on using the changeset viewer.