Index: src/ia32/stub-cache-ia32.cc |
=================================================================== |
--- src/ia32/stub-cache-ia32.cc (revision 9327) |
+++ src/ia32/stub-cache-ia32.cc (working copy) |
@@ -790,7 +790,11 @@ |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ mov(name_reg, Operand(eax)); |
- __ 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; |
@@ -801,7 +805,11 @@ |
// Update the write barrier for the array address. |
// Pass the value being stored in the now unused name_reg. |
__ mov(name_reg, Operand(eax)); |
- __ RecordWrite(scratch, offset, name_reg, receiver_reg); |
+ __ RecordWriteField(scratch, |
+ offset, |
+ name_reg, |
+ receiver_reg, |
+ kDontSaveFPRegs); |
} |
// Return the value (register eax). |
@@ -1446,7 +1454,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 exit, attempt_to_grow_elements, with_write_barrier; |
// Get the array's length into eax and calculate new length. |
__ mov(eax, FieldOperand(edx, JSArray::kLengthOffset)); |
@@ -1479,9 +1487,9 @@ |
__ bind(&with_write_barrier); |
- __ InNewSpace(ebx, ecx, equal, &exit); |
+ __ RecordWrite( |
+ ebx, edx, ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
- __ RecordWriteHelper(ebx, edx, ecx); |
__ ret((argc + 1) * kPointerSize); |
__ bind(&attempt_to_grow_elements); |
@@ -1489,6 +1497,10 @@ |
__ jmp(&call_builtin); |
} |
+ // We could be lucky and the elements array could be at the top of |
+ // new-space. In this case we can just grow it in place by moving the |
+ // allocation pointer up. |
+ |
ExternalReference new_space_allocation_top = |
ExternalReference::new_space_allocation_top_address(isolate()); |
ExternalReference new_space_allocation_limit = |
@@ -1520,15 +1532,26 @@ |
Immediate(factory()->the_hole_value())); |
} |
+ // 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(ebx, edx, ecx, kDontSaveFPRegs, OMIT_REMEMBERED_SET); |
+ |
// Restore receiver to edx as finish sequence assumes it's here. |
__ mov(edx, Operand(esp, (argc + 1) * kPointerSize)); |
// Increment element's and array's sizes. |
__ add(FieldOperand(ebx, FixedArray::kLengthOffset), |
Immediate(Smi::FromInt(kAllocationDelta))); |
+ |
+ // NOTE: This only happen in new-space, where we don't |
+ // care about the black-byte-count on pages. Otherwise we should |
+ // update that too if the object is black. |
+ |
__ mov(FieldOperand(edx, JSArray::kLengthOffset), eax); |
- // Elements are in new space, so write barrier is not required. |
__ ret((argc + 1) * kPointerSize); |
} |
@@ -2604,13 +2627,9 @@ |
Immediate(Handle<Map>(object->map()))); |
__ j(not_equal, &miss); |
- |
// Compute the cell operand to use. |
- Operand cell_operand = Operand::Cell(Handle<JSGlobalPropertyCell>(cell)); |
- if (Serializer::enabled()) { |
- __ mov(ebx, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
- cell_operand = FieldOperand(ebx, JSGlobalPropertyCell::kValueOffset); |
- } |
+ __ mov(ebx, Immediate(Handle<JSGlobalPropertyCell>(cell))); |
+ Operand cell_operand = FieldOperand(ebx, 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 |
@@ -2621,8 +2640,23 @@ |
// Store the value in the cell. |
__ mov(cell_operand, eax); |
+ Label done; |
+ __ test(eax, Immediate(kSmiTagMask)); |
+ __ j(zero, &done); |
+ __ mov(ecx, eax); |
+ __ lea(edx, cell_operand); |
+ // Cells are always in the remembered set. |
+ __ RecordWrite(ebx, // Object. |
+ edx, // Address. |
+ ecx, // Value. |
+ kDontSaveFPRegs, |
+ OMIT_REMEMBERED_SET, |
+ OMIT_SMI_CHECK); |
+ |
// Return the value (register eax). |
+ __ bind(&done); |
+ |
Counters* counters = isolate()->counters(); |
__ IncrementCounter(counters->named_store_global_inline(), 1); |
__ ret(0); |
@@ -3875,11 +3909,12 @@ |
__ 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. |
+ __ lea(ecx, FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize)); |
+ __ mov(Operand(ecx, 0), eax); |
+ // Make sure to preserve the value in register eax. |
__ mov(edx, Operand(eax)); |
- __ mov(FieldOperand(edi, ecx, times_2, FixedArray::kHeaderSize), eax); |
- __ RecordWrite(edi, 0, edx, ecx); |
+ __ RecordWrite(edi, ecx, edx, kDontSaveFPRegs); |
// Done. |
__ ret(0); |