| Index: src/x64/macro-assembler-x64.h
|
| ===================================================================
|
| --- src/x64/macro-assembler-x64.h (revision 8110)
|
| +++ src/x64/macro-assembler-x64.h (working copy)
|
| @@ -29,6 +29,7 @@
|
| #define V8_X64_MACRO_ASSEMBLER_X64_H_
|
|
|
| #include "assembler.h"
|
| +#include "frames.h"
|
| #include "v8globals.h"
|
|
|
| namespace v8 {
|
| @@ -72,6 +73,7 @@
|
| ScaleFactor scale;
|
| };
|
|
|
| +
|
| // MacroAssembler implements a collection of frequently used macros.
|
| class MacroAssembler: public Assembler {
|
| public:
|
| @@ -192,15 +194,6 @@
|
| void DebugBreak();
|
| #endif
|
|
|
| - // ---------------------------------------------------------------------------
|
| - // Activation frames
|
| -
|
| - void EnterInternalFrame() { EnterFrame(StackFrame::INTERNAL); }
|
| - void LeaveInternalFrame() { LeaveFrame(StackFrame::INTERNAL); }
|
| -
|
| - void EnterConstructFrame() { EnterFrame(StackFrame::CONSTRUCT); }
|
| - void LeaveConstructFrame() { LeaveFrame(StackFrame::CONSTRUCT); }
|
| -
|
| // Enter specific kind of exit frame; either in normal or
|
| // debug mode. Expects the number of arguments in register rax and
|
| // sets up the number of arguments in register rdi and the pointer
|
| @@ -1125,11 +1118,18 @@
|
| bool generating_stub() { return generating_stub_; }
|
| void set_allow_stub_calls(bool value) { allow_stub_calls_ = value; }
|
| bool allow_stub_calls() { return allow_stub_calls_; }
|
| + void set_has_frame(bool value) { has_frame_ = value; }
|
| + bool has_frame() { return has_frame_; }
|
| + inline bool AllowThisStubCall(CodeStub* stub);
|
|
|
| static int SafepointRegisterStackIndex(Register reg) {
|
| return SafepointRegisterStackIndex(reg.code());
|
| }
|
|
|
| + // Activation support.
|
| + void EnterFrame(StackFrame::Type type);
|
| + void LeaveFrame(StackFrame::Type type);
|
| +
|
| private:
|
| // Order general registers are pushed by Pushad.
|
| // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15.
|
| @@ -1139,6 +1139,7 @@
|
|
|
| bool generating_stub_;
|
| bool allow_stub_calls_;
|
| + bool has_frame_;
|
| bool root_array_available_;
|
|
|
| // Returns a register holding the smi value. The register MUST NOT be
|
| @@ -1162,10 +1163,6 @@
|
| const CallWrapper& call_wrapper = NullCallWrapper(),
|
| CallKind call_kind = CALL_AS_METHOD);
|
|
|
| - // Activation support.
|
| - void EnterFrame(StackFrame::Type type);
|
| - void LeaveFrame(StackFrame::Type type);
|
| -
|
| void EnterExitFramePrologue(bool save_rax);
|
|
|
| // Allocates arg_stack_space * kPointerSize memory (not GCed) on the stack
|
| @@ -1205,6 +1202,56 @@
|
| };
|
|
|
|
|
| +class FrameScope {
|
| + public:
|
| + explicit FrameScope(MacroAssembler* masm, StackFrame::Type type)
|
| + : masm_(masm), type_(type) {
|
| + ASSERT(!masm->has_frame());
|
| + masm->set_has_frame(true);
|
| + if (type != StackFrame::NONE) {
|
| + masm->EnterFrame(type);
|
| + }
|
| + }
|
| +
|
| + ~FrameScope() {
|
| + if (type_ != StackFrame::NONE) {
|
| + masm_->LeaveFrame(type_);
|
| + }
|
| + masm_->set_has_frame(false);
|
| + }
|
| +
|
| + // Normally we generate the leave-frame code when this object goes
|
| + // out of scope. Sometimes we may need to generate the code somewhere else
|
| + // in addition. Calling this will achieve that, but the object stays in
|
| + // scope, the MacroAssembler is still marked as being in a frame scope, and
|
| + // the code will be generated again when it goes out of scope.
|
| + void GenerateLeaveFrame() {
|
| + masm_->LeaveFrame(type_);
|
| + }
|
| +
|
| + private:
|
| + MacroAssembler* masm_;
|
| + StackFrame::Type type_;
|
| +};
|
| +
|
| +
|
| +class NoCurrentFrameScope {
|
| + public:
|
| + explicit NoCurrentFrameScope(MacroAssembler* masm)
|
| + : masm_(masm), saved_(masm->has_frame()) {
|
| + masm->set_has_frame(false);
|
| + }
|
| +
|
| + ~NoCurrentFrameScope() {
|
| + masm_->set_has_frame(saved_);
|
| + }
|
| +
|
| + private:
|
| + MacroAssembler* masm_;
|
| + bool saved_;
|
| +};
|
| +
|
| +
|
| // The code patcher is used to patch (typically) small parts of code e.g. for
|
| // debugging and other types of instrumentation. When using the code patcher
|
| // the exact number of bytes specified must be emitted. Is not legal to emit
|
|
|