Index: src/x64/macro-assembler-x64.cc |
=================================================================== |
--- src/x64/macro-assembler-x64.cc (revision 6680) |
+++ src/x64/macro-assembler-x64.cc (working copy) |
@@ -2098,11 +2098,11 @@ |
Register top_reg = result_end.is_valid() ? result_end : result; |
- if (top_reg.is(result)) { |
- addq(top_reg, Immediate(object_size)); |
- } else { |
- lea(top_reg, Operand(result, object_size)); |
+ if (!top_reg.is(result)) { |
+ movq(top_reg, result); |
} |
+ addq(top_reg, Immediate(object_size)); |
+ j(carry, gc_required); |
movq(kScratchRegister, new_space_allocation_limit); |
cmpq(top_reg, Operand(kScratchRegister, 0)); |
j(above, gc_required); |
@@ -2152,7 +2152,12 @@ |
// Calculate new top and bail out if new space is exhausted. |
ExternalReference new_space_allocation_limit = |
ExternalReference::new_space_allocation_limit_address(); |
- lea(result_end, Operand(result, element_count, element_size, header_size)); |
+ |
+ // We assume that element_count*element_size + header_size does not |
+ // overflow. |
+ lea(result_end, Operand(element_count, element_size, header_size)); |
+ addq(result_end, result); |
+ j(carry, gc_required); |
movq(kScratchRegister, new_space_allocation_limit); |
cmpq(result_end, Operand(kScratchRegister, 0)); |
j(above, gc_required); |
@@ -2198,6 +2203,7 @@ |
movq(result_end, object_size); |
} |
addq(result_end, result); |
+ j(carry, gc_required); |
movq(kScratchRegister, new_space_allocation_limit); |
cmpq(result_end, Operand(kScratchRegister, 0)); |
j(above, gc_required); |