Commit 8e7f419f authored by danno@chromium.org's avatar danno@chromium.org

MIPS: Generalize calling to C++ on stub deopt

Port r13320 (916d70a6)

Original commit message:
Remove code specific to KeyedLoadICs in DoCompiledStubFrame on all platforms, driving stub frame translation by the register parameter information found in a stub's CodeStubInterfaceDescriptor.

BUG=
TEST=

Review URL: https://codereview.chromium.org/11783046
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13336 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 13db2977
...@@ -1297,7 +1297,7 @@ CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR) ...@@ -1297,7 +1297,7 @@ CODE_AGE_LIST(DEFINE_CODE_AGE_BUILTIN_GENERATOR)
#undef DEFINE_CODE_AGE_BUILTIN_GENERATOR #undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) { void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
{ {
FrameScope scope(masm, StackFrame::INTERNAL); FrameScope scope(masm, StackFrame::INTERNAL);
...@@ -1306,7 +1306,7 @@ void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) { ...@@ -1306,7 +1306,7 @@ void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) {
// registers. // registers.
__ MultiPush(kJSCallerSaved | kCalleeSaved); __ MultiPush(kJSCallerSaved | kCalleeSaved);
// Pass the function and deoptimization type to the runtime system. // Pass the function and deoptimization type to the runtime system.
__ CallRuntime(Runtime::kNotifyICMiss, 0); __ CallRuntime(Runtime::kNotifyStubFailure, 0);
__ MultiPop(kJSCallerSaved | kCalleeSaved); __ MultiPop(kJSCallerSaved | kCalleeSaved);
} }
......
...@@ -45,7 +45,7 @@ void KeyedLoadFastElementStub::InitializeInterfaceDescriptor( ...@@ -45,7 +45,7 @@ void KeyedLoadFastElementStub::InitializeInterfaceDescriptor(
descriptor->register_param_count_ = 2; descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers; descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ = descriptor->deoptimization_handler_ =
isolate->builtins()->KeyedLoadIC_Miss(); FUNCTION_ADDR(KeyedLoadIC_Miss);
} }
......
...@@ -451,35 +451,39 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, ...@@ -451,35 +451,39 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
// FROM TO <-fp // FROM TO <-fp
// | .... | | .... | // | .... | | .... |
// +-------------------------+ +-------------------------+ // +-------------------------+ +-------------------------+
// | JSFunction continuation | | JSFunction continuation | // | JSFunction continuation | | parameter 1 |
// +-------------------------+ +-------------------------+
// | | saved frame (fp) | | .... |
// | +=========================+<-fp +-------------------------+
// | | JSFunction context | | parameter n |
// v +-------------------------+ +-------------------------|
// | COMPILED_STUB marker | | JSFunction continuation |
// +-------------------------+ +-------------------------+<-sp // +-------------------------+ +-------------------------+<-sp
// | | saved frame (fp) | // | | a0 = number of parameters
// | +=========================+<-fp // | ... | a1 = failure handler address
// | | JSFunction context | // | | fp = saved frame
// v +-------------------------+ // +-------------------------+<-sp cp = JSFunction context
// | COMPILED_STUB marker | fp = saved frame
// +-------------------------+ f8 = JSFunction context
// | |
// | ... |
// | |
// +-------------------------+<-sp
// //
// //
int output_frame_size = 1 * kPointerSize;
FrameDescription* output_frame =
new(output_frame_size) FrameDescription(output_frame_size, 0);
Code* notify_miss =
isolate_->builtins()->builtin(Builtins::kNotifyICMiss);
output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
output_frame->SetContinuation(
reinterpret_cast<intptr_t>(notify_miss->entry()));
ASSERT(compiled_code_->kind() == Code::COMPILED_STUB); ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
int major_key = compiled_code_->major_key(); int major_key = compiled_code_->major_key();
CodeStubInterfaceDescriptor* descriptor = CodeStubInterfaceDescriptor* descriptor =
isolate_->code_stub_interface_descriptor(major_key); isolate_->code_stub_interface_descriptor(major_key);
Handle<Code> miss_ic(descriptor->deoptimization_handler_);
output_frame->SetPc(reinterpret_cast<intptr_t>(miss_ic->instruction_start())); int output_frame_size =
(1 + descriptor->register_param_count_) * kPointerSize;
FrameDescription* output_frame =
new(output_frame_size) FrameDescription(output_frame_size, 0);
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()));
Code* code;
CEntryStub(1, kSaveFPRegs).FindCodeInCache(&code, isolate_);
output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
unsigned input_frame_size = input_->GetFrameSize(); unsigned input_frame_size = input_->GetFrameSize();
intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize); intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
output_frame->SetFrameSlot(0, value); output_frame->SetFrameSlot(0, value);
...@@ -489,20 +493,25 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator, ...@@ -489,20 +493,25 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize); value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
output_frame->SetRegister(cp.code(), value); 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 = Translation::Opcode opcode =
static_cast<Translation::Opcode>(iterator->Next()); static_cast<Translation::Opcode>(iterator->Next());
ASSERT(opcode == Translation::REGISTER); ASSERT(opcode == Translation::REGISTER);
USE(opcode); USE(opcode);
int input_reg = iterator->Next(); int input_reg = iterator->Next();
intptr_t input_value = input_->GetRegister(input_reg); intptr_t reg_value = input_->GetRegister(input_reg);
output_frame->SetRegister(a1.code(), input_value); output_frame->SetFrameSlot(parameter_offset, reg_value);
parameter_offset -= kPointerSize;
int32_t next = iterator->Next(); }
opcode = static_cast<Translation::Opcode>(next);
ASSERT(opcode == Translation::REGISTER); ApiFunction function(descriptor->deoptimization_handler_);
input_reg = iterator->Next(); ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
input_value = input_->GetRegister(input_reg); intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
output_frame->SetRegister(a0.code(), input_value); output_frame->SetRegister(s0.code(), descriptor->register_param_count_);
output_frame->SetRegister(s1.code(),
(descriptor->register_param_count_ - 1) * kPointerSize);
output_frame->SetRegister(s2.code(), handler);
ASSERT(frame_index == 0); ASSERT(frame_index == 0);
output_[frame_index] = output_frame; output_[frame_index] = output_frame;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment