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

Unified Diff: runtime/vm/stack_frame_x64.cc

Issue 8984003: Port code generator to x64. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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 | « runtime/vm/stack_frame_test.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stack_frame_x64.cc
===================================================================
--- runtime/vm/stack_frame_x64.cc (revision 2556)
+++ runtime/vm/stack_frame_x64.cc (working copy)
@@ -5,6 +5,8 @@
#include "vm/globals.h"
#if defined(TARGET_ARCH_X64)
+#include "vm/instructions.h"
+#include "vm/isolate.h"
#include "vm/stack_frame.h"
namespace dart {
@@ -12,39 +14,55 @@
// The constant kExitLinkOffsetInEntryFrame must be kept in sync with the
// code in the InvokeDartCode stub.
static const int kExitLinkOffsetInEntryFrame = -8 * kWordSize;
+static const int kPcAddressOffsetFromSp = -1 * kWordSize;
+static const int kSpOffsetFromPreviousFp = 2 * kWordSize;
-intptr_t StackFrame::PcAddressOffsetFromSp() {
- UNIMPLEMENTED();
- return 0;
+static bool ExitedFromStub(uword exit_marker) {
+ if (exit_marker != 0) {
+ uword caller_pc = *reinterpret_cast<uword*>(exit_marker + kWordSize);
+ uword call_instr_pc = caller_pc - Call::InstructionLength();
+ uword call_target = Call(call_instr_pc).TargetAddress();
+ return StubCode::InStubCallToRuntimeStubCode(call_target);
+ }
+ return false;
}
-uword StackFrame::GetCallerFp() const {
- UNIMPLEMENTED();
- return 0;
+intptr_t StackFrame::PcAddressOffsetFromSp() {
+ return kPcAddressOffsetFromSp;
}
uword StackFrame::GetCallerSp() const {
- UNIMPLEMENTED();
- return 0;
+ return fp() + kSpOffsetFromPreviousFp;
}
+uword StackFrame::GetCallerFp() const {
+ return *(reinterpret_cast<uword*>(fp()));
+}
+
+
intptr_t EntryFrame::ExitLinkOffset() {
- UNIMPLEMENTED();
- return 0;
+ return kExitLinkOffsetInEntryFrame;
}
void StackFrameIterator::SetupLastExitFrameData() {
- UNIMPLEMENTED();
+ Isolate* current = Isolate::Current();
+ uword exit_marker = current->top_exit_frame_info();
+ frames_.fp_ = exit_marker;
+ frames_.from_stub_exitframe_ = ExitedFromStub(exit_marker);
}
void StackFrameIterator::SetupNextExitFrameData() {
- UNIMPLEMENTED();
+ uword exit_address = entry_.fp() + kExitLinkOffsetInEntryFrame;
+ uword exit_marker = *reinterpret_cast<uword*>(exit_address);
+ frames_.fp_ = exit_marker;
+ frames_.from_stub_exitframe_ = ExitedFromStub(exit_marker);
+ frames_.sp_ = 0;
}
} // namespace dart
« no previous file with comments | « runtime/vm/stack_frame_test.cc ('k') | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698