Ignore:
Timestamp:
Nov 21, 2008, 7:34:43 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Oliver Hunt.

Add (really) polymorphic caching for get by id self.
Very similar to caching of prototype accesses, described below.

Oh, also, probably shouldn't have been leaking those structure list objects.


4% preogression on deltablue.

  • bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): (JSC::CodeBlock::derefStructures): (JSC::PrototypeStructureList::derefStructures):
  • bytecode/Instruction.h:
  • bytecode/Opcode.h:
  • interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): (JSC::Interpreter::cti_op_get_by_id_self_fail):
  • jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::patchGetByIdSelf):
  • jit/JIT.h: (JSC::JIT::compileGetByIdSelfList):
File:
1 edited

Legend:

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

    r38652 r38688  
    3434#include <wtf/VectorTraits.h>
    3535
    36 #define PROTOTYPE_LIST_CACHE_SIZE 4
     36#define POLYMORPHIC_LIST_CACHE_SIZE 4
    3737
    3838namespace JSC {
     
    4343
    4444    // Structure used by op_get_by_id_proto_list instruction to hold data off the main opcode stream.
    45     struct PrototypeStructureList {
    46         struct ProtoStubInfo {
     45    struct PolymorphicAccessStructureList {
     46        struct PolymorphicStubInfo {
    4747            Structure* base;
    4848            Structure* proto;
     
    5757                stubRoutine = _stubRoutine;
    5858            }
    59         } list[PROTOTYPE_LIST_CACHE_SIZE];
     59        } list[POLYMORPHIC_LIST_CACHE_SIZE];
    6060       
    61         PrototypeStructureList(Structure* firstBase, Structure* firstProto, int cachedOffset, void* stubRoutine)
     61        PolymorphicAccessStructureList(Structure* firstBase, Structure* firstProto, int cachedOffset, void* stubRoutine)
    6262        {
    6363            list[0].set(firstBase, firstProto, cachedOffset, stubRoutine);
     64        }
     65
     66        void derefStructures(int count)
     67        {
     68            for (int i = 0; i < count; ++i) {
     69                PolymorphicStubInfo& info = list[i];
     70
     71                ASSERT(info.base);
     72                info.base->deref();
     73
     74                if (info.proto)
     75                    info.proto->deref();
     76
     77                if (info.stubRoutine)
     78                    WTF::fastFreeExecutable(info.stubRoutine);
     79            }
    6480        }
    6581    };
     
    7894        Instruction(StructureChain* structureChain) { u.structureChain = structureChain; }
    7995        Instruction(JSCell* jsCell) { u.jsCell = jsCell; }
    80         Instruction(PrototypeStructureList* prototypeStructure) { u.prototypeStructure = prototypeStructure; }
     96        Instruction(PolymorphicAccessStructureList* polymorphicStructures) { u.polymorphicStructures = polymorphicStructures; }
    8197
    8298        union {
     
    87103            JSCell* jsCell;
    88104            ResultType::Type resultType;
    89             PrototypeStructureList* prototypeStructure;
     105            PolymorphicAccessStructureList* polymorphicStructures;
    90106        } u;
    91107    };
Note: See TracChangeset for help on using the changeset viewer.