Chromium Code Reviews| Index: runtime/vm/deopt_instructions.cc |
| diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc |
| index 1d892390b26581805b5e3e117a95f4422eb65045..d3a9a78f3166685c9c8112c33b17b4c2f04a8cc2 100644 |
| --- a/runtime/vm/deopt_instructions.cc |
| +++ b/runtime/vm/deopt_instructions.cc |
| @@ -66,14 +66,24 @@ DeoptContext::DeoptContext(const StackFrame* frame, |
| // optimized function contains FP, PP (ARM and MIPS only), PC-marker and |
| // return-address. This section is copied as well, so that its contained |
| // values can be updated before returning to the deoptimized function. |
| + // Note: on DBC stack grows upwards unlike on all other architectures. |
| source_frame_size_ = |
| + kDartFrameFixedSize // For saved values below sp. |
| +#if !defined(TARGET_ARCH_DBC) |
| + ((frame->fp() - frame->sp()) / kWordSize) // For frame size incl. sp. |
| +#else |
| + + ((frame->sp() - frame->fp()) / kWordSize) // For frame size incl. sp. |
|
Florian Schneider
2016/05/19 13:21:39
In generate it would be nice to encapsulate more o
Vyacheslav Egorov (Google)
2016/05/19 15:19:40
I will keep this code without a helper for now.
|
| +#endif // !defined(TARGET_ARCH_DBC) |
| + 1 // For fp. |
| + kParamEndSlotFromFp // For saved values above fp. |
| + num_args_; // For arguments. |
| +#if !defined(TARGET_ARCH_DBC) |
| source_frame_ = reinterpret_cast<intptr_t*>( |
| frame->sp() - (kDartFrameFixedSize * kWordSize)); |
| +#else |
|
Florian Schneider
2016/05/19 13:21:39
A helper FrameStart(frame)?
Vyacheslav Egorov (Google)
2016/05/19 15:19:40
Done.
|
| + source_frame_ = reinterpret_cast<intptr_t*>( |
| + frame->fp() - (kDartFrameFixedSize + num_args_) * kWordSize); |
| +#endif // !defined(TARGET_ARCH_DBC) |
| if (dest_options == kDestIsOriginalFrame) { |
| // Work from a copy of the source frame. |
| @@ -182,29 +192,46 @@ void DeoptContext::VisitObjectPointers(ObjectPointerVisitor* visitor) { |
| intptr_t DeoptContext::DestStackAdjustment() const { |
| - return (dest_frame_size_ |
| - - kDartFrameFixedSize |
| - - num_args_ |
| - - kParamEndSlotFromFp |
| - - 1); // For fp. |
| + return dest_frame_size_ |
| + - kDartFrameFixedSize |
| + - num_args_ |
| +#if !defined(TARGET_ARCH_DBC) |
| + - 1 // For fp. |
| +#endif |
| + - kParamEndSlotFromFp; |
| } |
| intptr_t DeoptContext::GetSourceFp() const { |
| +#if !defined(TARGET_ARCH_DBC) |
| return source_frame_[source_frame_size_ - 1 - num_args_ - |
| kParamEndSlotFromFp]; |
| +#else |
| + return source_frame_[num_args_ + kDartFrameFixedSize + |
| + kSavedCallerFpSlotFromFp]; |
| +#endif |
| } |
| intptr_t DeoptContext::GetSourcePp() const { |
| +#if !defined(TARGET_ARCH_DBC) |
| return source_frame_[source_frame_size_ - 1 - num_args_ - |
| kParamEndSlotFromFp + |
| StackFrame::SavedCallerPpSlotFromFp()]; |
| +#else |
| + UNREACHABLE(); |
| + return 0; |
| +#endif |
| } |
| intptr_t DeoptContext::GetSourcePc() const { |
| +#if !defined(TARGET_ARCH_DBC) |
| return source_frame_[source_frame_size_ - num_args_ + kSavedPcSlotFromSp]; |
| +#else |
| + return source_frame_[num_args_ + kDartFrameFixedSize + |
| + kSavedCallerPcSlotFromFp]; |
| +#endif |
| } |
| @@ -305,12 +332,12 @@ void DeoptContext::FillDestFrame() { |
| } |
| if (FLAG_trace_deoptimization_verbose) { |
| - intptr_t* start = dest_frame_; |
| for (intptr_t i = 0; i < frame_size; i++) { |
| - OS::PrintErr("*%" Pd ". [0x%" Px "] 0x%" Px " [%s]\n", |
| + intptr_t* to_addr = GetDestFrameAddressAt(i); |
| + OS::PrintErr("*%" Pd ". [%p] 0x%" Px " [%s]\n", |
| i, |
| - reinterpret_cast<uword>(&start[i]), |
| - start[i], |
| + to_addr, |
| + *to_addr, |
| deopt_instructions[i + (len - frame_size)]->ToCString()); |
| } |
| } |
| @@ -660,12 +687,9 @@ class DeoptPcMarkerInstr : public DeoptInstr { |
| Function& function = Function::Handle(deopt_context->zone()); |
| function ^= deopt_context->ObjectAt(object_table_index_); |
| if (function.IsNull()) { |
| - // There are no deoptimization stubs on DBC. |
| -#if !defined(TARGET_ARCH_DBC) |
| *reinterpret_cast<RawObject**>(dest_addr) = deopt_context->is_lazy_deopt() |
| ? StubCode::DeoptimizeLazy_entry()->code() |
| : StubCode::Deoptimize_entry()->code(); |
| -#endif |
| return; |
| } |
| @@ -729,7 +753,7 @@ class DeoptCallerFpInstr : public DeoptInstr { |
| void Execute(DeoptContext* deopt_context, intptr_t* dest_addr) { |
| *dest_addr = deopt_context->GetCallerFp(); |
| deopt_context->SetCallerFp(reinterpret_cast<intptr_t>( |
| - dest_addr - (kSavedCallerFpSlotFromFp * kWordSize))); |
|
zra
2016/05/19 16:24:27
Oof. How was this working?
Vyacheslav Egorov (Google)
2016/05/20 12:11:47
kSavedCallerFpSlotFromFp is 0 on all architectures
|
| + dest_addr - kSavedCallerFpSlotFromFp)); |
| } |
| private: |