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 <ostream> | 5 #include <ostream> |
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-info.h" | 9 #include "src/compiler/access-info.h" |
10 #include "src/field-index-inl.h" | 10 #include "src/field-index-inl.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 PropertyAccessInfo PropertyAccessInfo::DataConstant( | 68 PropertyAccessInfo PropertyAccessInfo::DataConstant( |
69 Type* receiver_type, Handle<Object> constant, | 69 Type* receiver_type, Handle<Object> constant, |
70 MaybeHandle<JSObject> holder) { | 70 MaybeHandle<JSObject> holder) { |
71 return PropertyAccessInfo(holder, constant, receiver_type); | 71 return PropertyAccessInfo(holder, constant, receiver_type); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 // static | 75 // static |
76 PropertyAccessInfo PropertyAccessInfo::DataField( | 76 PropertyAccessInfo PropertyAccessInfo::DataField( |
77 Type* receiver_type, FieldIndex field_index, Type* field_type, | 77 Type* receiver_type, FieldIndex field_index, Type* field_type, |
78 MaybeHandle<JSObject> holder, MaybeHandle<Map> transition_map) { | 78 FieldCheck field_check, MaybeHandle<JSObject> holder, |
79 return PropertyAccessInfo(holder, transition_map, field_index, | 79 MaybeHandle<Map> transition_map) { |
| 80 return PropertyAccessInfo(holder, transition_map, field_index, field_check, |
80 field_type, receiver_type); | 81 field_type, receiver_type); |
81 } | 82 } |
82 | 83 |
83 | 84 |
84 ElementAccessInfo::ElementAccessInfo() : receiver_type_(Type::None()) {} | 85 ElementAccessInfo::ElementAccessInfo() : receiver_type_(Type::None()) {} |
85 | 86 |
86 | 87 |
87 ElementAccessInfo::ElementAccessInfo(Type* receiver_type, | 88 ElementAccessInfo::ElementAccessInfo(Type* receiver_type, |
88 ElementsKind elements_kind, | 89 ElementsKind elements_kind, |
89 MaybeHandle<JSObject> holder) | 90 MaybeHandle<JSObject> holder) |
(...skipping 20 matching lines...) Expand all Loading... |
110 : kind_(kDataConstant), | 111 : kind_(kDataConstant), |
111 receiver_type_(receiver_type), | 112 receiver_type_(receiver_type), |
112 constant_(constant), | 113 constant_(constant), |
113 holder_(holder), | 114 holder_(holder), |
114 field_type_(Type::Any()) {} | 115 field_type_(Type::Any()) {} |
115 | 116 |
116 | 117 |
117 PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder, | 118 PropertyAccessInfo::PropertyAccessInfo(MaybeHandle<JSObject> holder, |
118 MaybeHandle<Map> transition_map, | 119 MaybeHandle<Map> transition_map, |
119 FieldIndex field_index, | 120 FieldIndex field_index, |
120 Type* field_type, | 121 FieldCheck field_check, Type* field_type, |
121 Type* receiver_type) | 122 Type* receiver_type) |
122 : kind_(kDataField), | 123 : kind_(kDataField), |
123 receiver_type_(receiver_type), | 124 receiver_type_(receiver_type), |
124 transition_map_(transition_map), | 125 transition_map_(transition_map), |
125 holder_(holder), | 126 holder_(holder), |
126 field_index_(field_index), | 127 field_index_(field_index), |
| 128 field_check_(field_check), |
127 field_type_(field_type) {} | 129 field_type_(field_type) {} |
128 | 130 |
129 | 131 |
130 AccessInfoFactory::AccessInfoFactory(CompilationDependencies* dependencies, | 132 AccessInfoFactory::AccessInfoFactory(CompilationDependencies* dependencies, |
131 Handle<Context> native_context, Zone* zone) | 133 Handle<Context> native_context, Zone* zone) |
132 : dependencies_(dependencies), | 134 : dependencies_(dependencies), |
133 native_context_(native_context), | 135 native_context_(native_context), |
134 isolate_(native_context->GetIsolate()), | 136 isolate_(native_context->GetIsolate()), |
135 type_cache_(TypeCache::Get()), | 137 type_cache_(TypeCache::Get()), |
136 zone_(zone) { | 138 zone_(zone) { |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 field_type = Type::TaggedPointer(); | 293 field_type = Type::TaggedPointer(); |
292 } else if (!Type::Any()->Is(field_type)) { | 294 } else if (!Type::Any()->Is(field_type)) { |
293 // Add proper code dependencies in case of stable field map(s). | 295 // Add proper code dependencies in case of stable field map(s). |
294 Handle<Map> field_owner_map(map->FindFieldOwner(number), isolate()); | 296 Handle<Map> field_owner_map(map->FindFieldOwner(number), isolate()); |
295 dependencies()->AssumeFieldType(field_owner_map); | 297 dependencies()->AssumeFieldType(field_owner_map); |
296 } | 298 } |
297 DCHECK(field_type->Is(Type::TaggedPointer())); | 299 DCHECK(field_type->Is(Type::TaggedPointer())); |
298 } | 300 } |
299 *access_info = PropertyAccessInfo::DataField( | 301 *access_info = PropertyAccessInfo::DataField( |
300 Type::Class(receiver_map, zone()), field_index, field_type, | 302 Type::Class(receiver_map, zone()), field_index, field_type, |
301 holder); | 303 FieldCheck::kNone, holder); |
302 return true; | 304 return true; |
303 } else { | 305 } else { |
304 // TODO(bmeurer): Add support for accessors. | 306 // TODO(bmeurer): Add support for accessors. |
305 return false; | 307 return false; |
306 } | 308 } |
307 } | 309 } |
308 | 310 |
309 // Don't search on the prototype chain for special indices in case of | 311 // Don't search on the prototype chain for special indices in case of |
310 // integer indexed exotic objects (see ES6 section 9.4.5). | 312 // integer indexed exotic objects (see ES6 section 9.4.5). |
311 if (map->IsJSTypedArrayMap() && name->IsString() && | 313 if (map->IsJSTypedArrayMap() && name->IsString() && |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 } else if (!Type::Any()->Is(field_type)) { | 445 } else if (!Type::Any()->Is(field_type)) { |
444 // Add proper code dependencies in case of stable field map(s). | 446 // Add proper code dependencies in case of stable field map(s). |
445 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number), | 447 Handle<Map> field_owner_map(transition_map->FindFieldOwner(number), |
446 isolate()); | 448 isolate()); |
447 dependencies()->AssumeFieldType(field_owner_map); | 449 dependencies()->AssumeFieldType(field_owner_map); |
448 } | 450 } |
449 DCHECK(field_type->Is(Type::TaggedPointer())); | 451 DCHECK(field_type->Is(Type::TaggedPointer())); |
450 } | 452 } |
451 dependencies()->AssumeMapNotDeprecated(transition_map); | 453 dependencies()->AssumeMapNotDeprecated(transition_map); |
452 *access_info = PropertyAccessInfo::DataField( | 454 *access_info = PropertyAccessInfo::DataField( |
453 Type::Class(map, zone()), field_index, field_type, | 455 Type::Class(map, zone()), field_index, field_type, FieldCheck::kNone, |
454 holder, transition_map); | 456 holder, transition_map); |
455 return true; | 457 return true; |
456 } | 458 } |
457 return false; | 459 return false; |
458 } | 460 } |
459 | 461 |
460 | 462 |
461 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 463 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
462 | 464 |
463 } // namespace compiler | 465 } // namespace compiler |
464 } // namespace internal | 466 } // namespace internal |
465 } // namespace v8 | 467 } // namespace v8 |
OLD | NEW |