Index: src/x64/lithium-codegen-x64.cc |
=================================================================== |
--- src/x64/lithium-codegen-x64.cc (revision 9605) |
+++ src/x64/lithium-codegen-x64.cc (working copy) |
@@ -2055,19 +2055,24 @@ |
// Store the value. |
__ movq(Operand(address, 0), value); |
- Label smi_store; |
- __ JumpIfSmi(value, &smi_store, Label::kNear); |
+ if (instr->hydrogen()->NeedsWriteBarrier()) { |
+ Label smi_store; |
+ HType type = instr->hydrogen()->value()->type(); |
+ if (!type.IsHeapNumber() && !type.IsString() && !type.IsNonPrimitive()) { |
+ __ JumpIfSmi(value, &smi_store, Label::kNear); |
+ } |
- int offset = JSGlobalPropertyCell::kValueOffset - kHeapObjectTag; |
- __ lea(object, Operand(address, -offset)); |
- // Cells are always in the remembered set. |
- __ RecordWrite(object, |
- address, |
- value, |
- kSaveFPRegs, |
- OMIT_REMEMBERED_SET, |
- OMIT_SMI_CHECK); |
- __ bind(&smi_store); |
+ int offset = JSGlobalPropertyCell::kValueOffset - kHeapObjectTag; |
+ __ lea(object, Operand(address, -offset)); |
+ // Cells are always in the remembered set. |
+ __ RecordWrite(object, |
+ address, |
+ value, |
+ kSaveFPRegs, |
+ OMIT_REMEMBERED_SET, |
+ OMIT_SMI_CHECK); |
+ __ bind(&smi_store); |
+ } |
} |
@@ -2094,10 +2099,19 @@ |
Register context = ToRegister(instr->context()); |
Register value = ToRegister(instr->value()); |
__ movq(ContextOperand(context, instr->slot_index()), value); |
- if (instr->needs_write_barrier()) { |
+ if (instr->hydrogen()->NeedsWriteBarrier()) { |
+ HType type = instr->hydrogen()->value()->type(); |
+ SmiCheck check_needed = |
+ type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
int offset = Context::SlotOffset(instr->slot_index()); |
Register scratch = ToRegister(instr->TempAt(0)); |
- __ RecordWriteContextSlot(context, offset, value, scratch, kSaveFPRegs); |
+ __ RecordWriteContextSlot(context, |
+ offset, |
+ value, |
+ scratch, |
+ kSaveFPRegs, |
+ EMIT_REMEMBERED_SET, |
+ check_needed); |
} |
} |
@@ -3061,21 +3075,36 @@ |
} |
// Do the store. |
+ HType type = instr->hydrogen()->value()->type(); |
+ SmiCheck check_needed = |
+ type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
if (instr->is_in_object()) { |
__ movq(FieldOperand(object, offset), value); |
- if (instr->needs_write_barrier()) { |
+ if (instr->hydrogen()->NeedsWriteBarrier()) { |
Register temp = ToRegister(instr->TempAt(0)); |
// Update the write barrier for the object for in-object properties. |
- __ RecordWriteField(object, offset, value, temp, kSaveFPRegs); |
+ __ RecordWriteField(object, |
+ offset, |
+ value, |
+ temp, |
+ kSaveFPRegs, |
+ EMIT_REMEMBERED_SET, |
+ check_needed); |
} |
} else { |
Register temp = ToRegister(instr->TempAt(0)); |
__ movq(temp, FieldOperand(object, JSObject::kPropertiesOffset)); |
__ movq(FieldOperand(temp, offset), value); |
- if (instr->needs_write_barrier()) { |
+ if (instr->hydrogen()->NeedsWriteBarrier()) { |
// Update the write barrier for the properties array. |
// object is used as a scratch register. |
- __ RecordWriteField(temp, offset, value, object, kSaveFPRegs); |
+ __ RecordWriteField(temp, |
+ offset, |
+ value, |
+ object, |
+ kSaveFPRegs, |
+ EMIT_REMEMBERED_SET, |
+ check_needed); |
} |
} |
} |
@@ -3182,12 +3211,20 @@ |
} |
if (instr->hydrogen()->NeedsWriteBarrier()) { |
+ HType type = instr->hydrogen()->value()->type(); |
+ SmiCheck check_needed = |
+ type.IsHeapObject() ? OMIT_SMI_CHECK : INLINE_SMI_CHECK; |
// Compute address of modified element and store it into key register. |
__ lea(key, FieldOperand(elements, |
key, |
times_pointer_size, |
FixedArray::kHeaderSize)); |
- __ RecordWrite(elements, key, value, kSaveFPRegs); |
+ __ RecordWrite(elements, |
+ key, |
+ value, |
+ kSaveFPRegs, |
+ EMIT_REMEMBERED_SET, |
+ check_needed); |
} |
} |
@@ -3975,12 +4012,11 @@ |
Label* true_label = chunk_->GetAssemblyLabel(true_block); |
Label* false_label = chunk_->GetAssemblyLabel(false_block); |
- Condition final_branch_condition = EmitTypeofIs(true_label, |
- false_label, |
- input, |
- instr->type_literal()); |
- |
- EmitBranch(true_block, false_block, final_branch_condition); |
+ Condition final_branch_condition = |
+ EmitTypeofIs(true_label, false_label, input, instr->type_literal()); |
+ if (final_branch_condition != no_condition) { |
+ EmitBranch(true_block, false_block, final_branch_condition); |
+ } |
} |
@@ -4048,7 +4084,6 @@ |
final_branch_condition = zero; |
} else { |
- final_branch_condition = never; |
__ jmp(false_label); |
} |