| 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/compilation-dependencies.h" | 8 #include "src/compilation-dependencies.h" |
| 9 #include "src/compiler/access-builder.h" | 9 #include "src/compiler/access-builder.h" |
| 10 #include "src/compiler/js-graph.h" | 10 #include "src/compiler/js-graph.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 dependencies()->AssumePropertyCell(property_cell); | 102 dependencies()->AssumePropertyCell(property_cell); |
| 103 // Compute proper type based on the current value in the cell. | 103 // Compute proper type based on the current value in the cell. |
| 104 Type* property_cell_value_type; | 104 Type* property_cell_value_type; |
| 105 if (property_cell_value->IsSmi()) { | 105 if (property_cell_value->IsSmi()) { |
| 106 property_cell_value_type = Type::Intersect( | 106 property_cell_value_type = Type::Intersect( |
| 107 Type::SignedSmall(), Type::TaggedSigned(), graph()->zone()); | 107 Type::SignedSmall(), Type::TaggedSigned(), graph()->zone()); |
| 108 } else if (property_cell_value->IsNumber()) { | 108 } else if (property_cell_value->IsNumber()) { |
| 109 property_cell_value_type = Type::Intersect( | 109 property_cell_value_type = Type::Intersect( |
| 110 Type::Number(), Type::TaggedPointer(), graph()->zone()); | 110 Type::Number(), Type::TaggedPointer(), graph()->zone()); |
| 111 } else { | 111 } else { |
| 112 property_cell_value_type = Type::Of(property_cell_value, graph()->zone()); | 112 Handle<Map> property_cell_value_map( |
| 113 Handle<HeapObject>::cast(property_cell_value)->map(), isolate()); |
| 114 property_cell_value_type = |
| 115 Type::Class(property_cell_value_map, graph()->zone()); |
| 113 } | 116 } |
| 114 Node* value = effect = graph()->NewNode( | 117 Node* value = effect = graph()->NewNode( |
| 115 simplified()->LoadField( | 118 simplified()->LoadField( |
| 116 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), | 119 AccessBuilder::ForPropertyCellValue(property_cell_value_type)), |
| 117 jsgraph()->Constant(property_cell), effect, control); | 120 jsgraph()->Constant(property_cell), effect, control); |
| 118 return Replace(node, value, effect); | 121 return Replace(node, value, effect); |
| 119 } | 122 } |
| 120 | 123 |
| 121 // Load from non-configurable, data property on the global can be lowered to | 124 // Load from non-configurable, data property on the global can be lowered to |
| 122 // a field load, even without deoptimization, because the property cannot be | 125 // a field load, even without deoptimization, because the property cannot be |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 if (access_mode == kStore) { | 401 if (access_mode == kStore) { |
| 399 // Store is not safe if the field type was cleared. | 402 // Store is not safe if the field type was cleared. |
| 400 break; | 403 break; |
| 401 } | 404 } |
| 402 | 405 |
| 403 // The field type was cleared by the GC, so we don't know anything | 406 // The field type was cleared by the GC, so we don't know anything |
| 404 // about the contents now. | 407 // about the contents now. |
| 405 // TODO(bmeurer): It would be awesome to make this saner in the | 408 // TODO(bmeurer): It would be awesome to make this saner in the |
| 406 // runtime/GC interaction. | 409 // runtime/GC interaction. |
| 407 field_type = Type::TaggedPointer(); | 410 field_type = Type::TaggedPointer(); |
| 408 } else { | 411 } else if (!Type::Any()->Is(field_type)) { |
| 409 // Add proper code dependencies in case of stable field map(s). | 412 // Add proper code dependencies in case of stable field map(s). |
| 410 if (field_type->NumClasses() > 0 && field_type->NowStable()) { | 413 Handle<Map> field_owner_map(map->FindFieldOwner(number), isolate()); |
| 411 dependencies()->AssumeFieldType( | 414 dependencies()->AssumeFieldType(field_owner_map); |
| 412 handle(map->FindFieldOwner(number), isolate())); | |
| 413 for (auto i = field_type->Classes(); !i.Done(); i.Advance()) { | |
| 414 dependencies()->AssumeMapStable(i.Current()); | |
| 415 } | |
| 416 } else { | |
| 417 field_type = Type::TaggedPointer(); | |
| 418 } | |
| 419 } | 415 } |
| 420 DCHECK(field_type->Is(Type::TaggedPointer())); | 416 DCHECK(field_type->Is(Type::TaggedPointer())); |
| 421 } | 417 } |
| 422 *access_info = PropertyAccessInfo::DataField(receiver_type, field_index, | 418 *access_info = PropertyAccessInfo::DataField(receiver_type, field_index, |
| 423 field_type, holder); | 419 field_type, holder); |
| 424 return true; | 420 return true; |
| 425 } else { | 421 } else { |
| 426 // TODO(bmeurer): Add support for accessors. | 422 // TODO(bmeurer): Add support for accessors. |
| 427 break; | 423 break; |
| 428 } | 424 } |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } | 936 } |
| 941 | 937 |
| 942 | 938 |
| 943 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 939 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 944 return jsgraph()->simplified(); | 940 return jsgraph()->simplified(); |
| 945 } | 941 } |
| 946 | 942 |
| 947 } // namespace compiler | 943 } // namespace compiler |
| 948 } // namespace internal | 944 } // namespace internal |
| 949 } // namespace v8 | 945 } // namespace v8 |
| OLD | NEW |