| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" | 5 #include "vm/globals.h" |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 7 | 7 |
| 8 #include "vm/instructions.h" | 8 #include "vm/instructions.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/stack_frame.h" | 10 #include "vm/stack_frame.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the | 14 // The constant kExitLinkOffsetInEntryFrame must be kept in sync with the |
| 15 // code in the InvokeDartCode stub. | 15 // code in the InvokeDartCode stub. |
| 16 static const int kSavedContextOffsetInEntryFrame = -9 * kWordSize; |
| 16 static const int kExitLinkOffsetInEntryFrame = -8 * kWordSize; | 17 static const int kExitLinkOffsetInEntryFrame = -8 * kWordSize; |
| 17 static const int kPcAddressOffsetFromSp = -1 * kWordSize; | 18 static const int kPcAddressOffsetFromSp = -1 * kWordSize; |
| 18 static const int kSpOffsetFromPreviousFp = 2 * kWordSize; | 19 static const int kSpOffsetFromPreviousFp = 2 * kWordSize; |
| 19 | 20 |
| 20 | 21 |
| 21 intptr_t StackFrame::PcAddressOffsetFromSp() { | 22 intptr_t StackFrame::PcAddressOffsetFromSp() { |
| 22 return kPcAddressOffsetFromSp; | 23 return kPcAddressOffsetFromSp; |
| 23 } | 24 } |
| 24 | 25 |
| 25 | 26 |
| 26 uword StackFrame::GetCallerSp() const { | 27 uword StackFrame::GetCallerSp() const { |
| 27 return fp() + kSpOffsetFromPreviousFp; | 28 return fp() + kSpOffsetFromPreviousFp; |
| 28 } | 29 } |
| 29 | 30 |
| 30 | 31 |
| 31 uword StackFrame::GetCallerFp() const { | 32 uword StackFrame::GetCallerFp() const { |
| 32 return *(reinterpret_cast<uword*>(fp())); | 33 return *(reinterpret_cast<uword*>(fp())); |
| 33 } | 34 } |
| 34 | 35 |
| 35 | 36 |
| 36 intptr_t EntryFrame::ExitLinkOffset() { | 37 intptr_t EntryFrame::ExitLinkOffset() const { |
| 37 return kExitLinkOffsetInEntryFrame; | 38 return kExitLinkOffsetInEntryFrame; |
| 38 } | 39 } |
| 39 | 40 |
| 40 | 41 |
| 42 intptr_t EntryFrame::SavedContextOffset() const { |
| 43 return kSavedContextOffsetInEntryFrame; |
| 44 } |
| 45 |
| 46 |
| 41 void StackFrameIterator::SetupLastExitFrameData() { | 47 void StackFrameIterator::SetupLastExitFrameData() { |
| 42 Isolate* current = Isolate::Current(); | 48 Isolate* current = Isolate::Current(); |
| 43 uword exit_marker = current->top_exit_frame_info(); | 49 uword exit_marker = current->top_exit_frame_info(); |
| 44 frames_.fp_ = exit_marker; | 50 frames_.fp_ = exit_marker; |
| 45 } | 51 } |
| 46 | 52 |
| 47 | 53 |
| 48 void StackFrameIterator::SetupNextExitFrameData() { | 54 void StackFrameIterator::SetupNextExitFrameData() { |
| 49 uword exit_address = entry_.fp() + kExitLinkOffsetInEntryFrame; | 55 uword exit_address = entry_.fp() + kExitLinkOffsetInEntryFrame; |
| 50 uword exit_marker = *reinterpret_cast<uword*>(exit_address); | 56 uword exit_marker = *reinterpret_cast<uword*>(exit_address); |
| 51 frames_.fp_ = exit_marker; | 57 frames_.fp_ = exit_marker; |
| 52 frames_.sp_ = 0; | 58 frames_.sp_ = 0; |
| 53 } | 59 } |
| 54 | 60 |
| 55 } // namespace dart | 61 } // namespace dart |
| 56 | 62 |
| 57 #endif // defined TARGET_ARCH_X64 | 63 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |