Ignore:
Timestamp:
Apr 26, 2010, 9:22:46 PM (15 years ago)
Author:
[email protected]
Message:

2010-04-26 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Need to support more efficient dispatch of lightweight builtins
https://bugs.webkit.org/show_bug.cgi?id=38155

The problem with calling lightweight builtins is that marshalling
the call from the nitro calling convention to the system calling
convention is very expensive relative to the cost of the actually
evaluating the function. To work around this problem this patch
adds the ability to define a custom thunk for a builtin.

This allows us to use high performance custom implementations of
the common and sensible versions of simple builtins. This patch
includes a simple (use of which is currently hardcoded) thunk for
charCodeAt.

This adds a JSInterfaceJIT subclass called SpecializedThunkJIT
that has helper functions to remove (or at least reduce) the need
to have separate thunk implementations for each JSValue encoding.

  • create_hash_table: Add thunk generation callbacks to the hash tables, currently we hardcode the script to only support charCodeAt
  • jit/JITStubCall.h:
  • jit/JITStubs.cpp: (JSC::JITThunks::~JITThunks): (JSC::JITThunks::specializedThunk):
  • jit/JITStubs.h:
  • jit/SpecializedThunkJIT.h: Added. (JSC::SpecializedThunkJIT::SpecializedThunkJIT): (JSC::SpecializedThunkJIT::loadCellArgument): (JSC::SpecializedThunkJIT::loadJSStringArgument): (JSC::SpecializedThunkJIT::loadInt32Argument): (JSC::SpecializedThunkJIT::appendFailure): (JSC::SpecializedThunkJIT::returnInt32): (JSC::SpecializedThunkJIT::finalize): (JSC::SpecializedThunkJIT::argumentToVirtualRegister): (JSC::SpecializedThunkJIT::tagReturnAsInt32):
  • jit/ThunkGenerators.cpp: Added. (JSC::ThunkHelpers::stringImplDataOffset): (JSC::ThunkHelpers::jsStringLengthOffset): (JSC::ThunkHelpers::jsStringValueOffset): (JSC::charCodeAtThunkGenerator):
  • jit/ThunkGenerators.h: Added.
  • runtime/Executable.h: (JSC::NativeExecutable::NativeExecutable):
  • runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction):
  • runtime/JSFunction.h:
  • runtime/JSGlobalData.h: (JSC::JSGlobalData::getThunk):
  • runtime/JSString.h: (JSC::):
  • runtime/JSValue.h: Protect some of the JSVALUE32 and JSVALUE32_64 only constants and function behind appropriate USE() guards to make it harder to use the wrong flags for the target build.
  • runtime/Lookup.cpp: (JSC::HashTable::createTable): (JSC::setUpStaticFunctionSlot):
  • runtime/Lookup.h: (JSC::HashEntry::initialize): (JSC::HashEntry::generator): (JSC::HashEntry::): Make the lookup tables use a specialized thunkGenerator if present
  • wtf/text/StringImpl.h:

2010-04-26 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

Need to support more efficient dispatch of lightweight builtins
https://bugs.webkit.org/show_bug.cgi?id=38155

