MIPS: Add StubFailureTrampolineFrames
Port r13533 (2f339757) Original commit message: In preparation of supporting stubs that deopt and then need to push their register-based parameters to an arguments area on the stack that gets properly collected, add StubFailureTrampolineFrames to hold those parameters. BUG= TEST= Review URL: https://codereview.chromium.org/12087053 Patch from Akos Palfi <palfia@homejinni.com>. git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13560 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ba8a1dca66
commit
c9be48a2b7
@ -1310,10 +1310,8 @@ void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
|
||||
__ MultiPop(kJSCallerSaved | kCalleeSaved);
|
||||
}
|
||||
|
||||
__ mov(at, ra); // Stash the miss continuation
|
||||
__ Addu(sp, sp, Operand(kPointerSize)); // Ignore state
|
||||
__ pop(ra); // Restore RA to continuation in JSFunction
|
||||
__ Jump(at); // Jump to miss handler
|
||||
__ Jump(ra); // Jump to miss handler
|
||||
}
|
||||
|
||||
|
||||
|
@ -7977,6 +7977,16 @@ void StoreArrayLiteralElementStub::Generate(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
|
||||
ASSERT(!Serializer::enabled());
|
||||
bool save_fp_regs = CpuFeatures::IsSupported(FPU);
|
||||
CEntryStub ces(1, save_fp_regs ? kSaveFPRegs : kDontSaveFPRegs);
|
||||
__ Call(ces.GetCode(), RelocInfo::CODE_TARGET);
|
||||
masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
|
||||
__ Ret();
|
||||
}
|
||||
|
||||
|
||||
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
|
||||
if (entry_hook_ != NULL) {
|
||||
ProfileEntryHookStub stub;
|
||||
|
@ -448,22 +448,27 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
|
||||
void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
||||
int frame_index) {
|
||||
//
|
||||
// FROM TO <-fp
|
||||
// FROM TO
|
||||
// | .... | | .... |
|
||||
// +-------------------------+ +-------------------------+
|
||||
// | JSFunction continuation | | parameter 1 |
|
||||
// | JSFunction continuation | | JSFunction continuation |
|
||||
// +-------------------------+ +-------------------------+
|
||||
// | | saved frame (fp) | | .... |
|
||||
// | +=========================+<-fp +-------------------------+
|
||||
// | | JSFunction context | | parameter n |
|
||||
// | | saved frame (fp) | | saved frame (fp) |
|
||||
// | +=========================+<-fp +=========================+<-fp
|
||||
// | | JSFunction context | | JSFunction context |
|
||||
// v +-------------------------+ +-------------------------|
|
||||
// | COMPILED_STUB marker | | JSFunction continuation |
|
||||
// +-------------------------+ +-------------------------+<-sp
|
||||
// | | a0 = number of parameters
|
||||
// | ... | a1 = failure handler address
|
||||
// | | fp = saved frame
|
||||
// +-------------------------+<-sp cp = JSFunction context
|
||||
//
|
||||
// | COMPILED_STUB marker | | STUB_FAILURE marker |
|
||||
// +-------------------------+ +-------------------------+
|
||||
// | | | stub parameter 1 |
|
||||
// | ... | +-------------------------+
|
||||
// | | | ... |
|
||||
// |-------------------------|<-sp +-------------------------+
|
||||
// | stub parameter n |
|
||||
// parameters in registers +-------------------------+<-sp
|
||||
// and spilled to stack s0-s1 = number of parameters
|
||||
// s2 = failure handler address
|
||||
// fp = saved frame
|
||||
// cp = JSFunction context
|
||||
//
|
||||
|
||||
ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
|
||||
@ -471,39 +476,59 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
||||
CodeStubInterfaceDescriptor* descriptor =
|
||||
isolate_->code_stub_interface_descriptor(major_key);
|
||||
|
||||
int output_frame_size =
|
||||
(1 + descriptor->register_param_count_) * kPointerSize;
|
||||
int output_frame_size = StandardFrameConstants::kFixedFrameSize +
|
||||
kPointerSize * descriptor->register_param_count_;
|
||||
|
||||
FrameDescription* output_frame =
|
||||
new(output_frame_size) FrameDescription(output_frame_size, 0);
|
||||
ASSERT(frame_index == 0);
|
||||
output_[frame_index] = output_frame;
|
||||
Code* notify_failure =
|
||||
isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
|
||||
output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
|
||||
output_frame->SetContinuation(
|
||||
reinterpret_cast<uint32_t>(notify_failure->entry()));
|
||||
reinterpret_cast<intptr_t>(notify_failure->entry()));
|
||||
|
||||
Code* code;
|
||||
CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_);
|
||||
output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
|
||||
Code* trampoline = NULL;
|
||||
StubFailureTrampolineStub().FindCodeInCache(&trampoline, isolate_);
|
||||
ASSERT(trampoline != NULL);
|
||||
output_frame->SetPc(reinterpret_cast<intptr_t>(
|
||||
trampoline->instruction_start()));
|
||||
unsigned input_frame_size = input_->GetFrameSize();
|
||||
intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
|
||||
output_frame->SetFrameSlot(0, value);
|
||||
value = input_->GetFrameSlot(input_frame_size - 2 * kPointerSize);
|
||||
|
||||
// JSFunction continuation
|
||||
intptr_t input_frame_offset = input_frame_size - kPointerSize;
|
||||
intptr_t output_frame_offset = output_frame_size - kPointerSize;
|
||||
intptr_t value = input_->GetFrameSlot(input_frame_offset);
|
||||
output_frame->SetFrameSlot(output_frame_offset, value);
|
||||
|
||||
// saved frame ptr
|
||||
input_frame_offset -= kPointerSize;
|
||||
value = input_->GetFrameSlot(input_frame_offset);
|
||||
output_frame_offset -= kPointerSize;
|
||||
output_frame->SetFrameSlot(output_frame_offset, value);
|
||||
|
||||
// Restore context
|
||||
input_frame_offset -= kPointerSize;
|
||||
value = input_->GetFrameSlot(input_frame_offset);
|
||||
output_frame->SetRegister(cp.code(), value);
|
||||
output_frame_offset -= kPointerSize;
|
||||
output_frame->SetFrameSlot(output_frame_offset, value);
|
||||
|
||||
// Internal frame markers
|
||||
output_frame_offset -= kPointerSize;
|
||||
value = reinterpret_cast<intptr_t>(
|
||||
Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
|
||||
output_frame->SetFrameSlot(output_frame_offset, value);
|
||||
|
||||
for (int i = 0; i < descriptor->register_param_count_; ++i) {
|
||||
output_frame_offset -= kPointerSize;
|
||||
DoTranslateCommand(iterator, 0, output_frame_offset);
|
||||
}
|
||||
|
||||
value = input_->GetRegister(fp.code());
|
||||
output_frame->SetRegister(fp.code(), value);
|
||||
output_frame->SetFp(value);
|
||||
value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
|
||||
output_frame->SetRegister(cp.code(), value);
|
||||
|
||||
int parameter_offset = kPointerSize * descriptor->register_param_count_;
|
||||
for (int i = 0; i < descriptor->register_param_count_; ++i) {
|
||||
Translation::Opcode opcode =
|
||||
static_cast<Translation::Opcode>(iterator->Next());
|
||||
ASSERT(opcode == Translation::REGISTER);
|
||||
USE(opcode);
|
||||
int input_reg = iterator->Next();
|
||||
intptr_t reg_value = input_->GetRegister(input_reg);
|
||||
output_frame->SetFrameSlot(parameter_offset, reg_value);
|
||||
parameter_offset -= kPointerSize;
|
||||
}
|
||||
|
||||
ApiFunction function(descriptor->deoptimization_handler_);
|
||||
ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
|
||||
@ -512,9 +537,6 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
|
||||
output_frame->SetRegister(s1.code(),
|
||||
(descriptor->register_param_count_ - 1) * kPointerSize);
|
||||
output_frame->SetRegister(s2.code(), handler);
|
||||
|
||||
ASSERT(frame_index == 0);
|
||||
output_[frame_index] = output_frame;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user