Ignore:
Timestamp:
Nov 25, 2008, 3:07:30 PM (17 years ago)
Author:
[email protected]
Message:

2008-11-24 Gavin Barraclough <[email protected]>

Reviewed by Geoff Garen.

Polymorpic caching for get by id chain. Similar to the polymorphic caching already implemented
for self and proto accesses (implemented by allowing multiple trampolines to be JIT genertaed,
and linked together) - the get by id chain caching is implemented as a genericization of the
proto list caching, allowing cached access lists to contain a mix of proto and proto chain
accesses (since in JS style inheritance hierarchies you may commonly see a mix of properties
being overridden on the direct prototype, or higher up its prototype chain).

In order to allow this patch to compile there is a fix to appease gcc 4.2 compiler issues
(removing the jumps between fall-through cases in privateExecute).


This patch also removes redundant immediate checking from the reptach code, and fixes a related
memory leak (failure to deallocate trampolines).

~2% progression on v8 tests (bulk on the win on deltablue)

  • bytecode/Instruction.h: (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::): (JSC::PolymorphicAccessStructureList::PolymorphicStubInfo::set): (JSC::PolymorphicAccessStructureList::PolymorphicAccessStructureList): (JSC::PolymorphicAccessStructureList::derefStructures):
  • interpreter/Interpreter.cpp: (JSC::countPrototypeChainEntriesAndCheckForProxies): (JSC::Interpreter::tryCacheGetByID): (JSC::Interpreter::privateExecute): (JSC::Interpreter::tryCTICacheGetByID): (JSC::Interpreter::cti_op_get_by_id_self_fail): (JSC::getPolymorphicAccessStructureListSlot): (JSC::Interpreter::cti_op_get_by_id_proto_list):
  • interpreter/Interpreter.h:
  • jit/JIT.cpp: (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePatchGetArrayLength):
  • jit/JIT.h: (JSC::JIT::compileGetByIdChainList):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/Instruction.h

    r38688 r38763  
    4545    struct PolymorphicAccessStructureList {
    4646        struct PolymorphicStubInfo {
     47            unsigned cachedOffset : 31;
     48            unsigned isChain : 1;
     49            void* stubRoutine;
    4750            Structure* base;
    48             Structure* proto;
    49             int cachedOffset;
    50             void* stubRoutine;
    51            
    52             void set(Structure* _base, Structure* _proto, int _cachedOffset, void* _stubRoutine)
     51            union {
     52                Structure* proto;
     53                StructureChain* chain;
     54            } u;
     55
     56            void set(int _cachedOffset, void* _stubRoutine, Structure* _base)
    5357            {
    54                 base = _base;
    55                 proto = _proto;
    5658                cachedOffset = _cachedOffset;
    5759                stubRoutine = _stubRoutine;
     60                base = _base;
     61                u.proto = 0;
     62                isChain = false;
     63            }
     64           
     65            void set(int _cachedOffset, void* _stubRoutine, Structure* _base, Structure* _proto)
     66            {
     67                cachedOffset = _cachedOffset;
     68                stubRoutine = _stubRoutine;
     69                base = _base;
     70                u.proto = _proto;
     71                isChain = false;
     72            }
     73           
     74            void set(int _cachedOffset, void* _stubRoutine, Structure* _base, StructureChain* _chain)
     75            {
     76                cachedOffset = _cachedOffset;
     77                stubRoutine = _stubRoutine;
     78                base = _base;
     79                u.chain = _chain;
     80                isChain = true;
    5881            }
    5982        } list[POLYMORPHIC_LIST_CACHE_SIZE];
    6083       
    61         PolymorphicAccessStructureList(Structure* firstBase, Structure* firstProto, int cachedOffset, void* stubRoutine)
     84        PolymorphicAccessStructureList(int cachedOffset, void* stubRoutine, Structure* firstBase)
    6285        {
    63             list[0].set(firstBase, firstProto, cachedOffset, stubRoutine);
     86            list[0].set(cachedOffset, stubRoutine, firstBase);
     87        }
     88
     89        PolymorphicAccessStructureList(int cachedOffset, void* stubRoutine, Structure* firstBase, Structure* firstProto)
     90        {
     91            list[0].set(cachedOffset, stubRoutine, firstBase, firstProto);
     92        }
     93
     94        PolymorphicAccessStructureList(int cachedOffset, void* stubRoutine, Structure* firstBase, StructureChain* firstChain)
     95        {
     96            list[0].set(cachedOffset, stubRoutine, firstBase, firstChain);
    6497        }
    6598
     
    72105                info.base->deref();
    73106
    74                 if (info.proto)
    75                     info.proto->deref();
     107                if (info.u.proto) {
     108                    if (info.isChain)
     109                        info.u.chain->deref();
     110                    else
     111                        info.u.proto->deref();
     112                }
    76113
    77114                if (info.stubRoutine)
Note: See TracChangeset for help on using the changeset viewer.