Ignore:
Timestamp:
Jul 30, 2014, 3:26:22 PM (11 years ago)
Author:
[email protected]
Message:

Static hash tables no longer need to be coupled with a VM.
<https://webkit.org/b/135421>

Source/JavaScriptCore:
Now that the static hash tables are using char instead of StringImpl,
it's no longer necessary to make them per-VM.

This patch removes the hook in ClassInfo for providing your own static
hash table getter. Everyone now uses ClassInfo::staticPropHashTable.
Most of this patch is tweaking ClassInfo construction sites to pass one
less null pointer.

Also simplified Lookup.h to stop requiring ExecState/VM to access the
static hash tables.

Reviewed by Geoffrey Garen.

  • API/JSAPIWrapperObject.mm:
  • API/JSCallbackConstructor.cpp:
  • API/JSCallbackFunction.cpp:
  • API/JSCallbackObject.cpp:
  • API/ObjCCallbackFunction.mm:
  • bytecode/UnlinkedCodeBlock.cpp:
  • create_hash_table:
  • debugger/DebuggerScope.cpp:
  • inspector/JSInjectedScriptHost.cpp:
  • inspector/JSInjectedScriptHostPrototype.cpp:
  • inspector/JSJavaScriptCallFrame.cpp:
  • inspector/JSJavaScriptCallFramePrototype.cpp:
  • interpreter/CallFrame.h:

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

  • jsc.cpp:
  • parser/Lexer.h:

(JSC::Keywords::isKeyword):
(JSC::Keywords::getKeyword):

  • runtime/Arguments.cpp:
  • runtime/ArgumentsIteratorConstructor.cpp:
  • runtime/ArgumentsIteratorPrototype.cpp:
  • runtime/ArrayBufferNeuteringWatchpoint.cpp:
  • runtime/ArrayConstructor.cpp:

(JSC::ArrayConstructor::getOwnPropertySlot):

  • runtime/ArrayIteratorConstructor.cpp:
  • runtime/ArrayIteratorPrototype.cpp:
  • runtime/ArrayPrototype.cpp:

(JSC::ArrayPrototype::getOwnPropertySlot):

  • runtime/BooleanConstructor.cpp:
  • runtime/BooleanObject.cpp:
  • runtime/BooleanPrototype.cpp:

(JSC::BooleanPrototype::getOwnPropertySlot):

  • runtime/ClassInfo.h:

(JSC::ClassInfo::hasStaticProperties):
(JSC::ClassInfo::propHashTable): Deleted.

  • runtime/ConsolePrototype.cpp:
  • runtime/CustomGetterSetter.cpp:
  • runtime/DateConstructor.cpp:

(JSC::DateConstructor::getOwnPropertySlot):

  • runtime/DateInstance.cpp:
  • runtime/DatePrototype.cpp:

(JSC::DatePrototype::getOwnPropertySlot):

  • runtime/Error.cpp:
  • runtime/ErrorConstructor.cpp:
  • runtime/ErrorInstance.cpp:
  • runtime/ErrorPrototype.cpp:

(JSC::ErrorPrototype::getOwnPropertySlot):

  • runtime/ExceptionHelpers.cpp:
  • runtime/Executable.cpp:
  • runtime/FunctionConstructor.cpp:
  • runtime/FunctionPrototype.cpp:
  • runtime/GetterSetter.cpp:
  • runtime/InternalFunction.cpp:
  • runtime/JSAPIValueWrapper.cpp:
  • runtime/JSActivation.cpp:
  • runtime/JSArgumentsIterator.cpp:
  • runtime/JSArray.cpp:
  • runtime/JSArrayBuffer.cpp:
  • runtime/JSArrayBufferConstructor.cpp:
  • runtime/JSArrayBufferPrototype.cpp:
  • runtime/JSArrayBufferView.cpp:
  • runtime/JSArrayIterator.cpp:
  • runtime/JSBoundFunction.cpp:
  • runtime/JSConsole.cpp:
  • runtime/JSDataView.cpp:
  • runtime/JSDataViewPrototype.cpp:

(JSC::JSDataViewPrototype::getOwnPropertySlot):

  • runtime/JSFunction.cpp:
  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::getOwnPropertySlot):

  • runtime/JSMap.cpp:
  • runtime/JSMapIterator.cpp:
  • runtime/JSNameScope.cpp:
  • runtime/JSNotAnObject.cpp:
  • runtime/JSONObject.cpp:

(JSC::JSONObject::getOwnPropertySlot):

  • runtime/JSObject.cpp:

