| 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 Type* const field_type = access_info.field_type(); | 1073 Type* const field_type = access_info.field_type(); |
| 1074 MachineRepresentation const field_representation = | 1074 MachineRepresentation const field_representation = |
| 1075 access_info.field_representation(); | 1075 access_info.field_representation(); |
| 1076 if (access_mode == AccessMode::kLoad) { | 1076 if (access_mode == AccessMode::kLoad) { |
| 1077 if (access_info.holder().ToHandle(&holder)) { | 1077 if (access_info.holder().ToHandle(&holder)) { |
| 1078 receiver = jsgraph()->Constant(holder); | 1078 receiver = jsgraph()->Constant(holder); |
| 1079 } | 1079 } |
| 1080 // Optimize immutable property loads. | 1080 // Optimize immutable property loads. |
| 1081 HeapObjectMatcher m(receiver); | 1081 HeapObjectMatcher m(receiver); |
| 1082 if (m.HasValue() && m.Value()->IsJSObject()) { | 1082 if (m.HasValue() && m.Value()->IsJSObject()) { |
| 1083 // TODO(ishell): Use something simpler like |
| 1084 // |
| 1085 // Handle<Object> value = |
| 1086 // JSObject::FastPropertyAt(Handle<JSObject>::cast(m.Value()), |
| 1087 // Representation::Tagged(), field_index); |
| 1088 // |
| 1089 // here, once we have the immutable bit in the access_info. |
| 1090 |
| 1083 // TODO(turbofan): Given that we already have the field_index here, we | 1091 // TODO(turbofan): Given that we already have the field_index here, we |
| 1084 // might be smarter in the future and not rely on the LookupIterator, | 1092 // might be smarter in the future and not rely on the LookupIterator, |
| 1085 // but for now let's just do what Crankshaft does. | 1093 // but for now let's just do what Crankshaft does. |
| 1086 LookupIterator it(m.Value(), name, | 1094 LookupIterator it(m.Value(), name, |
| 1087 LookupIterator::OWN_SKIP_INTERCEPTOR); | 1095 LookupIterator::OWN_SKIP_INTERCEPTOR); |
| 1088 if (it.IsFound() && it.IsReadOnly() && !it.IsConfigurable()) { | 1096 if (it.state() == LookupIterator::DATA && it.IsReadOnly() && |
| 1097 !it.IsConfigurable()) { |
| 1089 Node* value = jsgraph()->Constant(JSReceiver::GetDataProperty(&it)); | 1098 Node* value = jsgraph()->Constant(JSReceiver::GetDataProperty(&it)); |
| 1090 return ValueEffectControl(value, effect, control); | 1099 return ValueEffectControl(value, effect, control); |
| 1091 } | 1100 } |
| 1092 } | 1101 } |
| 1093 } | 1102 } |
| 1094 Node* storage = receiver; | 1103 Node* storage = receiver; |
| 1095 if (!field_index.is_inobject()) { | 1104 if (!field_index.is_inobject()) { |
| 1096 storage = effect = graph()->NewNode( | 1105 storage = effect = graph()->NewNode( |
| 1097 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), | 1106 simplified()->LoadField(AccessBuilder::ForJSObjectProperties()), |
| 1098 storage, effect, control); | 1107 storage, effect, control); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 return jsgraph()->javascript(); | 1922 return jsgraph()->javascript(); |
| 1914 } | 1923 } |
| 1915 | 1924 |
| 1916 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { | 1925 SimplifiedOperatorBuilder* JSNativeContextSpecialization::simplified() const { |
| 1917 return jsgraph()->simplified(); | 1926 return jsgraph()->simplified(); |
| 1918 } | 1927 } |
| 1919 | 1928 |
| 1920 } // namespace compiler | 1929 } // namespace compiler |
| 1921 } // namespace internal | 1930 } // namespace internal |
| 1922 } // namespace v8 | 1931 } // namespace v8 |
| OLD | NEW |