| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/access-builder.h" | 5 #include "src/compiler/access-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler/type-cache.h" | 7 #include "src/compiler/type-cache.h" |
| 8 #include "src/contexts.h" | 8 #include "src/contexts.h" |
| 9 #include "src/frames.h" | 9 #include "src/frames.h" |
| 10 #include "src/handles-inl.h" | 10 #include "src/handles-inl.h" |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 564 FieldAccess access = {kTaggedBase, | 564 FieldAccess access = {kTaggedBase, |
| 565 JSGlobalObject::kNativeContextOffset, | 565 JSGlobalObject::kNativeContextOffset, |
| 566 Handle<Name>(), | 566 Handle<Name>(), |
| 567 Type::Internal(), | 567 Type::Internal(), |
| 568 MachineType::TaggedPointer(), | 568 MachineType::TaggedPointer(), |
| 569 kPointerWriteBarrier}; | 569 kPointerWriteBarrier}; |
| 570 return access; | 570 return access; |
| 571 } | 571 } |
| 572 | 572 |
| 573 // static | 573 // static |
| 574 FieldAccess AccessBuilder::ForJSArrayIteratorObject() { |
| 575 FieldAccess access = {kTaggedBase, |
| 576 JSArrayIterator::kIteratedObjectOffset, |
| 577 Handle<Name>(), |
| 578 Type::ReceiverOrUndefined(), |
| 579 MachineType::TaggedPointer(), |
| 580 kPointerWriteBarrier}; |
| 581 return access; |
| 582 } |
| 583 |
| 584 // static |
| 585 FieldAccess AccessBuilder::ForJSArrayIteratorIndex(InstanceType instance_type, |
| 586 ElementsKind elements_kind) { |
| 587 // In generic case, cap to 2^53-1 (per ToLength() in spec) via |
| 588 // kPositiveSafeInteger |
| 589 FieldAccess access = {kTaggedBase, |
| 590 JSArrayIterator::kNextIndexOffset, |
| 591 Handle<Name>(), |
| 592 TypeCache::Get().kPositiveSafeInteger, |
| 593 MachineType::AnyTagged(), |
| 594 kFullWriteBarrier}; |
| 595 if (instance_type == JS_ARRAY_TYPE) { |
| 596 if (IsFastDoubleElementsKind(elements_kind)) { |
| 597 access.type = TypeCache::Get().kFixedDoubleArrayLengthType; |
| 598 access.machine_type = MachineType::TaggedSigned(); |
| 599 access.write_barrier_kind = kNoWriteBarrier; |
| 600 } else if (IsFastElementsKind(elements_kind)) { |
| 601 access.type = TypeCache::Get().kFixedArrayLengthType; |
| 602 access.machine_type = MachineType::TaggedSigned(); |
| 603 access.write_barrier_kind = kNoWriteBarrier; |
| 604 } else { |
| 605 access.type = TypeCache::Get().kJSArrayLengthType; |
| 606 } |
| 607 } else if (instance_type == JS_TYPED_ARRAY_TYPE) { |
| 608 access.type = TypeCache::Get().kJSTypedArrayLengthType; |
| 609 access.machine_type = MachineType::TaggedSigned(); |
| 610 access.write_barrier_kind = kNoWriteBarrier; |
| 611 } |
| 612 return access; |
| 613 } |
| 614 |
| 615 // static |
| 616 FieldAccess AccessBuilder::ForJSArrayIteratorObjectMap() { |
| 617 FieldAccess access = {kTaggedBase, |
| 618 JSArrayIterator::kIteratedObjectMapOffset, |
| 619 Handle<Name>(), |
| 620 Type::OtherInternal(), |
| 621 MachineType::TaggedPointer(), |
| 622 kPointerWriteBarrier}; |
| 623 return access; |
| 624 } |
| 625 |
| 626 // static |
| 574 FieldAccess AccessBuilder::ForJSStringIteratorString() { | 627 FieldAccess AccessBuilder::ForJSStringIteratorString() { |
| 575 FieldAccess access = { | 628 FieldAccess access = { |
| 576 kTaggedBase, JSStringIterator::kStringOffset, Handle<Name>(), | 629 kTaggedBase, JSStringIterator::kStringOffset, Handle<Name>(), |
| 577 Type::String(), MachineType::TaggedPointer(), kPointerWriteBarrier}; | 630 Type::String(), MachineType::TaggedPointer(), kPointerWriteBarrier}; |
| 578 return access; | 631 return access; |
| 579 } | 632 } |
| 580 | 633 |
| 581 // static | 634 // static |
| 582 FieldAccess AccessBuilder::ForJSStringIteratorIndex() { | 635 FieldAccess AccessBuilder::ForJSStringIteratorIndex() { |
| 583 FieldAccess access = {kTaggedBase, | 636 FieldAccess access = {kTaggedBase, |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 } | 827 } |
| 775 UNREACHABLE(); | 828 UNREACHABLE(); |
| 776 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), | 829 ElementAccess access = {kUntaggedBase, 0, Type::None(), MachineType::None(), |
| 777 kNoWriteBarrier}; | 830 kNoWriteBarrier}; |
| 778 return access; | 831 return access; |
| 779 } | 832 } |
| 780 | 833 |
| 781 } // namespace compiler | 834 } // namespace compiler |
| 782 } // namespace internal | 835 } // namespace internal |
| 783 } // namespace v8 | 836 } // namespace v8 |
| OLD | NEW |