OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/code-stub-assembler.h" | 5 #include "src/code-stub-assembler.h" |
6 #include "src/code-factory.h" | 6 #include "src/code-factory.h" |
7 #include "src/frames-inl.h" | 7 #include "src/frames-inl.h" |
8 #include "src/frames.h" | 8 #include "src/frames.h" |
9 #include "src/ic/handler-configuration.h" | 9 #include "src/ic/handler-configuration.h" |
10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
(...skipping 1098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, | 1109 return StoreObjectFieldNoWriteBarrier(object, HeapNumber::kValueOffset, value, |
1110 MachineRepresentation::kFloat64); | 1110 MachineRepresentation::kFloat64); |
1111 } | 1111 } |
1112 | 1112 |
1113 Node* CodeStubAssembler::StoreObjectField( | 1113 Node* CodeStubAssembler::StoreObjectField( |
1114 Node* object, int offset, Node* value) { | 1114 Node* object, int offset, Node* value) { |
1115 return Store(MachineRepresentation::kTagged, object, | 1115 return Store(MachineRepresentation::kTagged, object, |
1116 IntPtrConstant(offset - kHeapObjectTag), value); | 1116 IntPtrConstant(offset - kHeapObjectTag), value); |
1117 } | 1117 } |
1118 | 1118 |
| 1119 Node* CodeStubAssembler::StoreObjectField(Node* object, Node* offset, |
| 1120 Node* value) { |
| 1121 int const_offset; |
| 1122 if (ToInt32Constant(offset, const_offset)) { |
| 1123 return StoreObjectField(object, const_offset, value); |
| 1124 } |
| 1125 return Store(MachineRepresentation::kTagged, object, |
| 1126 IntPtrSub(offset, IntPtrConstant(kHeapObjectTag)), value); |
| 1127 } |
| 1128 |
1119 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( | 1129 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( |
1120 Node* object, int offset, Node* value, MachineRepresentation rep) { | 1130 Node* object, int offset, Node* value, MachineRepresentation rep) { |
1121 return StoreNoWriteBarrier(rep, object, | 1131 return StoreNoWriteBarrier(rep, object, |
1122 IntPtrConstant(offset - kHeapObjectTag), value); | 1132 IntPtrConstant(offset - kHeapObjectTag), value); |
1123 } | 1133 } |
1124 | 1134 |
| 1135 Node* CodeStubAssembler::StoreObjectFieldNoWriteBarrier( |
| 1136 Node* object, Node* offset, Node* value, MachineRepresentation rep) { |
| 1137 int const_offset; |
| 1138 if (ToInt32Constant(offset, const_offset)) { |
| 1139 return StoreObjectFieldNoWriteBarrier(object, const_offset, value, rep); |
| 1140 } |
| 1141 return StoreNoWriteBarrier( |
| 1142 rep, object, IntPtrSub(offset, IntPtrConstant(kHeapObjectTag)), value); |
| 1143 } |
| 1144 |
1125 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { | 1145 Node* CodeStubAssembler::StoreMapNoWriteBarrier(Node* object, Node* map) { |
1126 return StoreNoWriteBarrier( | 1146 return StoreNoWriteBarrier( |
1127 MachineRepresentation::kTagged, object, | 1147 MachineRepresentation::kTagged, object, |
1128 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); | 1148 IntPtrConstant(HeapNumber::kMapOffset - kHeapObjectTag), map); |
1129 } | 1149 } |
1130 | 1150 |
1131 Node* CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset, | 1151 Node* CodeStubAssembler::StoreObjectFieldRoot(Node* object, int offset, |
1132 Heap::RootListIndex root_index) { | 1152 Heap::RootListIndex root_index) { |
1133 if (Heap::RootIsImmortalImmovable(root_index)) { | 1153 if (Heap::RootIsImmortalImmovable(root_index)) { |
1134 return StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index)); | 1154 return StoreObjectFieldNoWriteBarrier(object, offset, LoadRoot(root_index)); |
(...skipping 3938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5073 DCHECK(representation.IsTagged()); | 5093 DCHECK(representation.IsTagged()); |
5074 } | 5094 } |
5075 return value; | 5095 return value; |
5076 } | 5096 } |
5077 | 5097 |
5078 void CodeStubAssembler::StoreNamedField(Node* object, FieldIndex index, | 5098 void CodeStubAssembler::StoreNamedField(Node* object, FieldIndex index, |
5079 Representation representation, | 5099 Representation representation, |
5080 Node* value, bool transition_to_field) { | 5100 Node* value, bool transition_to_field) { |
5081 DCHECK_EQ(index.is_double(), representation.IsDouble()); | 5101 DCHECK_EQ(index.is_double(), representation.IsDouble()); |
5082 | 5102 |
| 5103 StoreNamedField(object, IntPtrConstant(index.offset()), index.is_inobject(), |
| 5104 representation, value, transition_to_field); |
| 5105 } |
| 5106 |
| 5107 void CodeStubAssembler::StoreNamedField(Node* object, Node* offset, |
| 5108 bool is_inobject, |
| 5109 Representation representation, |
| 5110 Node* value, bool transition_to_field) { |
5083 bool store_value_as_double = representation.IsDouble(); | 5111 bool store_value_as_double = representation.IsDouble(); |
5084 int offset = index.offset(); | |
5085 Node* property_storage = object; | 5112 Node* property_storage = object; |
5086 if (!index.is_inobject()) { | 5113 if (!is_inobject) { |
5087 property_storage = LoadProperties(object); | 5114 property_storage = LoadProperties(object); |
5088 } | 5115 } |
5089 | 5116 |
5090 if (representation.IsDouble()) { | 5117 if (representation.IsDouble()) { |
5091 if (!FLAG_unbox_double_fields || !index.is_inobject()) { | 5118 if (!FLAG_unbox_double_fields || !is_inobject) { |
5092 if (transition_to_field) { | 5119 if (transition_to_field) { |
5093 Node* heap_number = AllocateHeapNumberWithValue(value, MUTABLE); | 5120 Node* heap_number = AllocateHeapNumberWithValue(value, MUTABLE); |
5094 // Store the new mutable heap number into the object. | 5121 // Store the new mutable heap number into the object. |
5095 value = heap_number; | 5122 value = heap_number; |
5096 store_value_as_double = false; | 5123 store_value_as_double = false; |
5097 } else { | 5124 } else { |
5098 // Load the heap number. | 5125 // Load the heap number. |
5099 property_storage = LoadObjectField(property_storage, offset); | 5126 property_storage = LoadObjectField(property_storage, offset); |
5100 // Store the double value into it. | 5127 // Store the double value into it. |
5101 offset = HeapNumber::kValueOffset; | 5128 offset = IntPtrConstant(HeapNumber::kValueOffset); |
5102 } | 5129 } |
5103 } | 5130 } |
5104 } | 5131 } |
5105 | 5132 |
5106 if (store_value_as_double) { | 5133 if (store_value_as_double) { |
5107 StoreObjectFieldNoWriteBarrier(property_storage, offset, value, | 5134 StoreObjectFieldNoWriteBarrier(property_storage, offset, value, |
5108 MachineRepresentation::kFloat64); | 5135 MachineRepresentation::kFloat64); |
5109 } else if (representation.IsSmi()) { | 5136 } else if (representation.IsSmi()) { |
5110 StoreObjectFieldNoWriteBarrier(property_storage, offset, value); | 5137 StoreObjectFieldNoWriteBarrier(property_storage, offset, value); |
5111 } else { | 5138 } else { |
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5695 Heap::kTheHoleValueRootIndex); | 5722 Heap::kTheHoleValueRootIndex); |
5696 | 5723 |
5697 // Store the WeakCell in the feedback vector. | 5724 // Store the WeakCell in the feedback vector. |
5698 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, | 5725 StoreFixedArrayElement(feedback_vector, slot, cell, UPDATE_WRITE_BARRIER, |
5699 CodeStubAssembler::SMI_PARAMETERS); | 5726 CodeStubAssembler::SMI_PARAMETERS); |
5700 return cell; | 5727 return cell; |
5701 } | 5728 } |
5702 | 5729 |
5703 } // namespace internal | 5730 } // namespace internal |
5704 } // namespace v8 | 5731 } // namespace v8 |
OLD | NEW |