Index: src/x64/stub-cache-x64.cc |
=================================================================== |
--- src/x64/stub-cache-x64.cc (revision 9327) |
+++ src/x64/stub-cache-x64.cc (working copy) |
@@ -784,7 +784,8 @@ |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ movq(name_reg, rax); |
- __ RecordWrite(receiver_reg, offset, name_reg, scratch); |
+ __ RecordWriteField( |
+ receiver_reg, offset, name_reg, scratch, kDontSaveFPRegs); |
} else { |
// Write to the properties array. |
int offset = index * kPointerSize + FixedArray::kHeaderSize; |
@@ -795,7 +796,8 @@ |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ movq(name_reg, rax); |
- __ RecordWrite(scratch, offset, name_reg, receiver_reg); |
+ __ RecordWriteField( |
+ scratch, offset, name_reg, receiver_reg, kDontSaveFPRegs); |
} |
// Return the value (register rax). |
@@ -1426,7 +1428,7 @@ |
__ j(not_equal, &call_builtin); |
if (argc == 1) { // Otherwise fall through to call builtin. |
- Label exit, with_write_barrier, attempt_to_grow_elements; |
+ Label attempt_to_grow_elements, with_write_barrier; |
// Get the array's length into rax and calculate new length. |
__ SmiToInteger32(rax, FieldOperand(rdx, JSArray::kLengthOffset)); |
@@ -1455,15 +1457,13 @@ |
__ JumpIfNotSmi(rcx, &with_write_barrier); |
- __ bind(&exit); |
__ ret((argc + 1) * kPointerSize); |
__ bind(&with_write_barrier); |
- __ InNewSpace(rbx, rcx, equal, &exit); |
+ __ RecordWrite( |
+ rbx, rdx, rcx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
- __ RecordWriteHelper(rbx, rdx, rcx); |
- |
__ ret((argc + 1) * kPointerSize); |
__ bind(&attempt_to_grow_elements); |
@@ -1504,6 +1504,13 @@ |
__ movq(Operand(rdx, i * kPointerSize), kScratchRegister); |
} |
+ // We know the elements array is in new space so we don't need the |
+ // remembered set, but we just pushed a value onto it so we may have to |
+ // tell the incremental marker to rescan the object that we just grew. We |
+ // don't need to worry about the holes because they are in old space and |
+ // already marked black. |
+ __ RecordWrite(rbx, rdx, rcx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); |
+ |
// Restore receiver to rdx as finish sequence assumes it's here. |
__ movq(rdx, Operand(rsp, (argc + 1) * kPointerSize)); |
@@ -1515,7 +1522,6 @@ |
__ Integer32ToSmi(rax, rax); |
__ movq(FieldOperand(rdx, JSArray::kLengthOffset), rax); |
- // Elements are in new space, so write barrier is not required. |
__ ret((argc + 1) * kPointerSize); |
} |
@@ -2468,19 +2474,36 @@ |
Handle<Map>(object->map())); |
__ j(not_equal, &miss); |
+ // Compute the cell operand to use. |
+ __ Move(rbx, Handle<JSGlobalPropertyCell>(cell)); |
+ Operand cell_operand = FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset); |
+ |
// Check that the value in the cell is not the hole. If it is, this |
// cell could have been deleted and reintroducing the global needs |
// to update the property details in the property dictionary of the |
// global object. We bail out to the runtime system to do that. |
- __ Move(rbx, Handle<JSGlobalPropertyCell>(cell)); |
- __ CompareRoot(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), |
- Heap::kTheHoleValueRootIndex); |
+ __ CompareRoot(cell_operand, Heap::kTheHoleValueRootIndex); |
__ j(equal, &miss); |
// Store the value in the cell. |
- __ movq(FieldOperand(rbx, JSGlobalPropertyCell::kValueOffset), rax); |
+ __ movq(cell_operand, rax); |
+ Label done; |
+ __ JumpIfSmi(rax, &done); |
+ __ movq(rcx, rax); |
+ __ lea(rdx, cell_operand); |
+ // Cells are always in the remembered set. |
+ __ RecordWrite(rbx, // Object. |
+ rdx, // Address. |
+ rcx, // Value. |
+ kDontSaveFPRegs, |
+ OMIT_REMEMBERED_SET, |
+ OMIT_SMI_CHECK); |
+ |
+ |
// Return the value (register rax). |
+ __ bind(&done); |
+ |
Counters* counters = isolate()->counters(); |
__ IncrementCounter(counters->named_store_global_inline(), 1); |
__ ret(0); |
@@ -3670,13 +3693,14 @@ |
__ j(above_equal, &miss_force_generic); |
} |
- // Do the store and update the write barrier. Make sure to preserve |
- // the value in register eax. |
+ // Do the store and update the write barrier. |
+ __ SmiToInteger32(rcx, rcx); |
+ __ lea(rcx, |
+ FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize)); |
+ __ movq(Operand(rcx, 0), rax); |
+ // Make sure to preserve the value in register rax. |
__ movq(rdx, rax); |
- __ SmiToInteger32(rcx, rcx); |
- __ movq(FieldOperand(rdi, rcx, times_pointer_size, FixedArray::kHeaderSize), |
- rax); |
- __ RecordWrite(rdi, 0, rdx, rcx); |
+ __ RecordWrite(rdi, rcx, rdx, kDontSaveFPRegs); |
// Done. |
__ ret(0); |