Adjust CallFrameHeader's ReturnPC and CallFrame locations to match the native ABI .
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Oct 2013 21:26:46 +0000 (21:26 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Oct 2013 21:26:46 +0000 (21:26 +0000)
commit9c7ac88a79d1eda8cc5af8e37107e30c107b6858
tree1d36b6d0618be3af2cb304081fedda51fa948c77
parenta2b9d09b6722ae481f17ba7261046d7cf98fcd2d
Adjust CallFrameHeader's ReturnPC and CallFrame locations to match the native ABI .
https://bugs.webkit.org/show_bug.cgi?id=123444.

Reviewed by Geoffrey Garen.

- Introduced an explicit CallerFrameAndPC struct.
- A CallFrame is expected to start with a CallerFrameAndPC struct.
- The Register class no longer supports CallFrame* and Instruction*.

  These hides the differences between JSVALUE32_64 and JSVALUE64 in
  terms of managing the callerFrame() and returnPC() values.

- Convert all uses of JSStack::CallerFrame and JSStack::ReturnPC to
  go through CallFrame to access the appropriate values and offsets.
  CallFrame, in turn, will access the callerFrame and returnPC via
  the CallerFrameAndPC struct.

- InlineCallFrame will provide offsets for its callerFrame and
  returnPC. It will make use of CallFrame::callerFrameOffset() and
  CallerFrame::returnPCOffset() to compute these.

* bytecode/CodeOrigin.h:
(JSC::InlineCallFrame::callerFrameOffset):
(JSC::InlineCallFrame::returnPCOffset):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileEntry):
(JSC::DFG::JITCompiler::compileExceptionHandlers):
* dfg/DFGOSRExitCompilerCommon.cpp:
(JSC::DFG::reifyInlinedCallFrames):
* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::calleeFrameSlot):
(JSC::DFG::SpeculativeJIT::calleeArgumentSlot):
(JSC::DFG::SpeculativeJIT::calleeFrameTagSlot):
(JSC::DFG::SpeculativeJIT::calleeFramePayloadSlot):
(JSC::DFG::SpeculativeJIT::calleeArgumentTagSlot):
(JSC::DFG::SpeculativeJIT::calleeArgumentPayloadSlot):
- Prefixed all the above with callee since they apply to the callee frame.
(JSC::DFG::SpeculativeJIT::calleeFrameCallerFrame):
- Added to set the callerFrame pointer in the callee frame.

* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compile):
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall):
(JSC::DFG::SpeculativeJIT::compile):
* ftl/FTLLink.cpp:
(JSC::FTL::compileEntry):
(JSC::FTL::link):
* interpreter/CallFrame.h:
(JSC::ExecState::callerFrame):
(JSC::ExecState::callerFrameOffset):
(JSC::ExecState::returnPC):
(JSC::ExecState::hasReturnPC):
(JSC::ExecState::clearReturnPC):
(JSC::ExecState::returnPCOffset):
(JSC::ExecState::setCallerFrame):
(JSC::ExecState::setReturnPC):
(JSC::ExecState::callerFrameAndPC):
* interpreter/JSStack.h:
* interpreter/Register.h:
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitPutToCallFrameHeader):
- Convert to using storePtr() here and simplify the code.
(JSC::AssemblyHelpers::emitGetCallerFrameFromCallFrameHeaderPtr):
(JSC::AssemblyHelpers::emitPutCallerFrameToCallFrameHeader):
(JSC::AssemblyHelpers::emitGetReturnPCFromCallFrameHeaderPtr):
(JSC::AssemblyHelpers::emitPutReturnPCToCallFrameHeader):
- Helpers to emit gets/puts of the callerFrame and returnPC.
(JSC::AssemblyHelpers::addressForByteOffset):
* jit/JIT.cpp:
(JSC::JIT::JIT):
(JSC::JIT::privateCompile):
(JSC::JIT::privateCompileExceptionHandlers):
* jit/JITCall.cpp:
(JSC::JIT::compileCallEval):
(JSC::JIT::compileOpCall):
* jit/JITCall32_64.cpp:
(JSC::JIT::emit_op_ret):
(JSC::JIT::emit_op_ret_object_or_this):
(JSC::JIT::compileCallEval):
(JSC::JIT::compileOpCall):
* jit/JITInlines.h:
(JSC::JIT::unmap):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_end):
(JSC::JIT::emit_op_ret):
(JSC::JIT::emit_op_ret_object_or_this):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::privateCompileCTINativeCall):
(JSC::JIT::emit_op_end):
* jit/JITOperations.cpp:
* jit/SpecializedThunkJIT.h:
(JSC::SpecializedThunkJIT::returnJSValue):
(JSC::SpecializedThunkJIT::returnDouble):
(JSC::SpecializedThunkJIT::returnInt32):
(JSC::SpecializedThunkJIT::returnJSCell):
* jit/ThunkGenerators.cpp:
(JSC::throwExceptionFromCallSlowPathGenerator):
(JSC::slowPathFor):
(JSC::nativeForGenerator):

* llint/LLIntData.cpp:
(JSC::LLInt::Data::performAssertions):
* llint/LowLevelInterpreter.asm:
- Updated offsets and asserts to match the new CallFrame layout.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@158315 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/CodeOrigin.h
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
Source/JavaScriptCore/dfg/DFGOSRExitCompilerCommon.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h
Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
Source/JavaScriptCore/ftl/FTLLink.cpp
Source/JavaScriptCore/interpreter/CallFrame.h
Source/JavaScriptCore/interpreter/JSStack.h
Source/JavaScriptCore/interpreter/Register.h
Source/JavaScriptCore/jit/AssemblyHelpers.h
Source/JavaScriptCore/jit/JIT.cpp
Source/JavaScriptCore/jit/JITCall.cpp
Source/JavaScriptCore/jit/JITCall32_64.cpp
Source/JavaScriptCore/jit/JITInlines.h
Source/JavaScriptCore/jit/JITOpcodes.cpp
Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/jit/SpecializedThunkJIT.h
Source/JavaScriptCore/jit/ThunkGenerators.cpp
Source/JavaScriptCore/llint/LLIntData.cpp
Source/JavaScriptCore/llint/LowLevelInterpreter.asm