|| (op_ ==Token::SUB)
|| (op_ == Token::MUL)
|| (op_ == Token::DIV)) {
- Label call_runtime, after_alloc_failure;
+ Label call_runtime;
Label left_smi, right_smi, load_right, do_op;
__ JumpIfSmi(left_, &left_smi);
__ CompareRoot(FieldOperand(left_, HeapObject::kMapOffset),
__ Integer32ToSmi(left_, left_);
if (mode_ == OVERWRITE_LEFT) {
Label alloc_failure;
- __ push(left_);
- __ AllocateHeapNumber(dst_, left_, &after_alloc_failure);
- __ pop(left_);
+ __ AllocateHeapNumber(dst_, no_reg, &call_runtime);
}
__ bind(&load_right);
__ movq(dst_, right_);
} else if (mode_ == NO_OVERWRITE) {
Label alloc_failure;
- __ push(left_);
- __ AllocateHeapNumber(dst_, left_, &after_alloc_failure);
- __ pop(left_);
+ __ AllocateHeapNumber(dst_, no_reg, &call_runtime);
}
__ jmp(&do_op);
__ Integer32ToSmi(right_, right_);
if (mode_ == OVERWRITE_RIGHT || mode_ == NO_OVERWRITE) {
Label alloc_failure;
- __ push(left_);
- __ AllocateHeapNumber(dst_, left_, &after_alloc_failure);
- __ pop(left_);
+ __ AllocateHeapNumber(dst_, no_reg, &call_runtime);
}
__ bind(&do_op);
__ movsd(FieldOperand(dst_, HeapNumber::kValueOffset), xmm0);
__ jmp(&done);
- __ bind(&after_alloc_failure);
- __ pop(left_);
__ bind(&call_runtime);
}
GenericBinaryOpStub stub(op_, mode_, NO_SMI_CODE_IN_STUB);
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));
}
}
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);
}
}
}
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);