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

Unified Diff: src/x64/macro-assembler-x64.cc

Issue 1862001: X64: Use allocation with no scratch registers to avoid push/pop. (Closed)
Patch Set: Created 10 years, 8 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 | « src/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/macro-assembler-x64.cc
diff --git a/src/x64/macro-assembler-x64.cc b/src/x64/macro-assembler-x64.cc
index 26202b832d577451fd41976eaaeb3c4c8f5db96d..9c60d2736b9a5d0c612d4788425436d791f5bf63 100644
--- a/src/x64/macro-assembler-x64.cc
+++ b/src/x64/macro-assembler-x64.cc
@@ -2356,18 +2356,17 @@ void MacroAssembler::LoadAllocationTopHelper(Register result,
return;
}
- // Move address of new object to result. Use scratch register if available.
- if (!scratch.is_valid()) {
- if (result.is(rax)) {
- load_rax(new_space_allocation_top);
- } else {
- movq(kScratchRegister, new_space_allocation_top);
- movq(result, Operand(kScratchRegister, 0));
- }
- } else {
+ // Move address of new object to result. Use scratch register if available,
+ // and keep address in scratch until call to UpdateAllocationTopHelper.
+ if (scratch.is_valid()) {
ASSERT(!scratch.is(result_end));
movq(scratch, new_space_allocation_top);
movq(result, Operand(scratch, 0));
+ } else if (result.is(rax)) {
+ load_rax(new_space_allocation_top);
+ } else {
+ movq(kScratchRegister, new_space_allocation_top);
+ movq(result, Operand(kScratchRegister, 0));
}
}
@@ -2388,11 +2387,11 @@ void MacroAssembler::UpdateAllocationTopHelper(Register result_end,
store_rax(new_space_allocation_top);
} else {
// Register required - use scratch provided if available.
- if (!scratch.is_valid()) {
+ if (scratch.is_valid()) {
+ movq(Operand(scratch, 0), result_end);
+ } else {
movq(kScratchRegister, new_space_allocation_top);
movq(Operand(kScratchRegister, 0), result_end);
- } else {
- movq(Operand(scratch, 0), result_end);
}
}
}
@@ -2415,7 +2414,11 @@ void MacroAssembler::AllocateInNewSpace(int object_size,
Register top_reg = result_end.is_valid() ? result_end : result;
- lea(top_reg, Operand(result, object_size));
+ if (top_reg.is(result)) {
+ addq(top_reg, Immediate(object_size));
+ } else {
+ lea(top_reg, Operand(result, object_size));
+ }
movq(kScratchRegister, new_space_allocation_limit);
cmpq(top_reg, Operand(kScratchRegister, 0));
j(above, gc_required);
« no previous file with comments | « src/x64/codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698