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-native-context-specialization.h" | 5 #include "src/compiler/js-native-context-specialization.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/compilation-dependencies.h" | 9 #include "src/compilation-dependencies.h" |
10 #include "src/compiler/access-builder.h" | 10 #include "src/compiler/access-builder.h" |
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2303 if (map->is_migration_target()) { | 2303 if (map->is_migration_target()) { |
2304 flags |= CheckMapsFlag::kTryMigrateInstance; | 2304 flags |= CheckMapsFlag::kTryMigrateInstance; |
2305 } | 2305 } |
2306 } | 2306 } |
2307 return graph()->NewNode(simplified()->CheckMaps(flags, maps), receiver, | 2307 return graph()->NewNode(simplified()->CheckMaps(flags, maps), receiver, |
2308 effect, control); | 2308 effect, control); |
2309 } | 2309 } |
2310 | 2310 |
2311 Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore( | 2311 Node* JSNativeContextSpecialization::BuildExtendPropertiesBackingStore( |
2312 Handle<Map> map, Node* properties, Node* effect, Node* control) { | 2312 Handle<Map> map, Node* properties, Node* effect, Node* control) { |
| 2313 // TODO(bmeurer/jkummerow): Property deletions can undo map transitions |
| 2314 // while keeping the backing store around, meaning that even though the |
| 2315 // map might believe that objects have no unused property fields, there |
| 2316 // might actually be some. It would be nice to not create a new backing |
| 2317 // store in that case (i.e. when properties->length() >= new_length). |
| 2318 // However, introducing branches and Phi nodes here would make it more |
| 2319 // difficult for escape analysis to get rid of the backing stores used |
| 2320 // for intermediate states of chains of property additions. That makes |
| 2321 // it unclear what the best approach is here. |
2313 DCHECK_EQ(0, map->unused_property_fields()); | 2322 DCHECK_EQ(0, map->unused_property_fields()); |
2314 // Compute the length of the old {properties} and the new properties. | 2323 // Compute the length of the old {properties} and the new properties. |
2315 int length = map->NextFreePropertyIndex() - map->GetInObjectProperties(); | 2324 int length = map->NextFreePropertyIndex() - map->GetInObjectProperties(); |
2316 int new_length = length + JSObject::kFieldsAdded; | 2325 int new_length = length + JSObject::kFieldsAdded; |
2317 // Collect the field values from the {properties}. | 2326 // Collect the field values from the {properties}. |
2318 ZoneVector<Node*> values(zone()); | 2327 ZoneVector<Node*> values(zone()); |
2319 values.reserve(new_length); | 2328 values.reserve(new_length); |
2320 for (int i = 0; i < length; ++i) { | 2329 for (int i = 0; i < length; ++i) { |
2321 Node* value = effect = graph()->NewNode( | 2330 Node* value = effect = graph()->NewNode( |
2322 simplified()->LoadField(AccessBuilder::ForFixedArraySlot(i)), | 2331 simplified()->LoadField(AccessBuilder::ForFixedArraySlot(i)), |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 return jsgraph()->javascript(); | 2571 return jsgraph()->javascript(); |
2563 } | 2572 } |
2564 | 2573 |
2565 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 2574 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
2566 return jsgraph()->simplified(); | 2575 return jsgraph()->simplified(); |
2567 } | 2576 } |
2568 | 2577 |
2569 } // namespace compiler | 2578 } // namespace compiler |
2570 } // namespace internal | 2579 } // namespace internal |
2571 } // namespace v8 | 2580 } // namespace v8 |
OLD | NEW |