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/ClassInfo.h

    r166837 r171824  
    155155    const ClassInfo* parentClass;
    156156
    157     // Static hash-table of properties.
    158     // For classes that can be used from multiple threads, it is accessed via a getter function
    159     // that would typically return a pointer to a thread-specific value.
    160     const HashTable* propHashTable(ExecState* exec) const
    161     {
    162         if (classPropHashTableGetterFunction)
    163             return &classPropHashTableGetterFunction(exec->vm());
    164 
    165         return staticPropHashTable;
    166     }
    167 
    168     const HashTable* propHashTable(VM& vm) const
    169     {
    170         if (classPropHashTableGetterFunction)
    171             return &classPropHashTableGetterFunction(vm);
    172 
    173         return staticPropHashTable;
    174     }
    175 
    176157    bool isSubClassOf(const ClassInfo* other) const
    177158    {
     
    186167    {
    187168        for (const ClassInfo* ci = this; ci; ci = ci->parentClass) {
    188             if (ci->staticPropHashTable || ci->classPropHashTableGetterFunction)
     169            if (ci->staticPropHashTable)
    189170                return true;
    190171        }
     
    192173    }
    193174
    194     bool hasStaticSetterOrReadonlyProperties(VM&) const;
     175    bool hasStaticSetterOrReadonlyProperties() const;
    195176
    196177    const HashTable* staticPropHashTable;
    197     typedef const HashTable& (*ClassPropHashTableGetterFunction)(VM&);
    198     const ClassPropHashTableGetterFunction classPropHashTableGetterFunction;
    199178
    200179    MethodTable methodTable;
Note: See TracChangeset for help on using the changeset viewer.