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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 } else if (IsFastElementsKind(map->elements_kind())) { | 397 } else if (IsFastElementsKind(map->elements_kind())) { |
398 field_type = type_cache_.kFixedArrayLengthType; | 398 field_type = type_cache_.kFixedArrayLengthType; |
399 } else { | 399 } else { |
400 field_type = type_cache_.kJSArrayLengthType; | 400 field_type = type_cache_.kJSArrayLengthType; |
401 } | 401 } |
402 } | 402 } |
403 *access_info = PropertyAccessInfo::DataField(Type::Class(map, zone()), | 403 *access_info = PropertyAccessInfo::DataField(Type::Class(map, zone()), |
404 field_index, field_type); | 404 field_index, field_type); |
405 return true; | 405 return true; |
406 } | 406 } |
407 // Check for special JSArrayBufferView field accessors. | |
408 if (Accessors::IsJSArrayBufferViewFieldAccessor(map, name, &offset)) { | |
409 FieldIndex field_index = FieldIndex::ForInObjectOffset(offset); | |
410 Type* field_type = Type::Tagged(); | |
411 if (Name::Equals(factory()->byte_length_string(), name) || | |
412 Name::Equals(factory()->byte_offset_string(), name)) { | |
413 // The JSArrayBufferView::byte_length and JSArrayBufferView::byte_offset | |
414 // properties are always numbers in the range [0, kMaxSafeInteger]. | |
415 field_type = type_cache_.kPositiveSafeInteger; | |
416 } else if (map->IsJSTypedArrayMap()) { | |
417 DCHECK(Name::Equals(factory()->length_string(), name)); | |
418 // The JSTypedArray::length property is always a number in the range | |
419 // [0, kMaxSafeInteger]. | |
420 field_type = type_cache_.kPositiveSafeInteger; | |
421 } | |
422 *access_info = PropertyAccessInfo::DataField( | |
423 Type::Class(map, zone()), field_index, field_type, | |
424 FieldCheck::kJSArrayBufferViewBufferNotNeutered); | |
425 return true; | |
426 } | |
427 return false; | 407 return false; |
428 } | 408 } |
429 | 409 |
430 | 410 |
431 bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name, | 411 bool AccessInfoFactory::LookupTransition(Handle<Map> map, Handle<Name> name, |
432 MaybeHandle<JSObject> holder, | 412 MaybeHandle<JSObject> holder, |
433 PropertyAccessInfo* access_info) { | 413 PropertyAccessInfo* access_info) { |
434 // Check if the {map} has a data transition with the given {name}. | 414 // Check if the {map} has a data transition with the given {name}. |
435 if (map->unused_property_fields() == 0) return false; | 415 if (map->unused_property_fields() == 0) return false; |
436 Handle<Map> transition_map; | 416 Handle<Map> transition_map; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 } | 458 } |
479 return false; | 459 return false; |
480 } | 460 } |
481 | 461 |
482 | 462 |
483 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } | 463 Factory* AccessInfoFactory::factory() const { return isolate()->factory(); } |
484 | 464 |
485 } // namespace compiler | 465 } // namespace compiler |
486 } // namespace internal | 466 } // namespace internal |
487 } // namespace v8 | 467 } // namespace v8 |
OLD | NEW |