Index: src/mips/stub-cache-mips.cc |
diff --git a/src/mips/stub-cache-mips.cc b/src/mips/stub-cache-mips.cc |
index e110c47c6f12a7d46ae04f094b21e75ff4af4844..aeb26ee9ac0dea3757fdfc7499e817346fb69999 100644 |
--- a/src/mips/stub-cache-mips.cc |
+++ b/src/mips/stub-cache-mips.cc |
@@ -456,6 +456,25 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
__ CheckAccessGlobalProxy(receiver_reg, scratch1, miss_label); |
} |
+ int descriptor = transition->LastAdded(); |
+ DescriptorArray* descriptors = transition->instance_descriptors(); |
+ PropertyDetails details = descriptors->GetDetails(descriptor); |
+ Representation representation = details.representation(); |
+ ASSERT(!representation.IsNone()); |
+ |
+ // Ensure no transitions to deprecated maps are followed. |
+ __ CheckMapDeprecated(transition, scratch1, miss_label); |
+ |
+ if (FLAG_track_fields && representation.IsSmi()) { |
+ __ JumpIfNotSmi(value_reg, miss_label); |
+ } else if (FLAG_track_double_fields && representation.IsDouble()) { |
+ Label do_store; |
+ __ JumpIfSmi(value_reg, &do_store); |
+ __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, |
+ miss_label, DONT_DO_SMI_CHECK); |
+ __ bind(&do_store); |
+ } |
+ |
// Check that we are allowed to write this. |
if (object->GetPrototype()->IsJSObject()) { |
JSObject* holder; |
@@ -537,18 +556,20 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
int offset = object->map()->instance_size() + (index * kPointerSize); |
__ sw(value_reg, FieldMemOperand(receiver_reg, offset)); |
- // Skip updating write barrier if storing a smi. |
- __ JumpIfSmi(value_reg, &exit); |
- |
- // Update the write barrier for the array address. |
- // Pass the now unused name_reg as a scratch register. |
- __ mov(name_reg, value_reg); |
- __ RecordWriteField(receiver_reg, |
- offset, |
- name_reg, |
- scratch1, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs); |
+ if (!FLAG_track_fields || !representation.IsSmi()) { |
+ // Skip updating write barrier if storing a smi. |
+ __ JumpIfSmi(value_reg, &exit); |
+ |
+ // Update the write barrier for the array address. |
+ // Pass the now unused name_reg as a scratch register. |
+ __ mov(name_reg, value_reg); |
+ __ RecordWriteField(receiver_reg, |
+ offset, |
+ name_reg, |
+ scratch1, |
+ kRAHasNotBeenSaved, |
+ kDontSaveFPRegs); |
+ } |
} else { |
// Write to the properties array. |
int offset = index * kPointerSize + FixedArray::kHeaderSize; |
@@ -557,18 +578,20 @@ void StubCompiler::GenerateStoreTransition(MacroAssembler* masm, |
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
__ sw(value_reg, FieldMemOperand(scratch1, offset)); |
- // Skip updating write barrier if storing a smi. |
- __ JumpIfSmi(value_reg, &exit); |
- |
- // Update the write barrier for the array address. |
- // Ok to clobber receiver_reg and name_reg, since we return. |
- __ mov(name_reg, value_reg); |
- __ RecordWriteField(scratch1, |
- offset, |
- name_reg, |
- receiver_reg, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs); |
+ if (!FLAG_track_fields || !representation.IsSmi()) { |
+ // Skip updating write barrier if storing a smi. |
+ __ JumpIfSmi(value_reg, &exit); |
+ |
+ // Update the write barrier for the array address. |
+ // Ok to clobber receiver_reg and name_reg, since we return. |
+ __ mov(name_reg, value_reg); |
+ __ RecordWriteField(scratch1, |
+ offset, |
+ name_reg, |
+ receiver_reg, |
+ kRAHasNotBeenSaved, |
+ kDontSaveFPRegs); |
+ } |
} |
// Return the value (register v0). |
@@ -615,24 +638,38 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
// object and the number of in-object properties is not going to change. |
index -= object->map()->inobject_properties(); |
+ Representation representation = lookup->representation(); |
+ ASSERT(!representation.IsNone()); |
+ if (FLAG_track_fields && representation.IsSmi()) { |
+ __ JumpIfNotSmi(value_reg, miss_label); |
+ } else if (FLAG_track_double_fields && representation.IsDouble()) { |
+ Label do_store; |
+ __ JumpIfSmi(value_reg, &do_store); |
+ __ CheckMap(value_reg, scratch1, Heap::kHeapNumberMapRootIndex, |
+ miss_label, DONT_DO_SMI_CHECK); |
+ __ bind(&do_store); |
+ } |
+ |
// TODO(verwaest): Share this code as a code stub. |
if (index < 0) { |
// Set the property straight into the object. |
int offset = object->map()->instance_size() + (index * kPointerSize); |
__ sw(value_reg, FieldMemOperand(receiver_reg, offset)); |
- // Skip updating write barrier if storing a smi. |
- __ JumpIfSmi(value_reg, &exit); |
- |
- // Update the write barrier for the array address. |
- // Pass the now unused name_reg as a scratch register. |
- __ mov(name_reg, value_reg); |
- __ RecordWriteField(receiver_reg, |
- offset, |
- name_reg, |
- scratch1, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs); |
+ if (!FLAG_track_fields || !representation.IsSmi()) { |
+ // Skip updating write barrier if storing a smi. |
+ __ JumpIfSmi(value_reg, &exit); |
+ |
+ // Update the write barrier for the array address. |
+ // Pass the now unused name_reg as a scratch register. |
+ __ mov(name_reg, value_reg); |
+ __ RecordWriteField(receiver_reg, |
+ offset, |
+ name_reg, |
+ scratch1, |
+ kRAHasNotBeenSaved, |
+ kDontSaveFPRegs); |
+ } |
} else { |
// Write to the properties array. |
int offset = index * kPointerSize + FixedArray::kHeaderSize; |
@@ -641,18 +678,20 @@ void StubCompiler::GenerateStoreField(MacroAssembler* masm, |
FieldMemOperand(receiver_reg, JSObject::kPropertiesOffset)); |
__ sw(value_reg, FieldMemOperand(scratch1, offset)); |
- // Skip updating write barrier if storing a smi. |
- __ JumpIfSmi(value_reg, &exit); |
- |
- // Update the write barrier for the array address. |
- // Ok to clobber receiver_reg and name_reg, since we return. |
- __ mov(name_reg, value_reg); |
- __ RecordWriteField(scratch1, |
- offset, |
- name_reg, |
- receiver_reg, |
- kRAHasNotBeenSaved, |
- kDontSaveFPRegs); |
+ if (!FLAG_track_fields || !representation.IsSmi()) { |
+ // Skip updating write barrier if storing a smi. |
+ __ JumpIfSmi(value_reg, &exit); |
+ |
+ // Update the write barrier for the array address. |
+ // Ok to clobber receiver_reg and name_reg, since we return. |
+ __ mov(name_reg, value_reg); |
+ __ RecordWriteField(scratch1, |
+ offset, |
+ name_reg, |
+ receiver_reg, |
+ kRAHasNotBeenSaved, |
+ kDontSaveFPRegs); |
+ } |
} |
// Return the value (register v0). |
@@ -2935,18 +2974,24 @@ Handle<Code> BaseLoadStubCompiler::CompilePolymorphicIC( |
Register map_reg = scratch1(); |
int receiver_count = receiver_maps->length(); |
+ int number_of_handled_maps = 0; |
__ lw(map_reg, FieldMemOperand(receiver(), HeapObject::kMapOffset)); |
for (int current = 0; current < receiver_count; ++current) { |
- __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, |
- eq, map_reg, Operand(receiver_maps->at(current))); |
+ Handle<Map> map = receiver_maps->at(current); |
+ if (!map->is_deprecated()) { |
+ number_of_handled_maps++; |
+ __ Jump(handlers->at(current), RelocInfo::CODE_TARGET, |
+ eq, map_reg, Operand(receiver_maps->at(current))); |
+ } |
} |
+ ASSERT(number_of_handled_maps != 0); |
__ bind(&miss); |
TailCallBuiltin(masm(), MissBuiltin(kind())); |
// Return the generated code. |
InlineCacheState state = |
- receiver_maps->length() > 1 ? POLYMORPHIC : MONOMORPHIC; |
+ number_of_handled_maps > 1 ? POLYMORPHIC : MONOMORPHIC; |
return GetICCode(kind(), type, name, state); |
} |