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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 case PropertyCellType::kConstantType: { | 179 case PropertyCellType::kConstantType: { |
180 // Record a code dependency on the cell, and just deoptimize if the new | 180 // Record a code dependency on the cell, and just deoptimize if the new |
181 // values' type doesn't match the type of the previous value in the cell. | 181 // values' type doesn't match the type of the previous value in the cell. |
182 dependencies()->AssumePropertyCell(property_cell); | 182 dependencies()->AssumePropertyCell(property_cell); |
183 Type* property_cell_value_type; | 183 Type* property_cell_value_type; |
184 if (property_cell_value->IsHeapObject()) { | 184 if (property_cell_value->IsHeapObject()) { |
185 // Check that the {value} is a HeapObject. | 185 // Check that the {value} is a HeapObject. |
186 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), | 186 value = effect = graph()->NewNode(simplified()->CheckTaggedPointer(), |
187 value, effect, control); | 187 value, effect, control); |
188 | 188 |
189 // Load the {value} map check against the {property_cell} map. | 189 // Check {value} map agains the {property_cell} map. |
190 Node* value_map = effect = | |
191 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), | |
192 value, effect, control); | |
193 Handle<Map> property_cell_value_map( | 190 Handle<Map> property_cell_value_map( |
194 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); | 191 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); |
195 Node* check = graph()->NewNode( | 192 effect = graph()->NewNode( |
196 simplified()->ReferenceEqual(Type::Any()), value_map, | 193 simplified()->CheckMaps(1), value, |
197 jsgraph()->HeapConstant(property_cell_value_map)); | 194 jsgraph()->HeapConstant(property_cell_value_map), effect, control); |
198 effect = | |
199 graph()->NewNode(simplified()->CheckIf(), check, effect, control); | |
200 property_cell_value_type = Type::TaggedPointer(); | 195 property_cell_value_type = Type::TaggedPointer(); |
201 } else { | 196 } else { |
202 // Check that the {value} is a Smi. | 197 // Check that the {value} is a Smi. |
203 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), | 198 value = effect = graph()->NewNode(simplified()->CheckTaggedSigned(), |
204 value, effect, control); | 199 value, effect, control); |
205 property_cell_value_type = Type::TaggedSigned(); | 200 property_cell_value_type = Type::TaggedSigned(); |
206 } | 201 } |
207 effect = graph()->NewNode( | 202 effect = graph()->NewNode( |
208 simplified()->StoreField( | 203 simplified()->StoreField( |
209 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), | 204 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 } | 273 } |
279 | 274 |
280 | 275 |
281 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { | 276 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { |
282 return jsgraph()->simplified(); | 277 return jsgraph()->simplified(); |
283 } | 278 } |
284 | 279 |
285 } // namespace compiler | 280 } // namespace compiler |
286 } // namespace internal | 281 } // namespace internal |
287 } // namespace v8 | 282 } // namespace v8 |
OLD | NEW |