Changeset 36997 in webkit for trunk/JavaScriptCore/VM/Machine.h


Ignore:
Timestamp:
Sep 27, 2008, 10:19:39 AM (17 years ago)
Author:
[email protected]
Message:

2008-09-27 Geoffrey Garen <[email protected]>

Reviewed by Cameron Zwarich.


Store the callee CodeBlock, not the caller CodeBlock, in the call frame
header. Nix the "codeBlock" local variable, and access the callee
CodeBlock through the call frame header instead.


Profit: call + return are simpler, because they don't have to update the
"codeBlock" local variable.


Because CTI keeps "r" in a register, reading the callee CodeBlock relative
to "r" can be very fast, in any cases we care to optimize. Presently,
no such cases seem important.


Also, stop writing "dst" to the call frame header. CTI doesn't use it.


21.6% speedup on empty function call benchmark.
3.8% speedup on SunSpider --v8.
2.1% speedup on v8 benchmark.
0.7% speedup on SunSpider (6% speedup on controlflow-recursive).


Small regression in bytecode, because currently every op_ret reads the
callee CodeBlock to check needsFullScopeChain, and bytecode does not
keep "r" in a register. On-balance, this is probably OK, since CTI is
our high-performance execution model. Also, this should go away once
we make needsFullScopeChain statically determinable at parse time.

  • VM/CTI.cpp: (JSC::CTI::compileOpCall): The speedup! (JSC::CTI::privateCompileSlowCases): ditto
  • VM/CTI.h: (JSC::): Fixed up magic trampoline constants to account for the nixed "codeBlock" argument. (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock" argument, since codeBlock is now stored in the call frame header.


  • VM/Machine.cpp: Read the callee CodeBlock from the register file. Use a NULL CallerRegisters in the call frame header to signal a built-in caller, since CodeBlock is now never NULL.
  • VM/Machine.h: Made some stand-alone functions Machine member functions so they could call the private codeBlock() accessor in the Register class, of which Machine is a friend. Renamed "CallerCodeBlock" to "CodeBlock", since it's no longer the caller's CodeBlock.
  • VM/RegisterFile.h: Marked some methods const to accommodate a const RegisterFile* being passed around in Machine.cpp.
File:
1 edited

Legend:

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

    r36973 r36997  
    243243        enum ExecutionFlag { Normal, InitializeAndReturn };
    244244
    245         NEVER_INLINE JSValue* callEval(ExecState* exec, CodeBlock* callingCodeBlock, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile*, Register* r, int argv, int argc, JSValue*& exceptionValue);
     245        NEVER_INLINE JSValue* callEval(ExecState* exec, JSObject* thisObj, ScopeChainNode* scopeChain, RegisterFile*, Register* r, int argv, int argc, JSValue*& exceptionValue);
    246246        JSValue* execute(EvalNode*, ExecState*, JSObject* thisObj, int registerOffset, ScopeChainNode*, JSValue** exception);
    247247
     
    249249
    250250        ALWAYS_INLINE static void setScopeChain(ExecState* exec, ScopeChainNode*&, ScopeChainNode*);
    251         NEVER_INLINE void debug(ExecState*, const CodeBlock*, ScopeChainNode*, Register*, DebugHookID, int firstLine, int lastLine);
     251        NEVER_INLINE void debug(ExecState*, ScopeChainNode*, Register*, DebugHookID, int firstLine, int lastLine);
     252
     253        NEVER_INLINE bool resolve(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue);
     254        NEVER_INLINE bool resolveSkip(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue);
     255        NEVER_INLINE bool resolveGlobal(ExecState* exec, Instruction* vPC, Register* r, JSValue*& exceptionValue);
     256        NEVER_INLINE void resolveBase(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain);
     257        NEVER_INLINE bool resolveBaseAndProperty(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue);
     258        NEVER_INLINE ScopeChainNode* createExceptionScope(ExecState* exec, const Instruction* vPC, Register* r, ScopeChainNode* scopeChain);
    252259
    253260        NEVER_INLINE bool unwindCallFrame(ExecState*, JSValue*, const Instruction*&, CodeBlock*&, ScopeChainNode*&, Register*&);
    254         NEVER_INLINE Instruction* throwException(ExecState*, JSValue*&, const Instruction*, CodeBlock*&, ScopeChainNode*&, Register*&, bool);
     261        NEVER_INLINE Instruction* throwException(ExecState*, JSValue*&, const Instruction*, ScopeChainNode*&, Register*&, bool);
     262        NEVER_INLINE bool resolveBaseAndFunc(ExecState* exec, Instruction* vPC, Register* r, ScopeChainNode* scopeChain, JSValue*& exceptionValue);
    255263
    256264        Register* callFrame(ExecState*, InternalFunction*) const;
    257265
    258         JSValue* privateExecute(ExecutionFlag, ExecState* = 0, RegisterFile* = 0, Register* = 0, ScopeChainNode* = 0, CodeBlock* = 0, JSValue** exception = 0);
    259 
    260         void dumpCallFrame(const CodeBlock*, ScopeChainNode*, RegisterFile*, const Register*);
    261         void dumpRegisters(const CodeBlock*, RegisterFile*, const Register*);
     266        JSValue* privateExecute(ExecutionFlag, ExecState* = 0, RegisterFile* = 0, Register* = 0, ScopeChainNode* = 0, JSValue** exception = 0);
     267
     268        void dumpCallFrame(ScopeChainNode*, const RegisterFile*, const Register*);
     269        void dumpRegisters(const RegisterFile*, const Register*);
    262270
    263271        JSValue* checkTimeout(JSGlobalObject*);
Note: See TracChangeset for help on using the changeset viewer.