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 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 Type* const field_type = access_info.field_type(); | 1110 Type* const field_type = access_info.field_type(); |
1111 MachineRepresentation const field_representation = | 1111 MachineRepresentation const field_representation = |
1112 access_info.field_representation(); | 1112 access_info.field_representation(); |
1113 if (access_mode == AccessMode::kLoad) { | 1113 if (access_mode == AccessMode::kLoad) { |
1114 if (access_info.holder().ToHandle(&holder)) { | 1114 if (access_info.holder().ToHandle(&holder)) { |
1115 receiver = jsgraph()->Constant(holder); | 1115 receiver = jsgraph()->Constant(holder); |
1116 } | 1116 } |
1117 // Optimize immutable property loads. | 1117 // Optimize immutable property loads. |
1118 HeapObjectMatcher m(receiver); | 1118 HeapObjectMatcher m(receiver); |
1119 if (m.HasValue() && m.Value()->IsJSObject()) { | 1119 if (m.HasValue() && m.Value()->IsJSObject()) { |
| 1120 // TODO(ishell): Use something simpler like |
| 1121 // |
| 1122 // Handle<Object> value = |
| 1123 // JSObject::FastPropertyAt(Handle<JSObject>::cast(m.Value()), |
| 1124 // Representation::Tagged(), field_index); |
| 1125 // |
| 1126 // here, once we have the immutable bit in the access_info. |
| 1127 |
1120 // TODO(turbofan): Given that we already have the field_index here, we | 1128 // TODO(turbofan): Given that we already have the field_index here, we |
1121 // might be smarter in the future and not rely on the LookupIterator, | 1129 // might be smarter in the future and not rely on the LookupIterator, |
1122 // but for now let's just do what Crankshaft does. | 1130 // but for now let's just do what Crankshaft does. |
1123 LookupIterator it(m.Value(), name, | 1131 LookupIterator it(m.Value(), name, |
1124 LookupIterator::OWN_SKIP_INTERCEPTOR); | 1132 LookupIterator::OWN_SKIP_INTERCEPTOR); |
1125 if (it.IsFound() && it.IsReadOnly() && !it.IsConfigurable()) { | 1133 if (it.state() == LookupIterator::DATA && it.IsReadOnly() && |
| 1134 !it.IsConfigurable()) { |
1126 Node* value = jsgraph()->Constant(JSReceiver::GetDataProperty(&it)); | 1135 Node* value = jsgraph()->Constant(JSReceiver::GetDataProperty(&it)); |
1127 return ValueEffectControl(value, effect, control); | 1136 return ValueEffectControl(value, effect, control); |
1128 } | 1137 } |
1129 } | 1138 } |
1130 } | 1139 } |
1131 Node* storage = receiver; | 1140 Node* storage = receiver; |
1132 if (!field_index.is_inobject()) { | 1141 if (!field_index.is_inobject()) { |
1133 storage = effect = graph()->NewNode( | 1142 storage = effect = graph()->NewNode( |
1134 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), | 1143 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), |
1135 storage, effect, control); | 1144 storage, effect, control); |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1957 return jsgraph()->javascript(); | 1966 return jsgraph()->javascript(); |
1958 } | 1967 } |
1959 | 1968 |
1960 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1969 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
1961 return jsgraph()->simplified(); | 1970 return jsgraph()->simplified(); |
1962 } | 1971 } |
1963 | 1972 |
1964 } // namespace compiler | 1973 } // namespace compiler |
1965 } // namespace internal | 1974 } // namespace internal |
1966 } // namespace v8 | 1975 } // namespace v8 |
OLD | NEW |