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

Unified Diff: runtime/vm/debugger_x64.cc

Issue 22825023: Uses an object pool on x64 (Closed) Base URL: http://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
Index: runtime/vm/debugger_x64.cc
===================================================================
--- runtime/vm/debugger_x64.cc (revision 27208)
+++ runtime/vm/debugger_x64.cc (working copy)
@@ -42,16 +42,15 @@
void CodeBreakpoint::PatchFunctionReturn() {
uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 13);
- // movq %rbp,%rsp
- ASSERT((code[0] == 0x48) && (code[1] == 0x89) && (code[2] == 0xec));
- ASSERT(code[3] == 0x5d); // popq %rbp
- ASSERT(code[4] == 0xc3); // ret
- // Next 8 bytes are nop instructions
- ASSERT((code[5] == 0x90) && (code[6] == 0x90) &&
- (code[7] == 0x90) && (code[8] == 0x90) &&
- (code[9] == 0x90) && (code[10] == 0x90) &&
- (code[11] == 0x90) && (code[12] == 0x90));
- // Smash code with call instruction and relative target address.
+ ASSERT((code[0] == 0x4c) && (code[1] == 0x8b) && (code[2] == 0x7d) &&
+ (code[3] == 0xf0)); // movq r15,[rbp-0x10]
+ ASSERT((code[4] == 0x48) && (code[5] == 0x89) &&
+ (code[6] == 0xec)); // mov rsp, rbp
+ ASSERT(code[7] == 0x5d); // pop rbp
+ ASSERT(code[8] == 0xc3); // ret
+ ASSERT((code[9] == 0x0F) && (code[10] == 0x1F) && (code[11] == 0x40) &&
+ (code[12] == 0x00)); // nops
+ // Smash code with call instruction and relative target address.
uword stub_addr = StubCode::BreakpointReturnEntryPoint();
code[0] = 0x49;
code[1] = 0xbb;
@@ -66,19 +65,19 @@
void CodeBreakpoint::RestoreFunctionReturn() {
uint8_t* code = reinterpret_cast<uint8_t*>(pc_ - 13);
ASSERT((code[0] == 0x49) && (code[1] == 0xbb));
Florian Schneider 2013/09/06 09:58:15 Please use the assembler here. Something along the
zra 2013/09/06 17:53:26 Done.
- code[0] = 0x48; // movq %rbp,%rsp
- code[1] = 0x89;
- code[2] = 0xec;
- code[3] = 0x5d; // popq %rbp
- code[4] = 0xc3; // ret
- code[5] = 0x90; // nop
- code[6] = 0x90; // nop
- code[7] = 0x90; // nop
- code[8] = 0x90; // nop
- code[9] = 0x90; // nop
- code[10] = 0x90; // nop
- code[11] = 0x90; // nop
- code[12] = 0x90; // nop
+ code[0] = 0x4c; // movq r15,[rbp-0x10]
+ code[1] = 0x8b;
+ code[2] = 0x7d;
+ code[3] = 0xf0;
+ code[4] = 0x48; // mov rsp, rbp
+ code[5] = 0x89;
+ code[6] = 0xec;
+ code[7] = 0x5d; // pop rbp
+ code[8] = 0xc3; // ret
+ code[9] = 0x0F;
Florian Schneider 2013/09/06 09:58:15 Is this part of the nop?
zra 2013/09/06 17:53:26 Replaced with Assembler use.
+ code[10] = 0x1F; // nop
+ code[11] = 0x40; // nop
+ code[12] = 0x00; // nop
CPU::FlushICache(pc_ - 13, 13);
}

Powered by Google App Engine
This is Rietveld 408576698