Changeset 36851 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Sep 24, 2008, 10:02:14 AM (17 years ago)
Author:
Darin Adler
Message:

2008-09-24 Darin Adler <Darin Adler>

Reviewed by Sam Weinig.

About 1% on v8-raytrace.

  • kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
  • kjs/JSActivation.h: (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize argument to setRegisters, since the object doesn't need to store the number of registers.
  • kjs/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we used this on objects that weren't brand new. These days, this function is really just part of the constructor.
  • kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since JSVariableObjectData no longer needs it. Added a setRegisters override here that handles storing the size.
  • kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it no longer exists.
  • kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the header to make them inline.
  • kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData, since it was only used for the global object. (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline. (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also removed the code to set registerArraySize and changed an if statement into an assert to save an unnnecessary branch.
Location:
trunk/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r36847 r36851  
     12008-09-24  Darin Adler  <[email protected]>
     2
     3        Reviewed by Sam Weinig.
     4
     5        - https://bugs.webkit.org/show_bug.cgi?id=21047
     6          speed up ret_activation with inlining
     7
     8        About 1% on v8-raytrace.
     9
     10        * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
     11
     12        * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
     13        * kjs/JSActivation.h:
     14        (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
     15        argument to setRegisters, since the object doesn't need to store the number of
     16        registers.
     17
     18        * kjs/JSGlobalObject.cpp:
     19        (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
     20        used this on objects that weren't brand new. These days, this function is really
     21        just part of the constructor.
     22
     23        * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
     24        JSVariableObjectData no longer needs it. Added a setRegisters override here
     25        that handles storing the size.
     26
     27        * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
     28        no longer exists.
     29
     30        * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
     31        header to make them inline.
     32        * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
     33        since it was only used for the global object.
     34        (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
     35        (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
     36        removed the code to set registerArraySize and changed an if statement into
     37        an assert to save an unnnecessary branch.
     38
    1392008-09-24  Maciej Stachowiak  <[email protected]>
    240
     
    128166        empty call benchmark for CTI.
    129167       
    130         SunSpider says no change. SunSpider --v8 says 1% faster.
     168        SunSpider says no change. SunSpider --v8 says 1% faster.v8
    131169
    132170        * VM/CTI.cpp:
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r36847 r36851  
    153153__ZN3JSC16InternalFunction4infoE
    154154__ZN3JSC16InternalFunctionC2EPNS_9ExecStateEN3WTF10PassRefPtrINS_11StructureIDEEERKNS_10IdentifierE
    155 __ZN3JSC16JSVariableObject12setRegistersEPNS_8RegisterES2_m
    156155__ZN3JSC16JSVariableObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    157156__ZN3JSC16JSVariableObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
  • trunk/JavaScriptCore/kjs/JSActivation.cpp

    r36821 r36851  
    3131
    3232#include "Arguments.h"
    33 #include "CodeBlock.h"
    3433#include "Machine.h"
    35 #include "Register.h"
    3634#include "JSFunction.h"
    3735
     
    8482            r.mark();
    8583    }
    86 }
    87 
    88 void JSActivation::copyRegisters()
    89 {
    90     ASSERT(!d()->registerArray);
    91     ASSERT(!d()->registerArraySize);
    92 
    93     size_t numParametersMinusThis = d()->functionBody->generatedByteCode().numParameters - 1;
    94     size_t numVars = d()->functionBody->generatedByteCode().numVars;
    95     size_t numLocals = numVars + numParametersMinusThis;
    96 
    97     if (!numLocals)
    98         return;
    99 
    100     int registerOffset = numParametersMinusThis + RegisterFile::CallFrameHeaderSize;
    101     size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize;
    102 
    103     Register* registerArray = copyRegisterArray(d()->registers - registerOffset, registerArraySize);
    104     setRegisters(registerArray + registerOffset, registerArray, registerArraySize);
    10584}
    10685
  • trunk/JavaScriptCore/kjs/JSActivation.h

    r36821 r36851  
    3030#define JSActivation_h
    3131
     32#include "CodeBlock.h"
    3233#include "JSVariableObject.h"
     34#include "RegisterFile.h"
    3335#include "SymbolTable.h"
    3436#include "nodes.h"
     
    99101    };
    100102   
     103    inline void JSActivation::copyRegisters()
     104    {
     105        ASSERT(!d()->registerArray);
     106
     107        size_t numParametersMinusThis = d()->functionBody->generatedByteCode().numParameters - 1;
     108        size_t numVars = d()->functionBody->generatedByteCode().numVars;
     109        size_t numLocals = numVars + numParametersMinusThis;
     110
     111        if (!numLocals)
     112            return;
     113
     114        int registerOffset = numParametersMinusThis + RegisterFile::CallFrameHeaderSize;
     115        size_t registerArraySize = numLocals + RegisterFile::CallFrameHeaderSize;
     116
     117        Register* registerArray = copyRegisterArray(d()->registers - registerOffset, registerArraySize);
     118        setRegisters(registerArray + registerOffset, registerArray);
     119    }
     120
    101121} // namespace JSC
    102122
  • trunk/JavaScriptCore/kjs/JSGlobalObject.cpp

    r36843 r36851  
    196196void JSGlobalObject::reset(JSValue* prototype)
    197197{
    198     // Clear before inititalizing, to avoid calling mark() on stale pointers --
    199     // which would be wasteful -- or uninitialized pointers -- which would be
    200     // dangerous. (The allocations below may cause a GC.)
    201 
    202     ASSERT(!hasCustomProperties());
    203     symbolTable().clear();
    204     setRegisters(0, 0, 0);
    205 
    206198    ExecState* exec = d()->globalExec.get();
    207199
  • trunk/JavaScriptCore/kjs/JSGlobalObject.h

    r36821 r36851  
    5757            JSGlobalObjectData(JSGlobalObject* globalObject, JSObject* thisValue)
    5858                : JSVariableObjectData(&symbolTable, 0)
     59                , registerArraySize(0)
    5960                , globalScopeChain(globalObject, thisValue)
    6061                , regExpConstructor(0)
     
    8283            }
    8384
     85            size_t registerArraySize;
     86
    8487            JSGlobalObject* next;
    8588            JSGlobalObject* prev;
     
    270273        void reset(JSValue* prototype);
    271274
     275        void setRegisters(Register* registers, Register* registerArray, size_t count);
     276
    272277        void* operator new(size_t); // can only be allocated with JSGlobalData
    273278    };
     279
     280    inline void JSGlobalObject::setRegisters(Register* registers, Register* registerArray, size_t count)
     281    {
     282        JSVariableObject::setRegisters(registers, registerArray);
     283        d()->registerArraySize = count;
     284    }
    274285
    275286    inline void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count)
     
    324335    }
    325336
     337
    326338} // namespace JSC
    327339
  • trunk/JavaScriptCore/kjs/JSStaticScopeObject.h

    r36821 r36851  
    3838                : JSVariableObjectData(&symbolTable, &registerStore + 1)
    3939            {
    40                 registerArraySize = 1;
    4140            }
    4241            SymbolTable symbolTable;
  • trunk/JavaScriptCore/kjs/JSVariableObject.cpp

    r36821 r36851  
    6969}
    7070
    71 Register* JSVariableObject::copyRegisterArray(Register* src, size_t count)
    72 {
    73     Register* registerArray = new Register[count];
    74     memcpy(registerArray, src, count * sizeof(Register));
    75 
    76     return registerArray;
    77 }
    78 
    79 void JSVariableObject::setRegisters(Register* r, Register* registerArray, size_t count)
    80 {
    81     if (registerArray != d->registerArray.get())
    82         d->registerArray.set(registerArray);
    83     d->registerArraySize = count;
    84     d->registers = r;
    85 }
    86 
    8771} // namespace JSC
  • trunk/JavaScriptCore/kjs/JSVariableObject.h

    r36821 r36851  
    6565                : symbolTable(symbolTable_)
    6666                , registers(registers_)
    67                 , registerArraySize(0)
    6867            {
    6968                ASSERT(symbolTable_);
     
    7372            Register* registers; // "r" in the register file.
    7473            OwnArrayPtr<Register> registerArray; // Independent copy of registers, used when a variable object copies its registers out of the register file.
    75             size_t registerArraySize;
    7674
    7775            static inline ptrdiff_t offsetOf_registers()
     
    9290
    9391        Register* copyRegisterArray(Register* src, size_t count);
    94         void setRegisters(Register* r, Register* registerArray, size_t count);
     92        void setRegisters(Register* r, Register* registerArray);
    9593
    9694        bool symbolTableGet(const Identifier&, PropertySlot&);
     
    161159    }
    162160
     161    inline Register* JSVariableObject::copyRegisterArray(Register* src, size_t count)
     162    {
     163        Register* registerArray = new Register[count];
     164        memcpy(registerArray, src, count * sizeof(Register));
     165
     166        return registerArray;
     167    }
     168
     169    inline void JSVariableObject::setRegisters(Register* registers, Register* registerArray)
     170    {
     171        ASSERT(registerArray != d->registerArray.get());
     172        d->registerArray.set(registerArray);
     173        d->registers = registers;
     174    }
     175
    163176} // namespace JSC
    164177
Note: See TracChangeset for help on using the changeset viewer.