Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Unified Diff: src/arm/deoptimizer-arm.cc

Issue 12220074: Compile FastCloneShallowObjectStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/arm/deoptimizer-arm.cc
diff --git a/src/arm/deoptimizer-arm.cc b/src/arm/deoptimizer-arm.cc
index 06415edadaf5dd6e3a4a31a75fdf6af1f80984fb..190dd7667919a8e707b74464d570658eae5720ed 100644
--- a/src/arm/deoptimizer-arm.cc
+++ b/src/arm/deoptimizer-arm.cc
@@ -452,8 +452,8 @@ void Deoptimizer::DoComputeArgumentsAdaptorFrame(TranslationIterator* iterator,
}
-void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
- int frame_index) {
+void Deoptimizer::DoComputeCompiledStubFrame(TranslationIterator* iterator,
+ int frame_index) {
//
// FROM TO
// | .... | | .... |
@@ -466,9 +466,9 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
// v +-------------------------+ +-------------------------|
// | COMPILED_STUB marker | | STUB_FAILURE marker |
// +-------------------------+ +-------------------------+
- // | | | caller args.length_ |
- // | ... | +-------------------------+
// | | | caller args.arguments_ |
+ // | ... | +-------------------------+
+ // | | | caller args.length_ |
// |-------------------------|<-sp +-------------------------+
// | caller args pointer |
// +-------------------------+
@@ -490,58 +490,77 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
isolate_->code_stub_interface_descriptor(major_key);
// The output frame must have room for all pushed register parameters
- // and the standard stack frame slots.
- int output_frame_size = StandardFrameConstants::kFixedFrameSize +
- kPointerSize * descriptor->register_param_count_;
-
- // Include space for an argument object to the callee and optionally
- // the space to pass the argument object to the stub failure handler.
- output_frame_size += sizeof(Arguments) + kPointerSize;
+ // and the standard stack frame slots. Include space for an argument
+ // object to the callee and optionally the space to pass the argument
+ // object to the stub failure handler.
+ int height_in_bytes = kPointerSize * descriptor->register_param_count_ +
+ sizeof(Arguments) + kPointerSize;
+ int fixed_frame_size = StandardFrameConstants::kFixedFrameSize;
+ int input_frame_size = input_->GetFrameSize();
+ int output_frame_size = height_in_bytes + fixed_frame_size;
+ if (trace_) {
+ PrintF(" translating %s => StubFailureTrampolineStub, height=%d\n",
+ CodeStub::MajorName(static_cast<CodeStub::Major>(major_key), false),
+ height_in_bytes);
+ }
+ // The stub failure trampoline is a single frame.
FrameDescription* output_frame =
- new(output_frame_size) FrameDescription(output_frame_size, 0);
+ new(output_frame_size) FrameDescription(output_frame_size, NULL);
+ output_frame->SetFrameType(StackFrame::STUB_FAILURE_TRAMPOLINE);
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<intptr_t>(notify_failure->entry()));
- Code* trampoline = NULL;
- int extra = descriptor->extra_expression_stack_count_;
- StubFailureTrampolineStub(extra).FindCodeInCache(&trampoline, isolate_);
- ASSERT(trampoline != NULL);
- output_frame->SetPc(reinterpret_cast<intptr_t>(
- trampoline->instruction_start()));
- unsigned input_frame_size = input_->GetFrameSize();
-
- intptr_t frame_ptr = input_->GetRegister(fp.code());
+ // The top address for the output frame can be computed from the input
+ // frame pointer and the output frame's height. Subtract space for the
+ // context and function slots.
+ intptr_t top_address = input_->GetRegister(fp.code()) - (2 * kPointerSize) -
+ height_in_bytes;
+ output_frame->SetTop(top_address);
- // JSFunction continuation
+ // Read caller's PC (JSFunction continuation) from the input frame.
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);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's pc\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
- // saved frame ptr
+ // Read caller's FP from the input frame, and set this frame's FP.
input_frame_offset -= kPointerSize;
value = input_->GetFrameSlot(input_frame_offset);
output_frame_offset -= kPointerSize;
output_frame->SetFrameSlot(output_frame_offset, value);
+ intptr_t frame_ptr = input_->GetRegister(fp.code());
+ output_frame->SetRegister(fp.code(), frame_ptr);
+ output_frame->SetFp(frame_ptr);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; caller's fp\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
- // Restore context
+ // The context can be gotten from the input frame.
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);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; context\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
- // Internal frame markers
+ // A marker value is used in place of the function.
output_frame_offset -= kPointerSize;
value = reinterpret_cast<intptr_t>(
Smi::FromInt(StackFrame::STUB_FAILURE_TRAMPOLINE));
output_frame->SetFrameSlot(output_frame_offset, value);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; function (stub fail sentinel)\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
int caller_arg_count = 0;
if (descriptor->stack_parameter_count_ != NULL) {
@@ -554,15 +573,27 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
value = frame_ptr + StandardFrameConstants::kCallerSPOffset +
(caller_arg_count - 1) * kPointerSize;
output_frame->SetFrameSlot(output_frame_offset, value);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; args.arguments\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
- output_frame->SetFrameSlot(output_frame_offset, value);
output_frame_offset -= kPointerSize;
- output_frame->SetFrameSlot(output_frame_offset, caller_arg_count);
+ value = caller_arg_count;
+ output_frame->SetFrameSlot(output_frame_offset, value);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; args.length\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
- value = frame_ptr - (output_frame_size - output_frame_offset) -
- StandardFrameConstants::kMarkerOffset;
output_frame_offset -= kPointerSize;
+ value = frame_ptr - (output_frame_size - output_frame_offset) -
+ StandardFrameConstants::kMarkerOffset + kPointerSize;
output_frame->SetFrameSlot(output_frame_offset, value);
+ if (trace_) {
+ PrintF(" 0x%08x: [top + %d] <- 0x%08x ; args*\n",
+ top_address + output_frame_offset, output_frame_offset, value);
+ }
// Copy the register parameters to the failure frame.
for (int i = 0; i < descriptor->register_param_count_; ++i) {
@@ -570,14 +601,13 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
DoTranslateCommand(iterator, 0, output_frame_offset);
}
+ ASSERT(0 == output_frame_offset);
+
for (int i = 0; i < DwVfpRegister::kMaxNumRegisters; ++i) {
double double_value = input_->GetDoubleRegister(i);
output_frame->SetDoubleRegister(i, double_value);
}
- output_frame->SetRegister(fp.code(), frame_ptr);
- output_frame->SetFp(frame_ptr);
-
ApiFunction function(descriptor->deoptimization_handler_);
ExternalReference xref(&function, ExternalReference::BUILTIN_CALL, isolate_);
intptr_t handler = reinterpret_cast<intptr_t>(xref.address());
@@ -587,6 +617,19 @@ void Deoptimizer::DoCompiledStubFrame(TranslationIterator* iterator,
}
output_frame->SetRegister(r0.code(), params);
output_frame->SetRegister(r1.code(), handler);
+
+ // Compute this frame's PC, state, and continuation.
+ Code* trampoline = NULL;
+ int extra = descriptor->extra_expression_stack_count_;
+ StubFailureTrampolineStub(extra).FindCodeInCache(&trampoline, isolate_);
+ ASSERT(trampoline != NULL);
+ output_frame->SetPc(reinterpret_cast<intptr_t>(
+ trampoline->instruction_start()));
+ output_frame->SetState(Smi::FromInt(FullCodeGenerator::NO_REGISTERS));
+ Code* notify_failure =
+ isolate_->builtins()->builtin(Builtins::kNotifyStubFailure);
+ output_frame->SetContinuation(
+ reinterpret_cast<intptr_t>(notify_failure->entry()));
}
« no previous file with comments | « src/arm/code-stubs-arm.cc ('k') | src/arm/full-codegen-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698