(JSC::getClassPropertyNames):
(JSC::JSObject::put):
(JSC::JSObject::deleteProperty):
(JSC::JSObject::findPropertyHashEntry):
(JSC::JSObject::reifyStaticFunctionsForDelete):

  • runtime/JSObject.h:
  • runtime/JSPromise.cpp:
  • runtime/JSPromiseConstructor.cpp:

(JSC::JSPromiseConstructor::getOwnPropertySlot):

  • runtime/JSPromiseDeferred.cpp:
  • runtime/JSPromisePrototype.cpp:

(JSC::JSPromisePrototype::getOwnPropertySlot):

  • runtime/JSPromiseReaction.cpp:
  • runtime/JSPropertyNameIterator.cpp:
  • runtime/JSProxy.cpp:
  • runtime/JSSet.cpp:
  • runtime/JSSetIterator.cpp:
  • runtime/JSString.cpp:
  • runtime/JSTypedArrayConstructors.cpp:
  • runtime/JSTypedArrayPrototypes.cpp:
  • runtime/JSTypedArrays.cpp:
  • runtime/JSVariableObject.cpp:
  • runtime/JSWeakMap.cpp:
  • runtime/JSWithScope.cpp:
  • runtime/Lookup.cpp:

(JSC::HashTable::createTable):

  • runtime/Lookup.h:

(JSC::HashTable::initializeIfNeeded):
(JSC::HashTable::entry):
(JSC::HashTable::begin):
(JSC::HashTable::end):
(JSC::getStaticPropertySlot):
(JSC::getStaticFunctionSlot):
(JSC::getStaticValueSlot):
(JSC::lookupPut):

  • runtime/MapConstructor.cpp:
  • runtime/MapData.cpp:
  • runtime/MapIteratorConstructor.cpp:
  • runtime/MapIteratorPrototype.cpp:
  • runtime/MapPrototype.cpp:
  • runtime/MathObject.cpp:
  • runtime/NameConstructor.cpp:
  • runtime/NameInstance.cpp:
  • runtime/NamePrototype.cpp:

(JSC::NamePrototype::getOwnPropertySlot):

  • runtime/NativeErrorConstructor.cpp:
  • runtime/NumberConstructor.cpp:

(JSC::NumberConstructor::getOwnPropertySlot):

  • runtime/NumberObject.cpp:
  • runtime/NumberPrototype.cpp:

(JSC::NumberPrototype::getOwnPropertySlot):

  • runtime/ObjectConstructor.cpp:

(JSC::ObjectConstructor::getOwnPropertySlot):

  • runtime/ObjectPrototype.cpp:
  • runtime/PropertyTable.cpp:
  • runtime/RegExp.cpp:
  • runtime/RegExpConstructor.cpp:

(JSC::RegExpConstructor::getOwnPropertySlot):

  • runtime/RegExpMatchesArray.cpp:
  • runtime/RegExpObject.cpp:

(JSC::RegExpObject::getOwnPropertySlot):

  • runtime/RegExpPrototype.cpp:

(JSC::RegExpPrototype::getOwnPropertySlot):

  • runtime/SetConstructor.cpp:
  • runtime/SetIteratorConstructor.cpp:
  • runtime/SetIteratorPrototype.cpp:
  • runtime/SetPrototype.cpp:
  • runtime/SparseArrayValueMap.cpp:
  • runtime/StrictEvalActivation.cpp:
  • runtime/StringConstructor.cpp:

(JSC::StringConstructor::getOwnPropertySlot):

  • runtime/StringObject.cpp:
  • runtime/StringPrototype.cpp:
  • runtime/Structure.cpp:

(JSC::Structure::Structure):
(JSC::Structure::freezeTransition):
(JSC::ClassInfo::hasStaticSetterOrReadonlyProperties):

  • runtime/StructureChain.cpp:
  • runtime/StructureRareData.cpp:
  • runtime/SymbolTable.cpp:
  • runtime/VM.cpp:

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

  • runtime/VM.h:
  • runtime/WeakMapConstructor.cpp:
  • runtime/WeakMapData.cpp:
  • runtime/WeakMapPrototype.cpp:
  • testRegExp.cpp:

Source/WebCore:
Update for JSC::ClassInfo changes.

Remove the JSNoStaticTables mode for IDL code generation, which was used to
ensure that each VM had its own unique copy of certain static tables.
This was used for interfaces that could be used in workers, and now there's
no need to manually annotate these things anymore.

Also remove the DOMObjectHashTableMap class that was only used for this.

