OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 3529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3540 RawArray* arguments_descriptor() const { | 3540 RawArray* arguments_descriptor() const { |
3541 return raw_ptr()->args_descriptor_; | 3541 return raw_ptr()->args_descriptor_; |
3542 } | 3542 } |
3543 | 3543 |
3544 intptr_t NumArgsTested() const; | 3544 intptr_t NumArgsTested() const; |
3545 | 3545 |
3546 intptr_t deopt_id() const { | 3546 intptr_t deopt_id() const { |
3547 return raw_ptr()->deopt_id_; | 3547 return raw_ptr()->deopt_id_; |
3548 } | 3548 } |
3549 | 3549 |
3550 uint32_t range_feedback() const { | |
3551 return raw_ptr()->range_feedback_; | |
3552 } | |
3553 | |
3550 #define DEOPT_REASONS(V) \ | 3554 #define DEOPT_REASONS(V) \ |
3551 V(Unknown) \ | 3555 V(Unknown) \ |
3552 V(InstanceGetter) \ | 3556 V(InstanceGetter) \ |
3553 V(PolymorphicInstanceCallTestFail) \ | 3557 V(PolymorphicInstanceCallTestFail) \ |
3554 V(InstanceCallNoICData) \ | 3558 V(InstanceCallNoICData) \ |
3555 V(IntegerToDouble) \ | 3559 V(IntegerToDouble) \ |
3556 V(BinarySmiOp) \ | 3560 V(BinarySmiOp) \ |
3557 V(BinaryMintOp) \ | 3561 V(BinaryMintOp) \ |
3558 V(UnaryMintOp) \ | 3562 V(UnaryMintOp) \ |
3559 V(ShiftMintOp) \ | 3563 V(ShiftMintOp) \ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3634 } | 3638 } |
3635 | 3639 |
3636 static intptr_t ic_data_offset() { | 3640 static intptr_t ic_data_offset() { |
3637 return OFFSET_OF(RawICData, ic_data_); | 3641 return OFFSET_OF(RawICData, ic_data_); |
3638 } | 3642 } |
3639 | 3643 |
3640 static intptr_t owner_offset() { | 3644 static intptr_t owner_offset() { |
3641 return OFFSET_OF(RawICData, owner_); | 3645 return OFFSET_OF(RawICData, owner_); |
3642 } | 3646 } |
3643 | 3647 |
3648 static intptr_t range_feedback_offset() { | |
3649 return OFFSET_OF(RawICData, range_feedback_); | |
3650 } | |
3651 | |
3644 // Used for unoptimized static calls when no class-ids are checked. | 3652 // Used for unoptimized static calls when no class-ids are checked. |
3645 void AddTarget(const Function& target) const; | 3653 void AddTarget(const Function& target) const; |
3646 | 3654 |
3647 // Adding checks. | 3655 // Adding checks. |
3648 | 3656 |
3649 // Adds one more class test to ICData. Length of 'classes' must be equal to | 3657 // Adds one more class test to ICData. Length of 'classes' must be equal to |
3650 // the number of arguments tested. Use only for num_args_tested > 1. | 3658 // the number of arguments tested. Use only for num_args_tested > 1. |
3651 void AddCheck(const GrowableArray<intptr_t>& class_ids, | 3659 void AddCheck(const GrowableArray<intptr_t>& class_ids, |
3652 const Function& target) const; | 3660 const Function& target) const; |
3653 // Adds sorted so that Smi is the first class-id. Use only for | 3661 // Adds sorted so that Smi is the first class-id. Use only for |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3708 | 3716 |
3709 static intptr_t CountIndexFor(intptr_t num_args) { | 3717 static intptr_t CountIndexFor(intptr_t num_args) { |
3710 return (num_args + 1); | 3718 return (num_args + 1); |
3711 } | 3719 } |
3712 | 3720 |
3713 bool IsUsedAt(intptr_t i) const; | 3721 bool IsUsedAt(intptr_t i) const; |
3714 | 3722 |
3715 void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, | 3723 void GetUsedCidsForTwoArgs(GrowableArray<intptr_t>* first, |
3716 GrowableArray<intptr_t>* second) const; | 3724 GrowableArray<intptr_t>* second) const; |
3717 | 3725 |
3726 enum RangeFeedback { | |
3727 kSmiRange, kInt32Range, kUint32Range, kInt64Range | |
3728 }; | |
3729 | |
3730 enum { | |
3731 kSignBit = 1 << 0, | |
3732 kInt32Bit = 1 << 1, | |
3733 kUint32Bit = 1 << 2, | |
3734 kInt64Bit = 1 << 3, | |
3735 kBitsPerRangeFeedback = 4, | |
3736 kRangeFeedbackMask = (1 << kBitsPerRangeFeedback) - 1 | |
3737 }; | |
srdjan
2014/12/15 16:39:01
I think it would be more readable to say, e.g., kI
Vyacheslav Egorov (Google)
2014/12/15 17:20:05
Done.
| |
3738 | |
3739 static const char* RangeFeedbackToString(RangeFeedback feedback) { | |
3740 switch (feedback) { | |
3741 case kSmiRange: | |
3742 return "smi"; | |
3743 case kInt32Range: | |
3744 return "int32"; | |
3745 case kUint32Range: | |
3746 return "uint32"; | |
3747 case kInt64Range: | |
3748 return "int64"; | |
3749 default: | |
3750 UNREACHABLE(); | |
3751 return "?"; | |
3752 } | |
3753 } | |
3754 | |
3755 bool HasRangeFeedback() const; | |
3756 RangeFeedback DecodeRangeFeedbackAt(intptr_t idx) const; | |
3757 | |
3718 private: | 3758 private: |
3719 RawArray* ic_data() const { | 3759 RawArray* ic_data() const { |
3720 return raw_ptr()->ic_data_; | 3760 return raw_ptr()->ic_data_; |
3721 } | 3761 } |
3722 | 3762 |
3723 void set_owner(const Function& value) const; | 3763 void set_owner(const Function& value) const; |
3724 void set_target_name(const String& value) const; | 3764 void set_target_name(const String& value) const; |
3725 void set_arguments_descriptor(const Array& value) const; | 3765 void set_arguments_descriptor(const Array& value) const; |
3726 void set_deopt_id(intptr_t value) const; | 3766 void set_deopt_id(intptr_t value) const; |
3727 void SetNumArgsTested(intptr_t value) const; | 3767 void SetNumArgsTested(intptr_t value) const; |
3728 void set_ic_data(const Array& value) const; | 3768 void set_ic_data(const Array& value) const; |
3729 void set_state_bits(uint32_t bits) const; | 3769 void set_state_bits(uint32_t bits) const; |
3770 void set_range_feedback(uint32_t feedback); | |
3730 | 3771 |
3731 enum { | 3772 enum { |
3732 kNumArgsTestedPos = 0, | 3773 kNumArgsTestedPos = 0, |
3733 kNumArgsTestedSize = 2, | 3774 kNumArgsTestedSize = 2, |
3734 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, | 3775 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, |
3735 kDeoptReasonSize = kDeoptNumReasons, | 3776 kDeoptReasonSize = kDeoptNumReasons, |
3736 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, | 3777 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, |
3737 }; | 3778 }; |
3738 | 3779 |
3739 class NumArgsTestedBits : public BitField<uint32_t, | 3780 class NumArgsTestedBits : public BitField<uint32_t, |
(...skipping 3852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7592 | 7633 |
7593 | 7634 |
7594 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7635 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7595 intptr_t index) { | 7636 intptr_t index) { |
7596 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7637 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7597 } | 7638 } |
7598 | 7639 |
7599 } // namespace dart | 7640 } // namespace dart |
7600 | 7641 |
7601 #endif // VM_OBJECT_H_ | 7642 #endif // VM_OBJECT_H_ |
OLD | NEW |