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