Revision: 13320
Author: [email protected]
Date: Mon Jan 7 02:06:11 2013
Log: Generalize calling to C++ on stub deopt
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.
Review URL: https://codereview.chromium.org/11635015
http://code.google.com/p/v8/source/detail?r=13320
Modified:
/branches/bleeding_edge/src/arm/builtins-arm.cc
/branches/bleeding_edge/src/arm/code-stubs-arm.cc
/branches/bleeding_edge/src/arm/deoptimizer-arm.cc
/branches/bleeding_edge/src/builtins.h
/branches/bleeding_edge/src/code-stubs.h
/branches/bleeding_edge/src/ia32/builtins-ia32.cc
/branches/bleeding_edge/src/ia32/code-stubs-ia32.cc
/branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc
/branches/bleeding_edge/src/ic.h
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/runtime.h
/branches/bleeding_edge/src/x64/builtins-x64.cc
/branches/bleeding_edge/src/x64/code-stubs-x64.cc
/branches/bleeding_edge/src/x64/deoptimizer-x64.cc
/branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js
=======================================
--- /branches/bleeding_edge/src/arm/builtins-arm.cc Mon Jan 7 01:43:12 2013
+++ /branches/bleeding_edge/src/arm/builtins-arm.cc Mon Jan 7 02:06:11 2013
@@ -1259,7 +1259,7 @@
#undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
-void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) {
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -1268,7 +1268,7 @@
// registers.
__ stm(db_w, sp, kJSCallerSaved | kCalleeSaved);
// Pass the function and deoptimization type to the runtime system.
- __ CallRuntime(Runtime::kNotifyICMiss, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0);
__ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved);
}
=======================================
--- /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Jan 7 01:43:12
2013
+++ /branches/bleeding_edge/src/arm/code-stubs-arm.cc Mon Jan 7 02:06:11
2013
@@ -44,7 +44,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- isolate->builtins()->KeyedLoadIC_Miss();
+ FUNCTION_ADDR(KeyedLoadIC_Miss);
}
=======================================
--- /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Mon Jan 7 01:43:12
2013
+++ /branches/bleeding_edge/src/arm/deoptimizer-arm.cc Mon Jan 7 02:06:11
2013
@@ -458,35 +458,39 @@
// 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
- // | | saved frame (fp) |
- // | +=========================+<-fp
- // | | JSFunction context |
- // v +-------------------------+
- // | COMPILED_STUB marker | fp = saved frame
- // +-------------------------+ f8 = JSFunction context
- // | |
- // | ... |
- // | |
- // +-------------------------+<-sp
+ // | | r0 = number of parameters
+ // | ... | r1 = failure handler address
+ // | | fp = saved frame
+ // +-------------------------+<-sp cp = JSFunction context
//
//
- 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);
int major_key = compiled_code_->major_key();
CodeStubInterfaceDescriptor* descriptor =
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();
intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
output_frame->SetFrameSlot(0, value);
@@ -496,20 +500,23 @@
value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
output_frame->SetRegister(cp.code(), value);
- Translation::Opcode opcode =
- static_cast<Translation::Opcode>(iterator->Next());
- ASSERT(opcode == Translation::REGISTER);
- USE(opcode);
- int input_reg = iterator->Next();
- intptr_t input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(r1.code(), input_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;
+ }
- int32_t next = iterator->Next();
- opcode = static_cast<Translation::Opcode>(next);
- ASSERT(opcode == Translation::REGISTER);
- input_reg = iterator->Next();
- input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(r0.code(), input_value);
+ ApiFunction function(descriptor->deoptimization_handler_);
+ ExternalReference xref(&function, ExternalReference::BUILTIN_CALL,
isolate_);
+ intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
+ output_frame->SetRegister(r0.code(), descriptor->register_param_count_);
+ output_frame->SetRegister(r1.code(), handler);
ASSERT(frame_index == 0);
output_[frame_index] = output_frame;
=======================================
--- /branches/bleeding_edge/src/builtins.h Tue Dec 18 08:25:45 2012
+++ /branches/bleeding_edge/src/builtins.h Mon Jan 7 02:06:11 2013
@@ -107,7 +107,7 @@
Code::kNoExtraICState) \
V(NotifyLazyDeoptimized, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
- V(NotifyICMiss, BUILTIN, UNINITIALIZED, \
+ V(NotifyStubFailure, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
V(NotifyOSR, BUILTIN, UNINITIALIZED, \
Code::kNoExtraICState) \
@@ -388,7 +388,7 @@
static void Generate_NotifyDeoptimized(MacroAssembler* masm);
static void Generate_NotifyLazyDeoptimized(MacroAssembler* masm);
static void Generate_NotifyOSR(MacroAssembler* masm);
- static void Generate_NotifyICMiss(MacroAssembler* masm);
+ static void Generate_NotifyStubFailure(MacroAssembler* masm);
static void Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm);
static void Generate_FunctionCall(MacroAssembler* masm);
=======================================
--- /branches/bleeding_edge/src/code-stubs.h Tue Dec 18 08:25:45 2012
+++ /branches/bleeding_edge/src/code-stubs.h Mon Jan 7 02:06:11 2013
@@ -247,7 +247,7 @@
register_params_(NULL) { }
int register_param_count_;
Register* register_params_;
- Handle<Code> deoptimization_handler_;
+ Address deoptimization_handler_;
};
=======================================
--- /branches/bleeding_edge/src/ia32/builtins-ia32.cc Fri Dec 28 03:09:16
2012
+++ /branches/bleeding_edge/src/ia32/builtins-ia32.cc Mon Jan 7 02:06:11
2013
@@ -575,7 +575,7 @@
#undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
-void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) {
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
// Enter an internal frame.
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -584,7 +584,7 @@
// stubs that tail call the runtime on deopts passing their parameters
in
// registers.
__ pushad();
- __ CallRuntime(Runtime::kNotifyICMiss, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0);
__ popad();
// Tear down internal frame.
}
=======================================
--- /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Fri Jan 4 02:56:24
2013
+++ /branches/bleeding_edge/src/ia32/code-stubs-ia32.cc Mon Jan 7 02:06:11
2013
@@ -48,7 +48,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- isolate->builtins()->KeyedLoadIC_Miss();
+ FUNCTION_ADDR(KeyedLoadIC_Miss);
}
=======================================
--- /branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc Fri Jan 4
02:56:24 2013
+++ /branches/bleeding_edge/src/ia32/deoptimizer-ia32.cc Mon Jan 7
02:06:11 2013
@@ -565,35 +565,39 @@
// FROM TO
<-ebp
// | .... | | .... |
// +-------------------------+ +-------------------------+
- // | JSFunction continuation | | JSFunction continuation |
+ // | JSFunction continuation | | parameter 1 |
+ // +-------------------------+ +-------------------------+
+ // | | saved frame (ebp) | | .... |
+ // | +=========================+<-ebp +-------------------------+
+ // | | JSFunction context | | parameter n |
+ // v +-------------------------+ +-------------------------|
+ // | COMPILED_STUB marker | | JSFunction continuation |
// +-------------------------+
+-------------------------+<-esp
- // | | saved frame (ebp) |
- // | +=========================+<-ebp
- // | | JSFunction context |
- // v +-------------------------+
- // | COMPILED_STUB marker | ebp = saved frame
- // +-------------------------+ esi = JSFunction context
- // | |
- // | ... |
- // | |
- // +-------------------------+<-esp
+ // | | eax = number of parameters
+ // | ... | ebx = failure handler address
+ // | | ebp = saved frame
+ // +-------------------------+<-esp esi = JSFunction context
//
//
- 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<uint32_t>(notify_miss->entry()));
ASSERT(compiled_code_->kind() == Code::COMPILED_STUB);
int major_key = compiled_code_->major_key();
CodeStubInterfaceDescriptor* descriptor =
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();
intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
output_frame->SetFrameSlot(0, value);
@@ -603,20 +607,22 @@
value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
output_frame->SetRegister(esi.code(), value);
- Translation::Opcode opcode =
- static_cast<Translation::Opcode>(iterator->Next());
- ASSERT(opcode == Translation::REGISTER);
- USE(opcode);
- int input_reg = iterator->Next();
- intptr_t input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(edx.code(), input_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;
+ }
- int32_t next = iterator->Next();
- opcode = static_cast<Translation::Opcode>(next);
- ASSERT(opcode == Translation::REGISTER);
- input_reg = iterator->Next();
- input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(ecx.code(), input_value);
+ intptr_t handler =
+ reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
+ output_frame->SetRegister(eax.code(), descriptor->register_param_count_);
+ output_frame->SetRegister(ebx.code(), handler);
ASSERT(frame_index == 0);
output_[frame_index] = output_frame;
=======================================
--- /branches/bleeding_edge/src/ic.h Fri Jan 4 07:37:59 2013
+++ /branches/bleeding_edge/src/ic.h Mon Jan 7 02:06:11 2013
@@ -854,6 +854,8 @@
enum InlinedSmiCheck { ENABLE_INLINED_SMI_CHECK, DISABLE_INLINED_SMI_CHECK
};
void PatchInlinedSmiCode(Address address, InlinedSmiCheck check);
+DECLARE_RUNTIME_FUNCTION(MaybeObject*, KeyedLoadIC_Miss);
+
} } // namespace v8::internal
#endif // V8_IC_H_
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Dec 31 03:13:50 2012
+++ /branches/bleeding_edge/src/runtime.cc Mon Jan 7 02:06:11 2013
@@ -7889,7 +7889,7 @@
};
-RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyICMiss) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_NotifyStubFailure) {
HandleScope scope(isolate);
ASSERT(args.length() == 0);
Deoptimizer* deoptimizer = Deoptimizer::Grab(isolate);
=======================================
--- /branches/bleeding_edge/src/runtime.h Mon Dec 31 03:13:50 2012
+++ /branches/bleeding_edge/src/runtime.h Mon Jan 7 02:06:11 2013
@@ -89,7 +89,7 @@
F(ForceParallelRecompile, 1, 1) \
F(InstallRecompiledCode, 1, 1) \
F(NotifyDeoptimized, 1, 1) \
- F(NotifyICMiss, 0, 1) \
+ F(NotifyStubFailure, 0, 1) \
F(NotifyOSR, 0, 1) \
F(DeoptimizeFunction, 1, 1) \
F(ClearFunctionTypeFeedback, 1, 1) \
=======================================
--- /branches/bleeding_edge/src/x64/builtins-x64.cc Tue Dec 18 08:25:45 2012
+++ /branches/bleeding_edge/src/x64/builtins-x64.cc Mon Jan 7 02:06:11 2013
@@ -646,7 +646,7 @@
#undef DEFINE_CODE_AGE_BUILTIN_GENERATOR
-void Builtins::Generate_NotifyICMiss(MacroAssembler* masm) {
+void Builtins::Generate_NotifyStubFailure(MacroAssembler* masm) {
// Enter an internal frame.
{
FrameScope scope(masm, StackFrame::INTERNAL);
@@ -655,7 +655,7 @@
// stubs that tail call the runtime on deopts passing their parameters
in
// registers.
__ Pushad();
- __ CallRuntime(Runtime::kNotifyICMiss, 0);
+ __ CallRuntime(Runtime::kNotifyStubFailure, 0);
__ Popad();
// Tear down internal frame.
}
=======================================
--- /branches/bleeding_edge/src/x64/code-stubs-x64.cc Thu Jan 3 06:20:08
2013
+++ /branches/bleeding_edge/src/x64/code-stubs-x64.cc Mon Jan 7 02:06:11
2013
@@ -44,7 +44,7 @@
descriptor->register_param_count_ = 2;
descriptor->register_params_ = registers;
descriptor->deoptimization_handler_ =
- isolate->builtins()->KeyedLoadIC_Miss();
+ FUNCTION_ADDR(KeyedLoadIC_Miss);
}
=======================================
--- /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Thu Jan 3 06:20:08
2013
+++ /branches/bleeding_edge/src/x64/deoptimizer-x64.cc Mon Jan 7 02:06:11
2013
@@ -454,35 +454,39 @@
// FROM TO
<-rbp
// | .... | | .... |
// +-------------------------+ +-------------------------+
- // | JSFunction continuation | | JSFunction continuation |
+ // | JSFunction continuation | | parameter 1 |
+ // +-------------------------+ +-------------------------+
+ // | | saved frame (rbp) | | .... |
+ // | +=========================+<-rbp +-------------------------+
+ // | | JSFunction context | | parameter n |
+ // v +-------------------------+ +-------------------------|
+ // | COMPILED_STUB marker | | JSFunction continuation |
// +-------------------------+
+-------------------------+<-rsp
- // | | saved frame (rbp) |
- // | +=========================+<-rbp
- // | | JSFunction context |
- // v +-------------------------+
- // | COMPILED_STUB marker | rbp = saved frame
- // +-------------------------+ rsi = JSFunction context
- // | |
- // | ... |
- // | |
- // +-------------------------+<-rsp
+ // | | rax = number of parameters
+ // | ... | rbx = failure handler address
+ // | | rbp = saved frame
+ // +-------------------------+<-rsp rsi = JSFunction context
//
//
- 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);
int major_key = compiled_code_->major_key();
CodeStubInterfaceDescriptor* descriptor =
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<intptr_t>(notify_failure->entry()));
+
+ Code* code;
+ CEntryStub(1, kDontSaveFPRegs).FindCodeInCache(&code, isolate_);
+
output_frame->SetPc(reinterpret_cast<intptr_t>(code->instruction_start()));
unsigned input_frame_size = input_->GetFrameSize();
intptr_t value = input_->GetFrameSlot(input_frame_size - kPointerSize);
output_frame->SetFrameSlot(0, value);
@@ -492,20 +496,22 @@
value = input_->GetFrameSlot(input_frame_size - 3 * kPointerSize);
output_frame->SetRegister(rsi.code(), value);
- Translation::Opcode opcode =
- static_cast<Translation::Opcode>(iterator->Next());
- ASSERT(opcode == Translation::REGISTER);
- USE(opcode);
- int input_reg = iterator->Next();
- intptr_t input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(rdx.code(), input_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;
+ }
- int32_t next = iterator->Next();
- opcode = static_cast<Translation::Opcode>(next);
- ASSERT(opcode == Translation::REGISTER);
- input_reg = iterator->Next();
- input_value = input_->GetRegister(input_reg);
- output_frame->SetRegister(rax.code(), input_value);
+ intptr_t handler =
+ reinterpret_cast<intptr_t>(descriptor->deoptimization_handler_);
+ output_frame->SetRegister(rax.code(), descriptor->register_param_count_);
+ output_frame->SetRegister(rbx.code(), handler);
ASSERT(frame_index == 0);
output_[frame_index] = output_frame;
=======================================
--- /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Tue Dec 18
08:25:45 2012
+++ /branches/bleeding_edge/test/mjsunit/fuzz-natives-part1.js Mon Jan 7
02:06:11 2013
@@ -152,7 +152,7 @@
"LazyRecompile": true,
"ParallelRecompile": true,
"NotifyDeoptimized": true,
- "NotifyICMiss": true,
+ "NotifyStubFailure": true,
"NotifyOSR": true,
"CreateObjectLiteralBoilerplate": true,
"CloneLiteralBoilerplate": true,
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev