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

Unified Diff: runtime/vm/assembler_x64.cc

Issue 25491002: x64: Use a short encoding of addq and subq for 32-bit immediates. (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 | « no previous file | runtime/vm/code_patcher_x64.cc » ('j') | runtime/vm/code_patcher_x64.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/assembler_x64.cc
diff --git a/runtime/vm/assembler_x64.cc b/runtime/vm/assembler_x64.cc
index 5511c60f72a300710e44a0d120a620027ee5d54b..cc93724b70a936b0f439b9fa66a68e5c47ad2b17 100644
--- a/runtime/vm/assembler_x64.cc
+++ b/runtime/vm/assembler_x64.cc
@@ -1671,9 +1671,14 @@ void Assembler::addq(Register reg, const Immediate& imm) {
void Assembler::addq(const Address& address, const Immediate& imm) {
- // TODO(srdjan): Implement shorter version for imm32.
- movq(TMP, imm);
- addq(address, TMP);
+ if (imm.is_int32()) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitOperandREX(0, address, REX_W);
+ EmitComplex(0, Operand(address), imm);
+ } else {
+ movq(TMP, imm);
+ addq(address, TMP);
+ }
}
@@ -1835,9 +1840,14 @@ void Assembler::subq(const Address& address, Register reg) {
void Assembler::subq(const Address& address, const Immediate& imm) {
- // TODO(srdjan): Implement shorter version for imm32.
- movq(TMP, imm);
- subq(address, TMP);
+ if (imm.is_int32()) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ EmitOperandREX(0, address, REX_W);
+ EmitComplex(5, Operand(address), imm);
+ } else {
+ movq(TMP, imm);
+ subq(address, TMP);
+ }
}
« no previous file with comments | « no previous file | runtime/vm/code_patcher_x64.cc » ('j') | runtime/vm/code_patcher_x64.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698