Index: src/ia32/macro-assembler-ia32.cc |
=================================================================== |
--- src/ia32/macro-assembler-ia32.cc (revision 6680) |
+++ src/ia32/macro-assembler-ia32.cc (working copy) |
@@ -604,11 +604,11 @@ |
ExternalReference new_space_allocation_limit = |
ExternalReference::new_space_allocation_limit_address(); |
- if (top_reg.is(result)) { |
- add(Operand(top_reg), Immediate(object_size)); |
- } else { |
- lea(top_reg, Operand(result, object_size)); |
+ if (!top_reg.is(result)) { |
+ mov(top_reg, result); |
} |
+ add(Operand(top_reg), Immediate(object_size)); |
+ j(carry, gc_required, not_taken); |
cmp(top_reg, Operand::StaticVariable(new_space_allocation_limit)); |
j(above, gc_required, not_taken); |
@@ -657,7 +657,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)); |
+ add(result_end, Operand(result)); |
+ j(carry, gc_required); |
cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
j(above, gc_required); |
@@ -702,6 +707,7 @@ |
mov(result_end, object_size); |
} |
add(result_end, Operand(result)); |
+ j(carry, gc_required, not_taken); |
cmp(result_end, Operand::StaticVariable(new_space_allocation_limit)); |
j(above, gc_required, not_taken); |