2009-06-01 Gavin Barraclough <barraclough@apple.com>
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:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@44344 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/interpreter/CallFrame.h b/JavaScriptCore/interpreter/CallFrame.h
index a2605db..a61e143 100644
--- a/JavaScriptCore/interpreter/CallFrame.h
+++ b/JavaScriptCore/interpreter/CallFrame.h
@@ -95,14 +95,6 @@
static const HashTable* regExpConstructorTable(CallFrame* callFrame) { return callFrame->globalData().regExpConstructorTable; }
static const HashTable* stringTable(CallFrame* callFrame) { return callFrame->globalData().stringTable; }
- private:
- friend class Arguments;
- friend class JSActivation;
- friend class JSGlobalObject;
- friend class Interpreter;
- friend class JITStubs;
- friend struct CallFrameClosure;
-
static CallFrame* create(Register* callFrameBase) { return static_cast<CallFrame*>(callFrameBase); }
Register* registers() { return this; }
@@ -111,13 +103,9 @@
CallFrame* callerFrame() const { return this[RegisterFile::CallerFrame].callFrame(); }
Arguments* optionalCalleeArguments() const { return this[RegisterFile::OptionalCalleeArguments].arguments(); }
Instruction* returnPC() const { return this[RegisterFile::ReturnPC].vPC(); }
- int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
- void setArgumentCount(int count) { this[RegisterFile::ArgumentCount] = count; }
- void setCallee(JSFunction* callee) { this[RegisterFile::Callee] = callee; }
void setCalleeArguments(Arguments* arguments) { this[RegisterFile::OptionalCalleeArguments] = arguments; }
void setCallerFrame(CallFrame* callerFrame) { this[RegisterFile::CallerFrame] = callerFrame; }
- void setCodeBlock(CodeBlock* codeBlock) { this[RegisterFile::CodeBlock] = codeBlock; }
void setScopeChain(ScopeChainNode* scopeChain) { this[RegisterFile::ScopeChain] = scopeChain; }
ALWAYS_INLINE void init(CodeBlock* codeBlock, Instruction* vPC, ScopeChainNode* scopeChain,
@@ -135,6 +123,19 @@
setCalleeArguments(0);
}
+ private:
+ friend class Arguments;
+ friend class JSActivation;
+ friend class JSGlobalObject;
+ friend class Interpreter;
+ friend struct CallFrameClosure;
+
+ int returnValueRegister() const { return this[RegisterFile::ReturnValueRegister].i(); }
+
+ void setArgumentCount(int count) { this[RegisterFile::ArgumentCount] = count; }
+ void setCallee(JSFunction* callee) { this[RegisterFile::Callee] = callee; }
+ void setCodeBlock(CodeBlock* codeBlock) { this[RegisterFile::CodeBlock] = codeBlock; }
+
static const intptr_t HostCallFrameFlag = 1;
static CallFrame* noCaller() { return reinterpret_cast<CallFrame*>(HostCallFrameFlag); }