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

Unified Diff: runtime/vm/stub_code_x64.cc

Issue 23480098: Setup the pool pointer when entering Dart from C++ so the intrinsic functions may rely on it being … (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 7 years, 3 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 | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/stub_code_x64.cc
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index a9d37774359b79ddd33f53a1694a47713f6be9bc..7d4761864830d222144ad6ffd1ad1fdee5d3b55f 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -765,12 +765,20 @@ void StubCode::GenerateCallClosureFunctionStub(Assembler* assembler) {
// RCX : new context containing the current isolate pointer.
void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
// Save frame pointer coming in.
- __ EnterStubFrame();
+ __ EnterStubFrameWithPP();
+
+ // At this point, the stack looks like:
+ // | saved RC15/PP | <-- RSP / TOS
+ // | "saved PC area" = 0 |
+ // | saved RBP | <-- RBP
+ // | saved PC (return to DartEntry::InvokeFunction) |
+ // The old frame pointer, the return address, the old R15 (for PP).
+ const intptr_t kInitialOffset = 3;
// Save arguments descriptor array and new context.
- const intptr_t kArgumentsDescOffset = -2 * kWordSize;
+ const intptr_t kArgumentsDescOffset = -(kInitialOffset) * kWordSize;
__ pushq(RSI);
- const intptr_t kNewContextOffset = -3 * kWordSize;
+ const intptr_t kNewContextOffset = -(kInitialOffset + 1) * kWordSize;
__ pushq(RCX);
// Save C++ ABI callee-saved registers.
@@ -778,7 +786,11 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
__ pushq(R12);
__ pushq(R13);
__ pushq(R14);
- __ pushq(R15);
+ // R15 is already saved above by EnterStubFrameWithPP.
+
+ // If any additional (or fewer) values are pushed, the offsets in
+ // kExitLinkSlotFromEntryFp and kSavedContextSlotFromEntryFp will need to be
+ // changed.
// The new Context structure contains a pointer to the current Isolate
// structure. Cache the Context pointer in the CTX register so that it is
@@ -866,14 +878,14 @@ void StubCode::GenerateInvokeDartCodeStub(Assembler* assembler) {
__ movq(Address(CTX, Isolate::top_exit_frame_info_offset()), RDX);
// Restore C++ ABI callee-saved registers.
- __ popq(R15);
+ // R15 will be restored below by LeaveFrameWithPP.
__ popq(R14);
__ popq(R13);
__ popq(R12);
__ popq(RBX);
// Restore the frame pointer.
- __ LeaveFrame();
+ __ LeaveFrameWithPP();
__ ret();
}
« no previous file with comments | « runtime/vm/intrinsifier_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698