Update bindings generation to include new thunk generator field
in the property map hash tables.

  • bindings/scripts/CodeGeneratorJS.pm:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r58283 r58286  
    292292                A727FF6B0DA3092200E548D7 /* JSPropertyNameIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */; };
    293293                A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A79EDB0811531CD60019E912 /* JSObjectRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    294                 A73161FE118692FF00BB280D /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A73161FD118692FF00BB280D /* JSInterfaceJIT.h */; };
     294                A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386551118697B400540279 /* SpecializedThunkJIT.h */; };
     295                A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7386552118697B400540279 /* ThunkGenerators.cpp */; };
     296                A7386556118697B400540279 /* ThunkGenerators.h in Headers */ = {isa = PBXBuildFile; fileRef = A7386553118697B400540279 /* ThunkGenerators.h */; settings = {ATTRIBUTES = (Private, ); }; };
    295297                A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
    296298                A7482B9411671147003B0712 /* JSWeakObjectMapRefPrivate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */; };
     
    298300                A74B3499102A5F8E0032AB98 /* MarkStack.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A74B3498102A5F8E0032AB98 /* MarkStack.cpp */; };
    299301                A766B44F0EE8DCD1009518CA /* ExecutableAllocator.h in Headers */ = {isa = PBXBuildFile; fileRef = A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */; settings = {ATTRIBUTES = (Private, ); }; };
     302                A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */ = {isa = PBXBuildFile; fileRef = A76C51741182748D00715B05 /* JSInterfaceJIT.h */; };
    300303                A76EE6590FAE59D5003F069A /* NativeFunctionWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; };
    301304                A7795590101A74D500114E55 /* MarkStack.h in Headers */ = {isa = PBXBuildFile; fileRef = A779558F101A74D500114E55 /* MarkStack.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    873876                A727FF650DA3053B00E548D7 /* JSPropertyNameIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSPropertyNameIterator.h; sourceTree = "<group>"; };
    874877                A727FF660DA3053B00E548D7 /* JSPropertyNameIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSPropertyNameIterator.cpp; sourceTree = "<group>"; };
    875                 A73161FD118692FF00BB280D /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; };
     878                A7386551118697B400540279 /* SpecializedThunkJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecializedThunkJIT.h; sourceTree = "<group>"; };
     879                A7386552118697B400540279 /* ThunkGenerators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThunkGenerators.cpp; sourceTree = "<group>"; };
     880                A7386553118697B400540279 /* ThunkGenerators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThunkGenerators.h; sourceTree = "<group>"; };
    876881                A7482B791166CDEA003B0712 /* JSWeakObjectMapRefPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefPrivate.h; sourceTree = "<group>"; };
    877882                A7482B7A1166CDEA003B0712 /* JSWeakObjectMapRefPrivate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakObjectMapRefPrivate.cpp; sourceTree = "<group>"; };
    878883                A7482E37116A697B003B0712 /* JSWeakObjectMapRefInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakObjectMapRefInternal.h; sourceTree = "<group>"; };
    879884                A74B3498102A5F8E0032AB98 /* MarkStack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MarkStack.cpp; sourceTree = "<group>"; };
     885                A76C51741182748D00715B05 /* JSInterfaceJIT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSInterfaceJIT.h; sourceTree = "<group>"; };
    880886                A76EE6580FAE59D5003F069A /* NativeFunctionWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NativeFunctionWrapper.h; sourceTree = "<group>"; };
    881887                A779558F101A74D500114E55 /* MarkStack.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkStack.h; sourceTree = "<group>"; };
     
    12071213                        isa = PBXGroup;
    12081214                        children = (
     1215                                A7386551118697B400540279 /* SpecializedThunkJIT.h */,
     1216                                A7386552118697B400540279 /* ThunkGenerators.cpp */,
     1217                                A7386553118697B400540279 /* ThunkGenerators.h */,
    12091218                                A7B48DB60EE74CFC00DCBDB6 /* ExecutableAllocator.cpp */,
    12101219                                A7B48DB50EE74CFC00DCBDB6 /* ExecutableAllocator.h */,
     
    12241233                                14A23D6C0F4E19CE0023CDAD /* JITStubs.cpp */,
    12251234                                14A6581A0F4E36F4000150FD /* JITStubs.h */,
    1226                                 A73161FD118692FF00BB280D /* JSInterfaceJIT.h */,
     1235                                A76C51741182748D00715B05 /* JSInterfaceJIT.h */,
    12271236                        );
    12281237                        path = jit;
     
    21162125                                BC5F7BBF11823B590052C02C /* ThreadingPrimitives.h in Headers */,
    21172126                                BC5F7BC011823B590052C02C /* ThreadSafeShared.h in Headers */,
    2118                                 A73161FE118692FF00BB280D /* JSInterfaceJIT.h in Headers */,
     2127                                A76C51761182748D00715B05 /* JSInterfaceJIT.h in Headers */,
     2128                                A7386554118697B400540279 /* SpecializedThunkJIT.h in Headers */,
     2129                                A7386556118697B400540279 /* ThunkGenerators.h in Headers */,
    21192130                        );
    21202131                        runOnlyForDeploymentPostprocessing = 0;
     
    25652576                                86B99AB8117E391E00DF5A90 /* RopeImpl.cpp in Sources */,
    25662577                                511FC4C9117EE28700425272 /* MD5.cpp in Sources */,
     2578                                A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */,
    25672579                        );
    25682580                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.