Changeset 38688 in webkit for trunk/JavaScriptCore/bytecode


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

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/bytecode/CodeBlock.cpp

    r38652 r38688  
    643643            break;
    644644        }
     645        case op_get_by_id_self_list: {
     646            printGetByIdOp(location, it, identifiers, "get_by_id_self_list");
     647            break;
     648        }
    645649        case op_get_by_id_proto: {
    646650            printGetByIdOp(location, it, identifiers, "get_by_id_proto");
     
    10241028        return;
    10251029    }
    1026     if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list)) {
    1027         PrototypeStructureList* prototypeStructures = vPC[4].u.prototypeStructure;
    1028         int count = vPC[5].u.operand;
    1029         for (int i = 0; i < count; ++i) {
    1030             PrototypeStructureList::ProtoStubInfo& info = prototypeStructures->list[i];
    1031             ASSERT(info.base);
    1032             ASSERT(info.proto);
    1033             ASSERT(info.stubRoutine);
    1034             info.base->deref();
    1035             info.proto->deref();
    1036             WTF::fastFreeExecutable(info.stubRoutine);
    1037         }
     1030    if ((vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto_list))
     1031        || (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_self_list))) {
     1032        PolymorphicAccessStructureList* polymorphicStructures = vPC[4].u.polymorphicStructures;
     1033        polymorphicStructures->derefStructures(vPC[5].u.operand);
     1034        delete polymorphicStructures;
    10381035        return;
    10391036    }
  • 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    };
  • trunk/JavaScriptCore/bytecode/Opcode.h

    r38652 r38688  
    102102        macro(op_get_by_id) \
    103103        macro(op_get_by_id_self) \
     104        macro(op_get_by_id_self_list) \
    104105        macro(op_get_by_id_proto) \
    105106        macro(op_get_by_id_proto_list) \
Note: See TracChangeset for help on using the changeset viewer.