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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 graph()->NewNode(simplified()->CheckIf(), check, effect, control); | 189 graph()->NewNode(simplified()->CheckIf(), check, effect, control); |
190 break; | 190 break; |
191 } | 191 } |
192 case PropertyCellType::kConstantType: { | 192 case PropertyCellType::kConstantType: { |
193 // Record a code dependency on the cell, and just deoptimize if the new | 193 // Record a code dependency on the cell, and just deoptimize if the new |
194 // values' type doesn't match the type of the previous value in the cell. | 194 // values' type doesn't match the type of the previous value in the cell. |
195 dependencies()->AssumePropertyCell(property_cell); | 195 dependencies()->AssumePropertyCell(property_cell); |
196 Type* property_cell_value_type; | 196 Type* property_cell_value_type; |
197 MachineRepresentation representation = MachineRepresentation::kTagged; | 197 MachineRepresentation representation = MachineRepresentation::kTagged; |
198 if (property_cell_value->IsHeapObject()) { | 198 if (property_cell_value->IsHeapObject()) { |
199 // We cannot do anything if the {property_cell_value}s map is no | |
200 // longer stable. | |
201 Handle<Map> property_cell_value_map( | |
202 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); | |
203 if (!property_cell_value_map->is_stable()) return NoChange(); | |
204 dependencies()->AssumeMapStable(property_cell_value_map); | |
205 | |
206 // Check that the {value} is a HeapObject. | 199 // Check that the {value} is a HeapObject. |
207 value = effect = graph()->NewNode(simplified()->CheckHeapObject(), | 200 value = effect = graph()->NewNode(simplified()->CheckHeapObject(), |
208 value, effect, control); | 201 value, effect, control); |
209 | 202 |
210 // Check {value} map agains the {property_cell} map. | 203 // Check {value} map agains the {property_cell} map. |
| 204 Handle<Map> property_cell_value_map( |
| 205 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); |
211 effect = graph()->NewNode( | 206 effect = graph()->NewNode( |
212 simplified()->CheckMaps(1), value, | 207 simplified()->CheckMaps(1), value, |
213 jsgraph()->HeapConstant(property_cell_value_map), effect, control); | 208 jsgraph()->HeapConstant(property_cell_value_map), effect, control); |
214 property_cell_value_type = Type::OtherInternal(); | 209 property_cell_value_type = Type::OtherInternal(); |
215 representation = MachineRepresentation::kTaggedPointer; | 210 representation = MachineRepresentation::kTaggedPointer; |
216 } else { | 211 } else { |
217 // Check that the {value} is a Smi. | 212 // Check that the {value} is a Smi. |
218 value = effect = | 213 value = effect = |
219 graph()->NewNode(simplified()->CheckSmi(), value, effect, control); | 214 graph()->NewNode(simplified()->CheckSmi(), value, effect, control); |
220 property_cell_value_type = Type::SignedSmall(); | 215 property_cell_value_type = Type::SignedSmall(); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 return jsgraph()->javascript(); | 275 return jsgraph()->javascript(); |
281 } | 276 } |
282 | 277 |
283 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { | 278 SimplifiedOperatorBuilder* JSGlobalObjectSpecialization::simplified() const { |
284 return jsgraph()->simplified(); | 279 return jsgraph()->simplified(); |
285 } | 280 } |
286 | 281 |
287 } // namespace compiler | 282 } // namespace compiler |
288 } // namespace internal | 283 } // namespace internal |
289 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |