Ignore:
Timestamp:
Jun 1, 2009, 10:36:18 PM (16 years ago)
Author:
[email protected]
Message:

2009-06-01 Gavin Barraclough <[email protected]>

Reviewed by Olliej Hunt.

Change JITStub functions from being static members on the JITStub class to be
global extern "C" functions, and switch their the function signature declaration
in the definition of the functions to be C-macro generated. This makes it easier
to work with the stub functions from assembler code (since the names no longer
require mangling), and by delaring the functions with a macro we can look at
also auto-generating asm thunks to wrap the JITStub functions to perform the
work currently in 'restoreArgumentReference' (as a memory saving).

Making this change also forces us to be a bit more realistic about what is private
on the Register and CallFrame objects. Presently most everything on these classes
is private, and the classes have plenty of friends. We could befriend all the
global functions to perpetuate the delusion of encapsulation, but using friends is
a bit of a sledgehammer solution here - since friends can poke around with all of
the class's privates, and since all the major classes taht operate on Regsiters are
currently friends, right there is currently in practice very little protection at
all. Better to start removing friend delclarations, and exposing just the parts
that need to be exposed.

  • interpreter/CallFrame.h: (JSC::ExecState::returnPC): (JSC::ExecState::setCallerFrame): (JSC::ExecState::returnValueRegister): (JSC::ExecState::setArgumentCount): (JSC::ExecState::setCallee): (JSC::ExecState::setCodeBlock):
  • interpreter/Interpreter.h:
  • interpreter/Register.h: (JSC::Register::Register): (JSC::Register::i):
  • jit/JITStubs.cpp: (JSC::): (JSC::JITThunks::JITThunks): (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::JITStubs::DEFINE_STUB_FUNCTION):
  • jit/JITStubs.h: (JSC::JITStubs::):
  • runtime/JSFunction.h: (JSC::JSFunction::nativeFunction): (JSC::JSFunction::classInfo):
  • runtime/JSGlobalData.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/interpreter/Register.h

    r43153 r44344  
    3131
    3232#include "JSValue.h"
     33#include <wtf/Assertions.h>
    3334#include <wtf/VectorTraits.h>
    3435
     
    5152        Register();
    5253        Register(JSValue);
     54        Register(Arguments*);
    5355
    5456        JSValue jsValue() const;
     
    5759        void mark();
    5860       
     61        int32_t i() const;
     62        void* v() const;
     63
    5964    private:
    6065        friend class ExecState;
    6166        friend class Interpreter;
    62         friend class JITStubs;
    6367
    6468        // Only CallFrame, Interpreter, and JITStubs should use these functions.
     
    6771
    6872        Register(JSActivation*);
    69         Register(Arguments*);
    7073        Register(CallFrame*);
    7174        Register(CodeBlock*);
     
    7477        Register(ScopeChainNode*);
    7578        Register(Instruction*);
    76 
    77         intptr_t i() const;
    78         void* v() const;
    7979
    8080        JSActivation* activation() const;
     
    174174    ALWAYS_INLINE Register::Register(intptr_t i)
    175175    {
     176        // See comment on 'i()' below.
     177        ASSERT(i == static_cast<int32_t>(i));
    176178        u.i = i;
    177179    }
    178180
    179     ALWAYS_INLINE intptr_t Register::i() const
    180     {
    181         return u.i;
     181    // Read 'i' as a 32-bit integer; we only use it to hold 32-bit values,
     182    // and we only write 32-bits when writing the arg count from JIT code.
     183    ALWAYS_INLINE int32_t Register::i() const
     184    {
     185        return static_cast<int32_t>(u.i);
    182186    }
    183187   
Note: See TracChangeset for help on using the changeset viewer.