Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: runtime/vm/object.h

Issue 807593002: Merge RawICData::range_feedback_ field into RawICData::state_bits_. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 { 3550 // Note: only deopts with reasons below kUnknown in this list are recorded in
zra 2014/12/15 20:57:38 "below" could be a little confusing. I first read
3551 return raw_ptr()->range_feedback_; 3551 // the ICData. All other reasons are used purely for printing informational
3552 } 3552 // messages printed during deoptimization itself.
3553
3554 #define DEOPT_REASONS(V) \ 3553 #define DEOPT_REASONS(V) \
3554 V(BinarySmiOp) \
3555 V(BinaryMintOp) \
3556 V(DoubleToSmi) \
3555 V(Unknown) \ 3557 V(Unknown) \
3556 V(InstanceGetter) \ 3558 V(InstanceGetter) \
3557 V(PolymorphicInstanceCallTestFail) \ 3559 V(PolymorphicInstanceCallTestFail) \
3558 V(InstanceCallNoICData) \ 3560 V(InstanceCallNoICData) \
3559 V(IntegerToDouble) \ 3561 V(IntegerToDouble) \
3560 V(BinarySmiOp) \
3561 V(BinaryMintOp) \
3562 V(UnaryMintOp) \ 3562 V(UnaryMintOp) \
3563 V(ShiftMintOp) \
3564 V(BinaryDoubleOp) \ 3563 V(BinaryDoubleOp) \
3565 V(InstanceSetter) \ 3564 V(InstanceSetter) \
3566 V(Equality) \ 3565 V(Equality) \
3567 V(RelationalOp) \ 3566 V(RelationalOp) \
3568 V(EqualityClassCheck) \ 3567 V(EqualityClassCheck) \
3569 V(NoTypeFeedback) \ 3568 V(NoTypeFeedback) \
3570 V(UnaryOp) \ 3569 V(UnaryOp) \
3571 V(UnboxInteger) \ 3570 V(UnboxInteger) \
3572 V(CheckClass) \ 3571 V(CheckClass) \
3573 V(CheckSmi) \ 3572 V(CheckSmi) \
3574 V(CheckArrayBound) \ 3573 V(CheckArrayBound) \
3575 V(AtCall) \ 3574 V(AtCall) \
3576 V(DoubleToSmi) \
3577 V(Int32Load) \ 3575 V(Int32Load) \
3578 V(Uint32Load) \ 3576 V(Uint32Load) \
3579 V(GuardField) \ 3577 V(GuardField) \
3580 V(TestCids) \ 3578 V(TestCids) \
3581 V(NumReasons) \ 3579 V(NumReasons) \
3582 3580
3583 enum DeoptReasonId { 3581 enum DeoptReasonId {
3584 #define DEFINE_ENUM_LIST(name) kDeopt##name, 3582 #define DEFINE_ENUM_LIST(name) kDeopt##name,
3585 DEOPT_REASONS(DEFINE_ENUM_LIST) 3583 DEOPT_REASONS(DEFINE_ENUM_LIST)
3586 #undef DEFINE_ENUM_LIST 3584 #undef DEFINE_ENUM_LIST
3587 }; 3585 };
3588 3586
3587 enum {
3588 kLastRecordedDeoptReason = kDeoptUnknown - 1
3589 };
3590
3589 enum DeoptFlags { 3591 enum DeoptFlags {
3590 // Deoptimization is caused by an optimistically hoisted instruction. 3592 // Deoptimization is caused by an optimistically hoisted instruction.
3591 kHoisted = 1 << 0, 3593 kHoisted = 1 << 0,
3592 3594
3593 // Deoptimization is caused by an optimistically generalized bounds check. 3595 // Deoptimization is caused by an optimistically generalized bounds check.
3594 kGeneralized = 1 << 1 3596 kGeneralized = 1 << 1
3595 }; 3597 };
3596 3598
3597 bool HasDeoptReasons() const { return DeoptReasons() != 0; } 3599 bool HasDeoptReasons() const { return DeoptReasons() != 0; }
3598 uint32_t DeoptReasons() const; 3600 uint32_t DeoptReasons() const;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3638 } 3640 }
3639 3641
3640 static intptr_t ic_data_offset() { 3642 static intptr_t ic_data_offset() {
3641 return OFFSET_OF(RawICData, ic_data_); 3643 return OFFSET_OF(RawICData, ic_data_);
3642 } 3644 }
3643 3645
3644 static intptr_t owner_offset() { 3646 static intptr_t owner_offset() {
3645 return OFFSET_OF(RawICData, owner_); 3647 return OFFSET_OF(RawICData, owner_);
3646 } 3648 }
3647 3649
3648 static intptr_t range_feedback_offset() {
3649 return OFFSET_OF(RawICData, range_feedback_);
3650 }
3651
3652 // Used for unoptimized static calls when no class-ids are checked. 3650 // Used for unoptimized static calls when no class-ids are checked.
3653 void AddTarget(const Function& target) const; 3651 void AddTarget(const Function& target) const;
3654 3652
3655 // Adding checks. 3653 // Adding checks.
3656 3654
3657 // Adds one more class test to ICData. Length of 'classes' must be equal to 3655 // Adds one more class test to ICData. Length of 'classes' must be equal to
3658 // the number of arguments tested. Use only for num_args_tested > 1. 3656 // the number of arguments tested. Use only for num_args_tested > 1.
3659 void AddCheck(const GrowableArray<intptr_t>& class_ids, 3657 void AddCheck(const GrowableArray<intptr_t>& class_ids,
3660 const Function& target) const; 3658 const Function& target) const;
3661 // Adds sorted so that Smi is the first class-id. Use only for 3659 // Adds sorted so that Smi is the first class-id. Use only for
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
3749 // - usmi 0000 [used only on 32bit platforms] 3747 // - usmi 0000 [used only on 32bit platforms]
3750 // - smi 0001 3748 // - smi 0001
3751 // - uint31 0010 3749 // - uint31 0010
3752 // - int32 0011 3750 // - int32 0011
3753 // - uint32 0100 3751 // - uint32 0100
3754 // - int33 x1x1 3752 // - int33 x1x1
3755 // - int64 1xxx 3753 // - int64 1xxx
3756 // 3754 //
3757 // DecodeRangeFeedbackAt() helper maps these states into the RangeFeedback 3755 // DecodeRangeFeedbackAt() helper maps these states into the RangeFeedback
3758 // enumeration. 3756 // enumeration.
3759 enum RangeFeedbackBits { 3757 enum RangeFeedbackLatticeBits {
3760 kSignedRangeBit = 1 << 0, 3758 kSignedRangeBit = 1 << 0,
3761 kInt32RangeBit = 1 << 1, 3759 kInt32RangeBit = 1 << 1,
3762 kUint32RangeBit = 1 << 2, 3760 kUint32RangeBit = 1 << 2,
3763 kInt64RangeBit = 1 << 3, 3761 kInt64RangeBit = 1 << 3,
3764 kBitsPerRangeFeedback = 4, 3762 kBitsPerRangeFeedback = 4,
3765 kRangeFeedbackMask = (1 << kBitsPerRangeFeedback) - 1 3763 kRangeFeedbackMask = (1 << kBitsPerRangeFeedback) - 1,
3764 kRangeFeedbackSlots = 3
3766 }; 3765 };
3767 3766
3768 static bool IsValidRangeFeedbackIndex(intptr_t index) { 3767 static bool IsValidRangeFeedbackIndex(intptr_t index) {
3769 return (0 <= index) && (index < 3); 3768 return (0 <= index) && (index < kRangeFeedbackSlots);
3769 }
3770
3771 static intptr_t RangeFeedbackShift(intptr_t index) {
3772 return (index * kBitsPerRangeFeedback) + kRangeFeedbackPos;
3770 } 3773 }
3771 3774
3772 static const char* RangeFeedbackToString(RangeFeedback feedback) { 3775 static const char* RangeFeedbackToString(RangeFeedback feedback) {
3773 switch (feedback) { 3776 switch (feedback) {
3774 case kSmiRange: 3777 case kSmiRange:
3775 return "smi"; 3778 return "smi";
3776 case kInt32Range: 3779 case kInt32Range:
3777 return "int32"; 3780 return "int32";
3778 case kUint32Range: 3781 case kUint32Range:
3779 return "uint32"; 3782 return "uint32";
(...skipping 15 matching lines...) Expand all
3795 return raw_ptr()->ic_data_; 3798 return raw_ptr()->ic_data_;
3796 } 3799 }
3797 3800
3798 void set_owner(const Function& value) const; 3801 void set_owner(const Function& value) const;
3799 void set_target_name(const String& value) const; 3802 void set_target_name(const String& value) const;
3800 void set_arguments_descriptor(const Array& value) const; 3803 void set_arguments_descriptor(const Array& value) const;
3801 void set_deopt_id(intptr_t value) const; 3804 void set_deopt_id(intptr_t value) const;
3802 void SetNumArgsTested(intptr_t value) const; 3805 void SetNumArgsTested(intptr_t value) const;
3803 void set_ic_data(const Array& value) const; 3806 void set_ic_data(const Array& value) const;
3804 void set_state_bits(uint32_t bits) const; 3807 void set_state_bits(uint32_t bits) const;
3805 void set_range_feedback(uint32_t feedback);
3806 3808
3807 enum { 3809 enum {
3808 kNumArgsTestedPos = 0, 3810 kNumArgsTestedPos = 0,
3809 kNumArgsTestedSize = 2, 3811 kNumArgsTestedSize = 2,
3810 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, 3812 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize,
3811 kDeoptReasonSize = kDeoptNumReasons, 3813 kDeoptReasonSize = kLastRecordedDeoptReason + 1,
3812 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, 3814 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize,
3815 kRangeFeedbackPos = kIssuedJSWarningBit + 1,
3816 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots
3813 }; 3817 };
3814 3818
3815 class NumArgsTestedBits : public BitField<uint32_t, 3819 class NumArgsTestedBits : public BitField<uint32_t,
3816 kNumArgsTestedPos, kNumArgsTestedSize> {}; // NOLINT 3820 kNumArgsTestedPos, kNumArgsTestedSize> {}; // NOLINT
3817 class DeoptReasonBits : public BitField<uint32_t, 3821 class DeoptReasonBits : public BitField<uint32_t,
3818 ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {}; // NOLINT 3822 ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {}; // NOLINT
3819 class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {}; 3823 class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {};
3824 class RangeFeedbackBits : public BitField<uint32_t,
3825 ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {}; // NOLINT
3820 3826
3821 #if defined(DEBUG) 3827 #if defined(DEBUG)
3822 // Used in asserts to verify that a check is not added twice. 3828 // Used in asserts to verify that a check is not added twice.
3823 bool HasCheck(const GrowableArray<intptr_t>& cids) const; 3829 bool HasCheck(const GrowableArray<intptr_t>& cids) const;
3824 #endif // DEBUG 3830 #endif // DEBUG
3825 3831
3826 intptr_t TestEntryLength() const; 3832 intptr_t TestEntryLength() const;
3827 void WriteSentinel(const Array& data) const; 3833 void WriteSentinel(const Array& data) const;
3828 3834
3829 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); 3835 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object);
(...skipping 3838 matching lines...) Expand 10 before | Expand all | Expand 10 after
7668 7674
7669 7675
7670 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7676 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7671 intptr_t index) { 7677 intptr_t index) {
7672 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7678 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7673 } 7679 }
7674 7680
7675 } // namespace dart 7681 } // namespace dart
7676 7682
7677 #endif // VM_OBJECT_H_ 7683 #endif // VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698