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

Unified Diff: src/assembler-ia32.cc

Issue 4212: Added some peephole optimizaitions regarding push of immediate followed... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler-ia32.cc
===================================================================
--- src/assembler-ia32.cc (revision 360)
+++ src/assembler-ia32.cc (working copy)
@@ -469,7 +469,48 @@
}
return;
}
+ } else if (instr == 0x6a && dst.is(eax)) { // push of immediate 8 bit
+ byte imm8 = last_pc_[1];
+ if (imm8 == 0) {
+ // 6a00 push 0x0
+ // 58 pop eax
+ last_pc_[0] = 0x31;
+ last_pc_[1] = 0xc0;
+ // change to
+ // 31c0 xor eax,eax
+ last_pc_ = NULL;
+ return;
+ } else {
+ // 6a00 push 0xXX
+ // 58 pop eax
+ last_pc_[0] = 0xb8;
+ EnsureSpace ensure_space(this);
+ if ((imm8 & 0x80) != 0) {
+ EMIT(0xff);
+ EMIT(0xff);
+ EMIT(0xff);
+ // change to
+ // b8XXffffff mov eax,0xffffffXX
+ } else {
+ EMIT(0x00);
+ EMIT(0x00);
+ EMIT(0x00);
+ // change to
+ // b8XX000000 mov eax,0x000000XX
+ }
+ last_pc_ = NULL;
+ return;
+ }
+ } else if (instr == 0x68 && dst.is(eax)) { // push of immediate 32 bit
+ // 68XXXXXXXX push 0xXXXXXXXX
+ // 58 pop eax
+ last_pc_[0] = 0xb8;
+ last_pc_ = NULL;
+ // change to
+ // b8XXXXXXXX mov eax,0xXXXXXXXX
+ return;
}
+
// Other potential patterns for peephole:
// 0x712716 102 890424 mov [esp], eax
// 0x712719 105 8b1424 mov edx, [esp]
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698