OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/compiler/js-global-object-specialization.h" | 5 #include "src/compiler/js-global-object-specialization.h" |
6 | 6 |
7 #include "src/compilation-dependencies.h" | 7 #include "src/compilation-dependencies.h" |
8 #include "src/compiler/access-builder.h" | 8 #include "src/compiler/access-builder.h" |
9 #include "src/compiler/common-operator.h" | 9 #include "src/compiler/common-operator.h" |
10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 case PropertyCellType::kUndefined: { | 166 case PropertyCellType::kUndefined: { |
167 return NoChange(); | 167 return NoChange(); |
168 } | 168 } |
169 case PropertyCellType::kConstant: { | 169 case PropertyCellType::kConstant: { |
170 // Record a code dependency on the cell, and just deoptimize if the new | 170 // Record a code dependency on the cell, and just deoptimize if the new |
171 // value doesn't match the previous value stored inside the cell. | 171 // value doesn't match the previous value stored inside the cell. |
172 dependencies()->AssumePropertyCell(property_cell); | 172 dependencies()->AssumePropertyCell(property_cell); |
173 Node* check = | 173 Node* check = |
174 graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value, | 174 graph()->NewNode(simplified()->ReferenceEqual(Type::Tagged()), value, |
175 jsgraph()->Constant(property_cell_value)); | 175 jsgraph()->Constant(property_cell_value)); |
176 control = graph()->NewNode(common()->DeoptimizeUnless(), check, | 176 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
177 frame_state, effect, control); | 177 frame_state, effect, control); |
178 break; | 178 break; |
179 } | 179 } |
180 case PropertyCellType::kConstantType: { | 180 case PropertyCellType::kConstantType: { |
181 // Record a code dependency on the cell, and just deoptimize if the new | 181 // Record a code dependency on the cell, and just deoptimize if the new |
182 // values' type doesn't match the type of the previous value in the cell. | 182 // values' type doesn't match the type of the previous value in the cell. |
183 dependencies()->AssumePropertyCell(property_cell); | 183 dependencies()->AssumePropertyCell(property_cell); |
184 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); | 184 Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); |
185 Type* property_cell_value_type = Type::TaggedSigned(); | 185 Type* property_cell_value_type = Type::TaggedSigned(); |
186 if (property_cell_value->IsHeapObject()) { | 186 if (property_cell_value->IsHeapObject()) { |
187 // Deoptimize if the {value} is a Smi. | 187 // Deoptimize if the {value} is a Smi. |
188 control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, | 188 control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
189 effect, control); | 189 frame_state, effect, control); |
190 | 190 |
191 // Load the {value} map check against the {property_cell} map. | 191 // Load the {value} map check against the {property_cell} map. |
192 Node* value_map = effect = | 192 Node* value_map = effect = |
193 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | 193 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), |
194 value, effect, control); | 194 value, effect, control); |
195 Handle<Map> property_cell_value_map( | 195 Handle<Map> property_cell_value_map( |
196 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); | 196 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); |
197 check = graph()->NewNode( | 197 check = graph()->NewNode( |
198 simplified()->ReferenceEqual(Type::Any()), value_map, | 198 simplified()->ReferenceEqual(Type::Any()), value_map, |
199 jsgraph()->HeapConstant(property_cell_value_map)); | 199 jsgraph()->HeapConstant(property_cell_value_map)); |
200 property_cell_value_type = Type::TaggedPointer(); | 200 property_cell_value_type = Type::TaggedPointer(); |
201 } | 201 } |
202 control = graph()->NewNode(common()->DeoptimizeUnless(), check, | 202 control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
203 frame_state, effect, control); | 203 frame_state, effect, control); |
204 effect = graph()->NewNode( | 204 effect = graph()->NewNode( |
205 simplified()->StoreField( | 205 simplified()->StoreField( |
206 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), | 206 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), |
207 jsgraph()->HeapConstant(property_cell), value, effect, control); | 207 jsgraph()->HeapConstant(property_cell), value, effect, control); |
208 break; | 208 break; |
209 } | 209 } |
210 case PropertyCellType::kMutable: { | 210 case PropertyCellType::kMutable: { |
211 // Store to non-configurable, data property on the global can be lowered | 211 // Store to non-configurable, data property on the global can be lowered |
212 // to a field store, even without recording a code dependency on the cell, | 212 // to a field store, even without recording a code dependency on the cell, |
213 // because the property cannot be deleted or reconfigured to an accessor | 213 // because the property cannot be deleted or reconfigured to an accessor |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 275 } |
276 | 276 |
277 | 277 |
278 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { | 278 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { |
279 return jsgraph()->simplified(); | 279 return jsgraph()->simplified(); |
280 } | 280 } |
281 | 281 |
282 } // namespace compiler | 282 } // namespace compiler |
283 } // namespace internal | 283 } // namespace internal |
284 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |