| Index: runtime/vm/deopt_instructions.cc
|
| diff --git a/runtime/vm/deopt_instructions.cc b/runtime/vm/deopt_instructions.cc
|
| index 1d892390b26581805b5e3e117a95f4422eb65045..1839f7fae8a14eb760f594f2148744adb99bc4f8 100644
|
| --- a/runtime/vm/deopt_instructions.cc
|
| +++ b/runtime/vm/deopt_instructions.cc
|
| @@ -66,14 +66,19 @@ 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.
|
| +#endif // !defined(TARGET_ARCH_DBC)
|
| + 1 // For fp.
|
| + kParamEndSlotFromFp // For saved values above fp.
|
| + num_args_; // For arguments.
|
| - source_frame_ = reinterpret_cast<intptr_t*>(
|
| - frame->sp() - (kDartFrameFixedSize * kWordSize));
|
| +
|
| + source_frame_ = FrameBase(frame);
|
|
|
| if (dest_options == kDestIsOriginalFrame) {
|
| // Work from a copy of the source frame.
|
| @@ -182,29 +187,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 +327,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 +682,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 +748,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)));
|
| + dest_addr - kSavedCallerFpSlotFromFp));
|
| }
|
|
|
| private:
|
|
|