Refactor MacroAssembler::Prologue.
R=titzer@chromium.org Review URL: https://codereview.chromium.org/288213002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21329 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
743e07bad0
commit
7a5207803c
@ -171,8 +171,7 @@ void FullCodeGenerator::Generate() {
|
|||||||
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
||||||
|
|
||||||
info->set_prologue_offset(masm_->pc_offset());
|
info->set_prologue_offset(masm_->pc_offset());
|
||||||
ASSERT(!info->IsStub());
|
__ Prologue(info->IsCodePreAgingActive());
|
||||||
__ Prologue(info);
|
|
||||||
info->AddNoFrameRange(0, masm_->pc_offset());
|
info->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
|
|
||||||
{ Comment cmnt(masm_, "[ Allocate locals");
|
{ Comment cmnt(masm_, "[ Allocate locals");
|
||||||
|
@ -140,7 +140,11 @@ bool LCodeGen::GeneratePrologue() {
|
|||||||
|
|
||||||
info()->set_prologue_offset(masm_->pc_offset());
|
info()->set_prologue_offset(masm_->pc_offset());
|
||||||
if (NeedsEagerFrame()) {
|
if (NeedsEagerFrame()) {
|
||||||
__ Prologue(info());
|
if (info()->IsStub()) {
|
||||||
|
__ StubPrologue();
|
||||||
|
} else {
|
||||||
|
__ Prologue(info()->IsCodePreAgingActive());
|
||||||
|
}
|
||||||
frame_is_built_ = true;
|
frame_is_built_ = true;
|
||||||
info_->AddNoFrameRange(0, masm_->pc_offset());
|
info_->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
}
|
}
|
||||||
|
@ -902,18 +902,24 @@ void MacroAssembler::LoadConstantPoolPointerRegister() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::Prologue(CompilationInfo* info) {
|
void MacroAssembler::StubPrologue() {
|
||||||
if (info->IsStub()) {
|
|
||||||
PushFixedFrame();
|
PushFixedFrame();
|
||||||
Push(Smi::FromInt(StackFrame::STUB));
|
Push(Smi::FromInt(StackFrame::STUB));
|
||||||
// Adjust FP to point to saved FP.
|
// Adjust FP to point to saved FP.
|
||||||
add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
||||||
} else {
|
if (FLAG_enable_ool_constant_pool) {
|
||||||
|
LoadConstantPoolPointerRegister();
|
||||||
|
set_constant_pool_available(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::Prologue(bool code_pre_aging) {
|
||||||
PredictableCodeSizeScope predictible_code_size_scope(
|
PredictableCodeSizeScope predictible_code_size_scope(
|
||||||
this, kNoCodeAgeSequenceLength);
|
this, kNoCodeAgeSequenceLength);
|
||||||
// The following three instructions must remain together and unmodified
|
// The following three instructions must remain together and unmodified
|
||||||
// for code aging to work properly.
|
// for code aging to work properly.
|
||||||
if (info->IsCodePreAgingActive()) {
|
if (code_pre_aging) {
|
||||||
// Pre-age the code.
|
// Pre-age the code.
|
||||||
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
||||||
add(r0, pc, Operand(-8));
|
add(r0, pc, Operand(-8));
|
||||||
@ -925,7 +931,6 @@ void MacroAssembler::Prologue(CompilationInfo* info) {
|
|||||||
// Adjust FP to point to saved FP.
|
// Adjust FP to point to saved FP.
|
||||||
add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
add(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (FLAG_enable_ool_constant_pool) {
|
if (FLAG_enable_ool_constant_pool) {
|
||||||
LoadConstantPoolPointerRegister();
|
LoadConstantPoolPointerRegister();
|
||||||
set_constant_pool_available(true);
|
set_constant_pool_available(true);
|
||||||
|
@ -519,7 +519,8 @@ class MacroAssembler: public Assembler {
|
|||||||
Label* not_int32);
|
Label* not_int32);
|
||||||
|
|
||||||
// Generates function and stub prologue code.
|
// Generates function and stub prologue code.
|
||||||
void Prologue(CompilationInfo* info);
|
void StubPrologue();
|
||||||
|
void Prologue(bool code_pre_aging);
|
||||||
|
|
||||||
// Enter exit frame.
|
// Enter exit frame.
|
||||||
// stack_space - extra stack space, used for alignment before call to C.
|
// stack_space - extra stack space, used for alignment before call to C.
|
||||||
|
@ -170,8 +170,7 @@ void FullCodeGenerator::Generate() {
|
|||||||
// Push(lr, fp, cp, x1);
|
// Push(lr, fp, cp, x1);
|
||||||
// Add(fp, jssp, 2 * kPointerSize);
|
// Add(fp, jssp, 2 * kPointerSize);
|
||||||
info->set_prologue_offset(masm_->pc_offset());
|
info->set_prologue_offset(masm_->pc_offset());
|
||||||
ASSERT(!info->IsStub());
|
__ Prologue(info->IsCodePreAgingActive());
|
||||||
__ Prologue(info);
|
|
||||||
info->AddNoFrameRange(0, masm_->pc_offset());
|
info->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
|
|
||||||
// Reserve space on the stack for locals.
|
// Reserve space on the stack for locals.
|
||||||
|
@ -671,7 +671,11 @@ bool LCodeGen::GeneratePrologue() {
|
|||||||
ASSERT(__ StackPointer().Is(jssp));
|
ASSERT(__ StackPointer().Is(jssp));
|
||||||
info()->set_prologue_offset(masm_->pc_offset());
|
info()->set_prologue_offset(masm_->pc_offset());
|
||||||
if (NeedsEagerFrame()) {
|
if (NeedsEagerFrame()) {
|
||||||
__ Prologue(info());
|
if (info()->IsStub()) {
|
||||||
|
__ StubPrologue();
|
||||||
|
} else {
|
||||||
|
__ Prologue(info()->IsCodePreAgingActive());
|
||||||
|
}
|
||||||
frame_is_built_ = true;
|
frame_is_built_ = true;
|
||||||
info_->AddNoFrameRange(0, masm_->pc_offset());
|
info_->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
}
|
}
|
||||||
|
@ -2992,8 +2992,7 @@ void MacroAssembler::TruncateHeapNumberToI(Register result,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::Prologue(CompilationInfo* info) {
|
void MacroAssembler::StubPrologue() {
|
||||||
if (info->IsStub()) {
|
|
||||||
ASSERT(StackPointer().Is(jssp));
|
ASSERT(StackPointer().Is(jssp));
|
||||||
UseScratchRegisterScope temps(this);
|
UseScratchRegisterScope temps(this);
|
||||||
Register temp = temps.AcquireX();
|
Register temp = temps.AcquireX();
|
||||||
@ -3002,14 +3001,16 @@ void MacroAssembler::Prologue(CompilationInfo* info) {
|
|||||||
// ageing sequence.
|
// ageing sequence.
|
||||||
__ Push(lr, fp, cp, temp);
|
__ Push(lr, fp, cp, temp);
|
||||||
__ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp);
|
__ Add(fp, jssp, StandardFrameConstants::kFixedFrameSizeFromFp);
|
||||||
} else {
|
}
|
||||||
if (info->IsCodePreAgingActive()) {
|
|
||||||
|
|
||||||
|
void MacroAssembler::Prologue(bool code_pre_aging) {
|
||||||
|
if (code_pre_aging) {
|
||||||
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
||||||
__ EmitCodeAgeSequence(stub);
|
__ EmitCodeAgeSequence(stub);
|
||||||
} else {
|
} else {
|
||||||
__ EmitFrameSetupForCodeAgePatching();
|
__ EmitFrameSetupForCodeAgePatching();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1652,7 +1652,8 @@ class MacroAssembler : public Assembler {
|
|||||||
void ExitFrameRestoreFPRegs();
|
void ExitFrameRestoreFPRegs();
|
||||||
|
|
||||||
// Generates function and stub prologue code.
|
// Generates function and stub prologue code.
|
||||||
void Prologue(CompilationInfo* info);
|
void StubPrologue();
|
||||||
|
void Prologue(bool code_pre_aging);
|
||||||
|
|
||||||
// Enter exit frame. Exit frames are used when calling C code from generated
|
// Enter exit frame. Exit frames are used when calling C code from generated
|
||||||
// (JavaScript) code.
|
// (JavaScript) code.
|
||||||
|
@ -74,6 +74,7 @@ class FullCodeGenerator: public AstVisitor {
|
|||||||
info->zone()),
|
info->zone()),
|
||||||
back_edges_(2, info->zone()),
|
back_edges_(2, info->zone()),
|
||||||
ic_total_count_(0) {
|
ic_total_count_(0) {
|
||||||
|
ASSERT(!info->IsStub());
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,7 @@ void FullCodeGenerator::Generate() {
|
|||||||
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
||||||
|
|
||||||
info->set_prologue_offset(masm_->pc_offset());
|
info->set_prologue_offset(masm_->pc_offset());
|
||||||
ASSERT(!info->IsStub());
|
__ Prologue(info->IsCodePreAgingActive());
|
||||||
__ Prologue(info);
|
|
||||||
info->AddNoFrameRange(0, masm_->pc_offset());
|
info->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
|
|
||||||
{ Comment cmnt(masm_, "[ Allocate locals");
|
{ Comment cmnt(masm_, "[ Allocate locals");
|
||||||
|
@ -188,7 +188,11 @@ bool LCodeGen::GeneratePrologue() {
|
|||||||
if (NeedsEagerFrame()) {
|
if (NeedsEagerFrame()) {
|
||||||
ASSERT(!frame_is_built_);
|
ASSERT(!frame_is_built_);
|
||||||
frame_is_built_ = true;
|
frame_is_built_ = true;
|
||||||
__ Prologue(info());
|
if (info()->IsStub()) {
|
||||||
|
__ StubPrologue();
|
||||||
|
} else {
|
||||||
|
__ Prologue(info()->IsCodePreAgingActive());
|
||||||
|
}
|
||||||
info()->AddNoFrameRange(0, masm_->pc_offset());
|
info()->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -900,16 +900,18 @@ void MacroAssembler::AssertNotSmi(Register object) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::Prologue(CompilationInfo* info) {
|
void MacroAssembler::StubPrologue() {
|
||||||
if (info->IsStub()) {
|
|
||||||
push(ebp); // Caller's frame pointer.
|
push(ebp); // Caller's frame pointer.
|
||||||
mov(ebp, esp);
|
mov(ebp, esp);
|
||||||
push(esi); // Callee's context.
|
push(esi); // Callee's context.
|
||||||
push(Immediate(Smi::FromInt(StackFrame::STUB)));
|
push(Immediate(Smi::FromInt(StackFrame::STUB)));
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::Prologue(bool code_pre_aging) {
|
||||||
PredictableCodeSizeScope predictible_code_size_scope(this,
|
PredictableCodeSizeScope predictible_code_size_scope(this,
|
||||||
kNoCodeAgeSequenceLength);
|
kNoCodeAgeSequenceLength);
|
||||||
if (info->IsCodePreAgingActive()) {
|
if (code_pre_aging) {
|
||||||
// Pre-age the code.
|
// Pre-age the code.
|
||||||
call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
|
call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
|
||||||
RelocInfo::CODE_AGE_SEQUENCE);
|
RelocInfo::CODE_AGE_SEQUENCE);
|
||||||
@ -920,7 +922,6 @@ void MacroAssembler::Prologue(CompilationInfo* info) {
|
|||||||
push(esi); // Callee's context.
|
push(esi); // Callee's context.
|
||||||
push(edi); // Callee's JS function.
|
push(edi); // Callee's JS function.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -204,7 +204,8 @@ class MacroAssembler: public Assembler {
|
|||||||
void DebugBreak();
|
void DebugBreak();
|
||||||
|
|
||||||
// Generates function and stub prologue code.
|
// Generates function and stub prologue code.
|
||||||
void Prologue(CompilationInfo* info);
|
void StubPrologue();
|
||||||
|
void Prologue(bool code_pre_aging);
|
||||||
|
|
||||||
// Enter specific kind of exit frame. Expects the number of
|
// Enter specific kind of exit frame. Expects the number of
|
||||||
// arguments in register eax and sets up the number of arguments in
|
// arguments in register eax and sets up the number of arguments in
|
||||||
|
@ -176,8 +176,7 @@ void FullCodeGenerator::Generate() {
|
|||||||
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
||||||
|
|
||||||
info->set_prologue_offset(masm_->pc_offset());
|
info->set_prologue_offset(masm_->pc_offset());
|
||||||
ASSERT(!info->IsStub());
|
__ Prologue(info->IsCodePreAgingActive());
|
||||||
__ Prologue(info);
|
|
||||||
info->AddNoFrameRange(0, masm_->pc_offset());
|
info->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
|
|
||||||
{ Comment cmnt(masm_, "[ Allocate locals");
|
{ Comment cmnt(masm_, "[ Allocate locals");
|
||||||
|
@ -162,7 +162,11 @@ bool LCodeGen::GeneratePrologue() {
|
|||||||
|
|
||||||
info()->set_prologue_offset(masm_->pc_offset());
|
info()->set_prologue_offset(masm_->pc_offset());
|
||||||
if (NeedsEagerFrame()) {
|
if (NeedsEagerFrame()) {
|
||||||
__ Prologue(info());
|
if (info()->IsStub()) {
|
||||||
|
__ StubPrologue();
|
||||||
|
} else {
|
||||||
|
__ Prologue(info()->IsCodePreAgingActive());
|
||||||
|
}
|
||||||
frame_is_built_ = true;
|
frame_is_built_ = true;
|
||||||
info_->AddNoFrameRange(0, masm_->pc_offset());
|
info_->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
}
|
}
|
||||||
|
@ -4452,18 +4452,20 @@ void MacroAssembler::LoadGlobalFunctionInitialMap(Register function,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::Prologue(CompilationInfo* info) {
|
void MacroAssembler::StubPrologue() {
|
||||||
if (info->IsStub()) {
|
|
||||||
Push(ra, fp, cp);
|
Push(ra, fp, cp);
|
||||||
Push(Smi::FromInt(StackFrame::STUB));
|
Push(Smi::FromInt(StackFrame::STUB));
|
||||||
// Adjust FP to point to saved FP.
|
// Adjust FP to point to saved FP.
|
||||||
Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::Prologue(bool code_pre_aging) {
|
||||||
PredictableCodeSizeScope predictible_code_size_scope(
|
PredictableCodeSizeScope predictible_code_size_scope(
|
||||||
this, kNoCodeAgeSequenceLength);
|
this, kNoCodeAgeSequenceLength);
|
||||||
// The following three instructions must remain together and unmodified
|
// The following three instructions must remain together and unmodified
|
||||||
// for code aging to work properly.
|
// for code aging to work properly.
|
||||||
if (info->IsCodePreAgingActive()) {
|
if (code_pre_aging) {
|
||||||
// Pre-age the code.
|
// Pre-age the code.
|
||||||
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
Code* stub = Code::GetPreAgedCodeAgeStub(isolate());
|
||||||
nop(Assembler::CODE_AGE_MARKER_NOP);
|
nop(Assembler::CODE_AGE_MARKER_NOP);
|
||||||
@ -4482,7 +4484,6 @@ void MacroAssembler::Prologue(CompilationInfo* info) {
|
|||||||
// Adjust fp to point to caller's fp.
|
// Adjust fp to point to caller's fp.
|
||||||
Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
Addu(fp, sp, Operand(StandardFrameConstants::kFixedFrameSizeFromFp));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1492,7 +1492,8 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Generates function and stub prologue code.
|
// Generates function and stub prologue code.
|
||||||
void Prologue(CompilationInfo* info);
|
void StubPrologue();
|
||||||
|
void Prologue(bool code_pre_aging);
|
||||||
|
|
||||||
// Activation support.
|
// Activation support.
|
||||||
void EnterFrame(StackFrame::Type type);
|
void EnterFrame(StackFrame::Type type);
|
||||||
|
@ -157,8 +157,7 @@ void FullCodeGenerator::Generate() {
|
|||||||
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
FrameScope frame_scope(masm_, StackFrame::MANUAL);
|
||||||
|
|
||||||
info->set_prologue_offset(masm_->pc_offset());
|
info->set_prologue_offset(masm_->pc_offset());
|
||||||
ASSERT(!info->IsStub());
|
__ Prologue(info->IsCodePreAgingActive());
|
||||||
__ Prologue(info);
|
|
||||||
info->AddNoFrameRange(0, masm_->pc_offset());
|
info->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
|
|
||||||
{ Comment cmnt(masm_, "[ Allocate locals");
|
{ Comment cmnt(masm_, "[ Allocate locals");
|
||||||
|
@ -149,7 +149,11 @@ bool LCodeGen::GeneratePrologue() {
|
|||||||
if (NeedsEagerFrame()) {
|
if (NeedsEagerFrame()) {
|
||||||
ASSERT(!frame_is_built_);
|
ASSERT(!frame_is_built_);
|
||||||
frame_is_built_ = true;
|
frame_is_built_ = true;
|
||||||
__ Prologue(info());
|
if (info()->IsStub()) {
|
||||||
|
__ StubPrologue();
|
||||||
|
} else {
|
||||||
|
__ Prologue(info()->IsCodePreAgingActive());
|
||||||
|
}
|
||||||
info()->AddNoFrameRange(0, masm_->pc_offset());
|
info()->AddNoFrameRange(0, masm_->pc_offset());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3889,16 +3889,18 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::Prologue(CompilationInfo* info) {
|
void MacroAssembler::StubPrologue() {
|
||||||
if (info->IsStub()) {
|
|
||||||
pushq(rbp); // Caller's frame pointer.
|
pushq(rbp); // Caller's frame pointer.
|
||||||
movp(rbp, rsp);
|
movp(rbp, rsp);
|
||||||
Push(rsi); // Callee's context.
|
Push(rsi); // Callee's context.
|
||||||
Push(Smi::FromInt(StackFrame::STUB));
|
Push(Smi::FromInt(StackFrame::STUB));
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void MacroAssembler::Prologue(bool code_pre_aging) {
|
||||||
PredictableCodeSizeScope predictible_code_size_scope(this,
|
PredictableCodeSizeScope predictible_code_size_scope(this,
|
||||||
kNoCodeAgeSequenceLength);
|
kNoCodeAgeSequenceLength);
|
||||||
if (info->IsCodePreAgingActive()) {
|
if (code_pre_aging) {
|
||||||
// Pre-age the code.
|
// Pre-age the code.
|
||||||
Call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
|
Call(isolate()->builtins()->MarkCodeAsExecutedOnce(),
|
||||||
RelocInfo::CODE_AGE_SEQUENCE);
|
RelocInfo::CODE_AGE_SEQUENCE);
|
||||||
@ -3909,7 +3911,6 @@ void MacroAssembler::Prologue(CompilationInfo* info) {
|
|||||||
Push(rsi); // Callee's context.
|
Push(rsi); // Callee's context.
|
||||||
Push(rdi); // Callee's JS function.
|
Push(rdi); // Callee's JS function.
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -274,7 +274,8 @@ class MacroAssembler: public Assembler {
|
|||||||
void DebugBreak();
|
void DebugBreak();
|
||||||
|
|
||||||
// Generates function and stub prologue code.
|
// Generates function and stub prologue code.
|
||||||
void Prologue(CompilationInfo* info);
|
void StubPrologue();
|
||||||
|
void Prologue(bool code_pre_aging);
|
||||||
|
|
||||||
// Enter specific kind of exit frame; either in normal or
|
// Enter specific kind of exit frame; either in normal or
|
||||||
// debug mode. Expects the number of arguments in register rax and
|
// debug mode. Expects the number of arguments in register rax and
|
||||||
|
Loading…
Reference in New Issue
Block a user