Reviewed by Geoffrey Garen.

  • Modules/indexeddb/IDBAny.idl:
  • Modules/indexeddb/IDBCursor.idl:
  • Modules/indexeddb/IDBCursorWithValue.idl:
  • Modules/indexeddb/IDBDatabase.idl:
  • Modules/indexeddb/IDBFactory.idl:
  • Modules/indexeddb/IDBIndex.idl:
  • Modules/indexeddb/IDBKeyRange.idl:
  • Modules/indexeddb/IDBObjectStore.idl:
  • Modules/indexeddb/IDBOpenDBRequest.idl:
  • Modules/indexeddb/IDBRequest.idl:
  • Modules/indexeddb/IDBTransaction.idl:
  • Modules/indexeddb/IDBVersionChangeEvent.idl:
  • Modules/webdatabase/Database.idl:
  • Modules/webdatabase/DatabaseSync.idl:
  • Modules/webdatabase/SQLError.idl:
  • Modules/webdatabase/SQLException.idl:
  • Modules/webdatabase/SQLResultSet.idl:
  • Modules/webdatabase/SQLResultSetRowList.idl:
  • Modules/webdatabase/SQLTransaction.idl:
  • Modules/webdatabase/SQLTransactionSync.idl:
  • Modules/websockets/CloseEvent.idl:
  • Modules/websockets/WebSocket.idl:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/DOMObjectHashTableMap.cpp: Removed.
  • bindings/js/DOMObjectHashTableMap.h: Removed.
  • bindings/js/JSDOMBinding.cpp:

(WebCore::getHashTableForGlobalData): Deleted.

  • bindings/js/JSDOMBinding.h:

(WebCore::getStaticValueSlotEntryWithoutCaching):

  • bindings/js/JSDOMGlobalObject.cpp:
  • bindings/js/JSDOMWindowBase.cpp:
  • bindings/js/JSDOMWindowCustom.cpp:

(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::put):

  • bindings/js/JSDOMWindowShell.cpp:
  • bindings/js/JSImageConstructor.cpp:
  • bindings/js/JSLocationCustom.cpp:

(WebCore::JSLocation::putDelegate):

  • bindings/js/JSStorageCustom.cpp:

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

  • bindings/js/JSWorkerGlobalScopeBase.cpp:
  • bindings/js/WebCoreJSClientData.h:
  • bindings/scripts/CodeGeneratorJS.pm:

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

  • bindings/scripts/IDLAttributes.txt:
  • bridge/c/CRuntimeObject.cpp:
  • bridge/c/c_instance.cpp:
  • bridge/objc/ObjCRuntimeObject.mm:
  • bridge/objc/objc_instance.mm:
  • bridge/objc/objc_runtime.mm:
  • bridge/runtime_array.cpp:
  • bridge/runtime_method.cpp:
  • bridge/runtime_object.cpp:
  • crypto/CryptoKey.idl:
  • css/CSSFontFaceLoadEvent.idl:
  • dom/DOMCoreException.idl:
  • dom/DOMStringList.idl:
  • dom/ErrorEvent.idl:
  • dom/Event.idl:
  • dom/EventException.idl:
  • dom/EventListener.idl:
  • dom/MessageChannel.idl:
  • dom/MessageEvent.idl:
  • dom/MessagePort.idl:
  • dom/ProgressEvent.idl:
  • fileapi/Blob.idl:
  • fileapi/File.idl:
  • fileapi/FileError.idl:
  • fileapi/FileException.idl:
  • fileapi/FileList.idl:
  • fileapi/FileReader.idl:
  • fileapi/FileReaderSync.idl:
  • html/DOMURL.idl:
  • page/EventSource.idl:
  • page/WorkerNavigator.idl:
  • workers/DedicatedWorkerGlobalScope.idl:
  • workers/SharedWorkerGlobalScope.idl:
  • workers/WorkerGlobalScope.idl:
  • workers/WorkerLocation.idl:
  • xml/XMLHttpRequest.idl:
  • xml/XMLHttpRequestException.idl:
  • xml/XMLHttpRequestProgressEvent.idl:
  • xml/XMLHttpRequestUpload.idl:

Source/WebKit/mac:
Reviewed by Geoffrey Garen.

  • Plugins/Hosted/ProxyInstance.mm:
  • Plugins/Hosted/ProxyRuntimeObject.mm:

Source/WebKit2:
Reviewed by Geoffrey Garen.

  • WebProcess/Plugins/Netscape/JSNPMethod.cpp:
  • WebProcess/Plugins/Netscape/JSNPObject.cpp:
File:
1 edited

