Changeset 58286 in webkit for trunk/JavaScriptCore


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:
Location:
trunk/JavaScriptCore
Files:
3 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r58284 r58286  
     12010-04-26  Oliver Hunt  <[email protected]>
     2
     3        Reviewed by Gavin Barraclough.
     4
     5        Need to support more efficient dispatch of lightweight builtins
     6        https://bugs.webkit.org/show_bug.cgi?id=38155
     7
     8        The problem with calling lightweight builtins is that marshalling
     9        the call from the nitro calling convention to the system calling
     10        convention is very expensive relative to the cost of the actually
     11        evaluating the function.  To work around this problem this patch
     12        adds the ability to define a custom thunk for a builtin.
     13
     14        This allows us to use high performance custom implementations of
     15        the common and sensible versions of simple builtins.  This patch
     16        includes a simple (use of which is currently hardcoded) thunk for
     17        charCodeAt.
     18
     19        This adds a JSInterfaceJIT subclass called SpecializedThunkJIT
     20        that has helper functions to remove (or at least reduce) the need
     21        to have separate thunk implementations for each JSValue encoding.
     22
     23        * GNUmakefile.am:
     24        * JavaScriptCore.pro:
     25        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
     26        * JavaScriptCore.xcodeproj/project.pbxproj:
     27          Many project file updates
     28
     29        * create_hash_table:
     30          Add thunk generation callbacks to the hash tables, currently
     31          we hardcode the script to only support charCodeAt
     32
     33        * jit/JITStubCall.h:
     34        * jit/JITStubs.cpp:
     35        (JSC::JITThunks::~JITThunks):
     36        (JSC::JITThunks::specializedThunk):
     37        * jit/JITStubs.h:
     38        * jit/SpecializedThunkJIT.h: Added.
     39        (JSC::SpecializedThunkJIT::SpecializedThunkJIT):
     40        (JSC::SpecializedThunkJIT::loadCellArgument):
     41        (JSC::SpecializedThunkJIT::loadJSStringArgument):
     42        (JSC::SpecializedThunkJIT::loadInt32Argument):
     43        (JSC::SpecializedThunkJIT::appendFailure):
     44        (JSC::SpecializedThunkJIT::returnInt32):
     45        (JSC::SpecializedThunkJIT::finalize):
     46        (JSC::SpecializedThunkJIT::argumentToVirtualRegister):
     47        (JSC::SpecializedThunkJIT::tagReturnAsInt32):
     48        * jit/ThunkGenerators.cpp: Added.
     49        (JSC::ThunkHelpers::stringImplDataOffset):
     50        (JSC::ThunkHelpers::jsStringLengthOffset):
     51        (JSC::ThunkHelpers::jsStringValueOffset):
     52        (JSC::charCodeAtThunkGenerator):
     53        * jit/ThunkGenerators.h: Added.
     54        * runtime/Executable.h:
     55        (JSC::NativeExecutable::NativeExecutable):
     56        * runtime/JSFunction.cpp:
     57        (JSC::JSFunction::JSFunction):
     58        * runtime/JSFunction.h:
     59        * runtime/JSGlobalData.h:
     60        (JSC::JSGlobalData::getThunk):
     61        * runtime/JSString.h:
     62        (JSC::):
     63        * runtime/JSValue.h:
     64          Protect some of the JSVALUE32 and JSVALUE32_64 only constants
     65          and function behind appropriate USE() guards to make it harder
     66          to use the wrong flags for the target build.
     67        * runtime/Lookup.cpp:
     68        (JSC::HashTable::createTable):
     69        (JSC::setUpStaticFunctionSlot):
     70        * runtime/Lookup.h:
     71        (JSC::HashEntry::initialize):
     72        (JSC::HashEntry::generator):
     73        (JSC::HashEntry::):
     74          Make the lookup tables use a specialized thunkGenerator
     75          if present
     76        * wtf/text/StringImpl.h:
     77
    1782010-04-26  Oliver Hunt  <[email protected]>
    279
  • trunk/JavaScriptCore/GNUmakefile.am

    r58206 r58286  
    9696        JavaScriptCore/jit/JITStubs.h \
    9797        JavaScriptCore/jit/JITStubCall.h \
     98        JavaScriptCore/jit/JSInterfaceJIT.h \
     99        JavaScriptCore/jit/SpecializedThunkJIT.h \
     100        JavaScriptCore/jit/ThunkGenerators.cpp \
     101        JavaScriptCore/jit/ThunkGenerators.h \
    98102        JavaScriptCore/bytecode/StructureStubInfo.cpp \
    99103        JavaScriptCore/bytecode/StructureStubInfo.h \
  • trunk/JavaScriptCore/JavaScriptCore.pro

    r58136 r58286  
    104104    jit/JITPropertyAccess32_64.cpp \
    105105    jit/JITStubs.cpp \
     106    jit/ThunkGenerators.cpp \
    106107    parser/Lexer.cpp \
    107108    parser/Nodes.cpp \
  • trunk/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj

    r58003 r58286  
    17031703                        <File
    17041704                                RelativePath="..\..\jit\JITStubs.h"
     1705                                >
     1706                        </File>
     1707                        <File
     1708                                RelativePath="..\..\jit\JSInterfaceJIT.h"
     1709                                >
     1710                        </File>
     1711                        <File
     1712                                RelativePath="..\..\jit\SpecializedThunkJIT.h"
     1713                                >
     1714                        </File>
     1715                        <File
     1716                                RelativePath="..\..\jit\ThunkGenerators.cpp"
     1717                                >
     1718                        </File>
     1719                        <File
     1720                                RelativePath="..\..\jit\ThunkGenerators.h"
    17051721                                >
    17061722                        </File>
  • 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;
  • trunk/JavaScriptCore/create_hash_table

    r55311 r58286  
    248248    }
    249249    my $count = scalar @keys + 1;
     250    print "#if ENABLE(JIT)\n";
     251    print "#define THUNK_GENERATOR(generator) , generator\n";
     252    print "#else\n";
     253    print "#define THUNK_GENERATOR(generator)\n";
     254    print "#endif\n";
    250255    print "\nstatic const struct HashTableValue ${nameEntries}\[$count\] = {\n";
    251256    my $i = 0;
     
    267272            $secondValue = "0";
    268273        }
    269         print "   { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue },\n";
     274        my $thunkGenerator = "0";
     275        if ($key eq "charCodeAt") {
     276            $thunkGenerator = "charCodeAtThunkGenerator";
     277        }
     278        print "   { \"$key\", $attrs[$i], (intptr_t)" . $castStr . "($firstValue), (intptr_t)$secondValue THUNK_GENERATOR($thunkGenerator) },\n";
    270279        $i++;
    271280    }
    272     print "   { 0, 0, 0, 0 }\n";
     281    print "   { 0, 0, 0, 0 THUNK_GENERATOR(0) }\n";
    273282    print "};\n\n";
     283    print "#undef THUNK_GENERATOR\n";
    274284    print "extern JSC_CONST_HASHTABLE HashTable $name =\n";
    275285    print "    \{ $compactSize, $compactHashSizeMask, $nameEntries, 0 \};\n";
  • trunk/JavaScriptCore/jit/JITStubCall.h

    r50594 r58286  
    117117            m_stackIndex += stackIndexStep;
    118118        }
    119 
     119       
     120#if USE(JSVALUE32_64)
    120121        void addArgument(const JSValue& value)
    121122        {
     
    124125            m_stackIndex += stackIndexStep;
    125126        }
     127#endif
    126128
    127129        void addArgument(JIT::RegisterID tag, JIT::RegisterID payload)
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r58167 r58286  
    837837
    838838#endif
     839}
     840
     841JITThunks::~JITThunks()
     842{
    839843}
    840844
     
    33043308}
    33053309
     3310NativeExecutable* JITThunks::specializedThunk(JSGlobalData* globalData, ThunkGenerator generator)
     3311{
     3312    std::pair<ThunkMap::iterator, bool> entry = m_thunkMap.add(generator, 0);
     3313    if (!entry.second)
     3314        return entry.first->second.get();
     3315    entry.first->second = generator(globalData, m_executablePool.get());
     3316    return entry.first->second.get();
     3317}
     3318
    33063319} // namespace JSC
    33073320
  • trunk/JavaScriptCore/jit/JITStubs.h

    r57955 r58286  
    3232#include "MacroAssemblerCodeRef.h"
    3333#include "Register.h"
     34#include "ThunkGenerators.h"
     35#include <wtf/HashMap.h>
    3436
    3537#if ENABLE(JIT)
     
    4446    class Identifier;
    4547    class JSGlobalData;
    46     class JSGlobalData;
     48    class JSGlobalObject;
    4749    class JSObject;
    4850    class JSPropertyNameIterator;
    4951    class JSValue;
    5052    class JSValueEncodedAsPointer;
     53    class NativeExecutable;
    5154    class Profiler;
    5255    class PropertySlot;
    5356    class PutPropertySlot;
    5457    class RegisterFile;
    55     class JSGlobalObject;
    5658    class RegExp;
    5759
     
    266268    public:
    267269        JITThunks(JSGlobalData*);
     270        ~JITThunks();
    268271
    269272        static void tryCacheGetByID(CallFrame*, CodeBlock*, ReturnAddressPtr returnAddress, JSValue baseValue, const Identifier& propertyName, const PropertySlot&, StructureStubInfo* stubInfo);
     
    276279        MacroAssemblerCodePtr ctiSoftModulo() { return m_trampolineStructure.ctiSoftModulo; }
    277280
     281        NativeExecutable* specializedThunk(JSGlobalData* globalData, ThunkGenerator generator);
    278282    private:
     283        typedef HashMap<ThunkGenerator, RefPtr<NativeExecutable> > ThunkMap;
     284        ThunkMap m_thunkMap;
    279285        RefPtr<ExecutablePool> m_executablePool;
    280286
  • trunk/JavaScriptCore/runtime/Executable.h

    r48905 r58286  
    8888            m_jitCode = JITCode(JITCode::HostFunction(exec->globalData().jitStubs.ctiNativeCallThunk()));
    8989        }
     90        NativeExecutable(JITCode thunk)
     91            : ExecutableBase(NUM_PARAMETERS_IS_HOST)
     92        {
     93            m_jitCode = thunk;
     94        }
    9095
    9196        ~NativeExecutable();
  • trunk/JavaScriptCore/runtime/JSFunction.cpp

    r55564 r58286  
    5757}
    5858
     59JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeExecutable* thunk, NativeFunction func)
     60    : Base(&exec->globalData(), structure, name)
     61#if ENABLE(JIT)
     62    , m_executable(thunk)
     63#endif
     64{
     65#if ENABLE(JIT)
     66    setNativeFunction(func);
     67    putDirect(exec->propertyNames().length, jsNumber(exec, length), DontDelete | ReadOnly | DontEnum);
     68#else
     69    UNUSED_PARAM(thunk);
     70    UNUSED_PARAM(length);
     71    UNUSED_PARAM(func);
     72    ASSERT_NOT_REACHED();
     73#endif
     74}
     75
    5976JSFunction::JSFunction(ExecState* exec, NonNullPassRefPtr<Structure> structure, int length, const Identifier& name, NativeFunction func)
    6077    : Base(&exec->globalData(), structure, name)
  • trunk/JavaScriptCore/runtime/JSFunction.h

    r56085 r58286  
    3434    class JSActivation;
    3535    class JSGlobalObject;
     36    class NativeExecutable;
    3637
    3738    class JSFunction : public InternalFunction {
     
    4344    public:
    4445        JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeFunction);
     46        JSFunction(ExecState*, NonNullPassRefPtr<Structure>, int length, const Identifier&, NativeExecutable*, NativeFunction);
    4547        JSFunction(ExecState*, NonNullPassRefPtr<FunctionExecutable>, ScopeChainNode*);
    4648        virtual ~JSFunction();
  • trunk/JavaScriptCore/runtime/JSGlobalData.h

    r58133 r58286  
    172172#if ENABLE(JIT)
    173173        JITThunks jitStubs;
     174        NativeExecutable* getThunk(ThunkGenerator generator)
     175        {
     176            return jitStubs.specializedThunk(this, generator);
     177        }
    174178#endif
    175179        TimeoutChecker timeoutChecker;
     
    221225        void createNativeThunk();
    222226    };
    223    
     227
    224228} // namespace JSC
    225229
  • trunk/JavaScriptCore/runtime/JSImmediate.h

    r58284 r58286  
    138138        friend class JSFastMath;
    139139        friend class JSInterfaceJIT;
     140        friend class SpecializedThunkJIT;
    140141        friend JSValue jsNumber(ExecState* exec, double d);
    141142        friend JSValue jsNumber(ExecState*, char i);
     
    166167        // with a 16-bit pattern within the range 0x0001..0xFFFE.
    167168        static const intptr_t DoubleEncodeOffset = 0x1000000000000ll;
    168 #else
     169#elif USE(JSVALUE32)
    169170        static const intptr_t TagTypeNumber = 0x1; // bottom bit set indicates integer, this dominates the following bit
    170171#endif
  • trunk/JavaScriptCore/runtime/JSString.h

    r57912 r58286  
    6767        friend class JIT;
    6868        friend class JSGlobalData;
     69        friend class SpecializedThunkJIT;
     70        friend struct ThunkHelpers;
    6971
    7072        class RopeBuilder {
  • trunk/JavaScriptCore/runtime/JSValue.h

    r58284 r58286  
    6868        friend class JITStubCall;
    6969        friend class JSInterfaceJIT;
     70        friend class SpecializedThunkJIT;
    7071
    7172    public:
     
    216217        JSObject* toThisObjectSlowCase(ExecState*) const;
    217218
     219        JSObject* synthesizePrototype(ExecState*) const;
     220        JSObject* synthesizeObject(ExecState*) const;
     221
     222#if USE(JSVALUE32_64)
    218223        enum { Int32Tag =        0xffffffff };
    219224        enum { CellTag =         0xfffffffe };
     
    224229        enum { EmptyValueTag =   0xfffffff9 };
    225230        enum { DeletedValueTag = 0xfffffff8 };
    226 
     231       
    227232        enum { LowestTag =  DeletedValueTag };
    228 
     233       
    229234        uint32_t tag() const;
    230235        int32_t payload() const;
    231236
    232         JSObject* synthesizePrototype(ExecState*) const;
    233         JSObject* synthesizeObject(ExecState*) const;
    234 
    235 #if USE(JSVALUE32_64)
    236237        union {
    237238            EncodedJSValue asEncodedJSValue;
  • trunk/JavaScriptCore/runtime/Lookup.cpp

    r53320 r58286  
    4747        }
    4848
    49         entry->initialize(identifier, values[i].attributes, values[i].value1, values[i].value2);
     49        entry->initialize(identifier, values[i].attributes, values[i].value1, values[i].value2
     50#if ENABLE(JIT)
     51                          , values[i].generator
     52#endif
     53                          );
    5054    }
    5155    table = entries;
     
    7175
    7276    if (!location) {
    73         InternalFunction* function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function());
     77        InternalFunction* function;
     78#if ENABLE(JIT)
     79        if (entry->generator())
     80            function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, exec->globalData().getThunk(entry->generator()), entry->function());
     81        else
     82#endif
     83            function = new (exec) NativeFunctionWrapper(exec, exec->lexicalGlobalObject()->prototypeFunctionStructure(), entry->functionLength(), propertyName, entry->function());
    7484
    7585        thisObj->putDirectFunction(propertyName, function, entry->attributes());
  • trunk/JavaScriptCore/runtime/Lookup.h

    r55564 r58286  
    3838
    3939namespace JSC {
    40 
    4140    // Hash table generated by the create_hash_table script.
    4241    struct HashTableValue {
     
    4544        intptr_t value1;
    4645        intptr_t value2;
     46#if ENABLE(JIT)
     47        ThunkGenerator generator;
     48#endif
    4749    };
    4850
     
    5456    class HashEntry : public FastAllocBase {
    5557    public:
    56         void initialize(UString::Rep* key, unsigned char attributes, intptr_t v1, intptr_t v2)
     58        void initialize(UString::Rep* key, unsigned char attributes, intptr_t v1, intptr_t v2
     59#if ENABLE(JIT)
     60                        , ThunkGenerator generator = 0
     61#endif
     62                        )
    5763        {
    5864            m_key = key;
     
    6066            m_u.store.value1 = v1;
    6167            m_u.store.value2 = v2;
     68#if ENABLE(JIT)
     69            m_u.function.generator = generator;
     70#endif
    6271            m_next = 0;
    6372        }
     
    6877        unsigned char attributes() const { return m_attributes; }
    6978
     79#if ENABLE(JIT)
     80        ThunkGenerator generator() const { ASSERT(m_attributes & Function); return m_u.function.generator; }
     81#endif
    7082        NativeFunction function() const { ASSERT(m_attributes & Function); return m_u.function.functionValue; }
    7183        unsigned char functionLength() const { ASSERT(m_attributes & Function); return static_cast<unsigned char>(m_u.function.length); }
     
    91103                NativeFunction functionValue;
    92104                intptr_t length; // number of arguments for function
     105#if ENABLE(JIT)
     106                ThunkGenerator generator;
     107#endif
    93108            } function;
    94109            struct {
  • trunk/JavaScriptCore/wtf/text/StringImpl.h

    r58114 r58286  
    2828#include <wtf/CrossThreadRefCounted.h>
    2929#include <wtf/OwnFastMallocPtr.h>
     30#include <wtf/StdLibExtras.h>
    3031#include <wtf/StringHashFunctions.h>
    3132#include <wtf/Vector.h>
     
    175176    }
    176177
     178    static unsigned dataOffset() { return OBJECT_OFFSETOF(StringImpl, m_data); }
    177179    static PassRefPtr<StringImpl> createWithTerminatingNullCharacter(const StringImpl&);
    178180    static PassRefPtr<StringImpl> createStrippingNullCharacters(const UChar*, unsigned length);
     
    321323    BufferOwnership bufferOwnership() const { return static_cast<BufferOwnership>(m_refCountAndFlags & s_refCountMaskBufferOwnership); }
    322324    bool isStatic() const { return m_refCountAndFlags & s_refCountFlagStatic; }
    323 
    324325    const UChar* m_data;
    325326    union {
Note: See TracChangeset for help on using the changeset viewer.