Changeset 36418 in webkit for trunk/JavaScriptCore/VM/CodeBlock.h


Ignore:
Timestamp:
Sep 14, 2008, 7:18:13 PM (17 years ago)
Author:
[email protected]
Message:

2008-09-14 Maciej Stachowiak <[email protected]>

Reviewed by Cameron Zwarich.


  • split the "prototype" lookup for hasInstance into opcode stream so it can be cached


~5% speedup on v8 earley-boyer test

  • API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
  • API/JSCallbackObjectFunctions.h: (JSC::::hasInstance): Ditto.
  • API/JSValueRef.cpp: (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
  • JavaScriptCore.exp:
  • VM/CTI.cpp: (JSC::CTI::privateCompileMainPass): Pass along prototype.
  • VM/CodeBlock.cpp: (JSC::CodeBlock::dump): Print third arg.
  • VM/CodeGenerator.cpp: (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there is a third argument.
  • VM/CodeGenerator.h:
  • VM/Machine.cpp: (JSC::Machine::privateExecute): Pass along the prototype. (JSC::Machine::cti_op_instanceof): ditto
  • kjs/JSObject.cpp: (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
  • kjs/JSObject.h:
  • kjs/nodes.cpp: (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype property and pass that register to instanceof.
  • kjs/nodes.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/CodeBlock.h

    r36267 r36418  
    7777    };
    7878
     79    struct StructureStubInfo {
     80        StructureStubInfo(unsigned opcodeIndex)
     81            : opcodeIndex(opcodeIndex)
     82            , stubRoutine(0)
     83            , callReturnLocation(0)
     84            , hotPathBegin(0)
     85        {
     86        }
     87   
     88        unsigned opcodeIndex;
     89        void* stubRoutine;
     90        void* callReturnLocation;
     91        void* hotPathBegin;
     92    };
     93
    7994    struct StringJumpTable {
    8095        typedef HashMap<RefPtr<UString::Rep>, OffsetLocation> StringOffsetTable;
     
    200215        void derefStructureIDs(Instruction* vPC) const;
    201216
     217        StructureStubInfo& getStubInfo(void* returnAddress)
     218        {
     219            // FIXME: would a binary chop be faster here?
     220            for (unsigned i = 0; i < structureIDInstructions.size(); ++i) {
     221                if (structureIDInstructions[i].callReturnLocation == returnAddress)
     222                    return structureIDInstructions[i];
     223            }
     224           
     225            ASSERT_NOT_REACHED();
     226            // keep the compiler happy.
     227            static StructureStubInfo duff(0);
     228            return duff;
     229        }
     230
    202231        ScopeNode* ownerNode;
    203232        JSGlobalData* globalData;
     
    219248
    220249        Vector<Instruction> instructions;
    221         Vector<size_t> structureIDInstructions;
    222         Vector<void*> structureIDAccessStubs;
     250        Vector<StructureStubInfo> structureIDInstructions;
    223251
    224252        // Constant pool
Note: See TracChangeset for help on using the changeset viewer.