Legend:

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

    r171660 r171824  
    110110namespace JSC {
    111111
    112 extern const HashTable arrayConstructorTable;
    113 extern const HashTable arrayPrototypeTable;
    114 extern const HashTable booleanPrototypeTable;
    115 extern const HashTable jsonTable;
    116 extern const HashTable dataViewTable;
    117 extern const HashTable dateTable;
    118 extern const HashTable dateConstructorTable;
    119 extern const HashTable errorPrototypeTable;
    120 extern const HashTable globalObjectTable;
    121 extern const HashTable numberConstructorTable;
    122 extern const HashTable numberPrototypeTable;
    123 JS_EXPORTDATA extern const HashTable objectConstructorTable;
    124 extern const HashTable privateNamePrototypeTable;
    125 extern const HashTable regExpTable;
    126 extern const HashTable regExpConstructorTable;
    127 extern const HashTable regExpPrototypeTable;
    128 extern const HashTable stringConstructorTable;
    129 #if ENABLE(PROMISES)
    130 extern const HashTable promisePrototypeTable;
    131 extern const HashTable promiseConstructorTable;
    132 #endif
    133 
    134112// Note: Platform.h will enforce that ENABLE(ASSEMBLER) is true if either
    135113// ENABLE(JIT) or ENABLE(YARR_JIT) or both are enabled. The code below
     
    173151    , clientData(0)
    174152    , topCallFrame(CallFrame::noCaller())
    175     , arrayConstructorTable(adoptPtr(new HashTable(JSC::arrayConstructorTable)))
    176     , arrayPrototypeTable(adoptPtr(new HashTable(JSC::arrayPrototypeTable)))
    177     , booleanPrototypeTable(adoptPtr(new HashTable(JSC::booleanPrototypeTable)))
    178     , dataViewTable(adoptPtr(new HashTable(JSC::dataViewTable)))
    179     , dateTable(adoptPtr(new HashTable(JSC::dateTable)))
    180     , dateConstructorTable(adoptPtr(new HashTable(JSC::dateConstructorTable)))
    181     , errorPrototypeTable(adoptPtr(new HashTable(JSC::errorPrototypeTable)))
    182     , globalObjectTable(adoptPtr(new HashTable(JSC::globalObjectTable)))
    183     , jsonTable(adoptPtr(new HashTable(JSC::jsonTable)))
    184     , numberConstructorTable(adoptPtr(new HashTable(JSC::numberConstructorTable)))
    185     , numberPrototypeTable(adoptPtr(new HashTable(JSC::numberPrototypeTable)))
    186     , objectConstructorTable(adoptPtr(new HashTable(JSC::objectConstructorTable)))
    187     , privateNamePrototypeTable(adoptPtr(new HashTable(JSC::privateNamePrototypeTable)))
    188     , regExpTable(adoptPtr(new HashTable(JSC::regExpTable)))
    189     , regExpConstructorTable(adoptPtr(new HashTable(JSC::regExpConstructorTable)))
    190     , regExpPrototypeTable(adoptPtr(new HashTable(JSC::regExpPrototypeTable)))
    191     , stringConstructorTable(adoptPtr(new HashTable(JSC::stringConstructorTable)))
    192 #if ENABLE(PROMISES)
    193     , promisePrototypeTable(adoptPtr(new HashTable(JSC::promisePrototypeTable)))
    194     , promiseConstructorTable(adoptPtr(new HashTable(JSC::promiseConstructorTable)))
    195 #endif
    196153    , m_atomicStringTable(vmType == Default ? wtfThreadData().atomicStringTable() : new AtomicStringTable)
    197154    , propertyNames(nullptr)
     
    362319#endif
    363320
    364     arrayPrototypeTable->deleteTable();
    365     arrayConstructorTable->deleteTable();
    366     booleanPrototypeTable->deleteTable();
    367     dataViewTable->deleteTable();
    368     dateTable->deleteTable();
    369     dateConstructorTable->deleteTable();
    370     errorPrototypeTable->deleteTable();
    371     globalObjectTable->deleteTable();
    372     jsonTable->deleteTable();
    373     numberConstructorTable->deleteTable();
    374     numberPrototypeTable->deleteTable();
    375     objectConstructorTable->deleteTable();
    376     privateNamePrototypeTable->deleteTable();
    377     regExpTable->deleteTable();
    378     regExpConstructorTable->deleteTable();
    379     regExpPrototypeTable->deleteTable();
    380     stringConstructorTable->deleteTable();
    381 #if ENABLE(PROMISES)
    382     promisePrototypeTable->deleteTable();
    383     promiseConstructorTable->deleteTable();
    384 #endif
    385 
    386321    delete emptyList;
    387322
Note: See TracChangeset for help on using the changeset viewer.