| 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 2006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2017 | 2017 |
| 2018 RawArray* ic_data() const { | 2018 RawArray* ic_data() const { |
| 2019 return raw_ptr()->ic_data_; | 2019 return raw_ptr()->ic_data_; |
| 2020 } | 2020 } |
| 2021 | 2021 |
| 2022 void set_owner(const Function& value) const; | 2022 void set_owner(const Function& value) const; |
| 2023 void set_target_name(const String& value) const; | 2023 void set_target_name(const String& value) const; |
| 2024 void set_arguments_descriptor(const Array& value) const; | 2024 void set_arguments_descriptor(const Array& value) const; |
| 2025 void set_deopt_id(intptr_t value) const; | 2025 void set_deopt_id(intptr_t value) const; |
| 2026 void SetNumArgsTested(intptr_t value) const; | 2026 void SetNumArgsTested(intptr_t value) const; |
| 2027 void set_ic_data(const Array& value) const; | 2027 void set_ic_data_array(const Array& value) const; |
| 2028 void set_state_bits(uint32_t bits) const; | 2028 void set_state_bits(uint32_t bits) const; |
| 2029 | 2029 |
| 2030 enum { | 2030 enum { |
| 2031 kNumArgsTestedPos = 0, | 2031 kNumArgsTestedPos = 0, |
| 2032 kNumArgsTestedSize = 2, | 2032 kNumArgsTestedSize = 2, |
| 2033 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, | 2033 kDeoptReasonPos = kNumArgsTestedPos + kNumArgsTestedSize, |
| 2034 kDeoptReasonSize = kLastRecordedDeoptReason + 1, | 2034 kDeoptReasonSize = kLastRecordedDeoptReason + 1, |
| 2035 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, | 2035 kIssuedJSWarningBit = kDeoptReasonPos + kDeoptReasonSize, |
| 2036 kRangeFeedbackPos = kIssuedJSWarningBit + 1, | 2036 kRangeFeedbackPos = kIssuedJSWarningBit + 1, |
| 2037 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots | 2037 kRangeFeedbackSize = kBitsPerRangeFeedback * kRangeFeedbackSlots |
| 2038 }; | 2038 }; |
| 2039 | 2039 |
| 2040 class NumArgsTestedBits : public BitField<uint32_t, | 2040 class NumArgsTestedBits : public BitField<uint32_t, |
| 2041 kNumArgsTestedPos, kNumArgsTestedSize> {}; // NOLINT | 2041 kNumArgsTestedPos, kNumArgsTestedSize> {}; // NOLINT |
| 2042 class DeoptReasonBits : public BitField<uint32_t, | 2042 class DeoptReasonBits : public BitField<uint32_t, |
| 2043 ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {}; // NOLINT | 2043 ICData::kDeoptReasonPos, ICData::kDeoptReasonSize> {}; // NOLINT |
| 2044 class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {}; | 2044 class IssuedJSWarningBit : public BitField<bool, kIssuedJSWarningBit, 1> {}; |
| 2045 class RangeFeedbackBits : public BitField<uint32_t, | 2045 class RangeFeedbackBits : public BitField<uint32_t, |
| 2046 ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {}; // NOLINT | 2046 ICData::kRangeFeedbackPos, ICData::kRangeFeedbackSize> {}; // NOLINT |
| 2047 | 2047 |
| 2048 #if defined(DEBUG) | 2048 #if defined(DEBUG) |
| 2049 // Used in asserts to verify that a check is not added twice. | 2049 // Used in asserts to verify that a check is not added twice. |
| 2050 bool HasCheck(const GrowableArray<intptr_t>& cids) const; | 2050 bool HasCheck(const GrowableArray<intptr_t>& cids) const; |
| 2051 #endif // DEBUG | 2051 #endif // DEBUG |
| 2052 | 2052 |
| 2053 intptr_t TestEntryLength() const; | 2053 intptr_t TestEntryLength() const; |
| 2054 void WriteSentinel(const Array& data) const; | 2054 static void WriteSentinel(const Array& data, intptr_t test_entry_length); |
| 2055 | 2055 |
| 2056 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); | 2056 FINAL_HEAP_OBJECT_IMPLEMENTATION(ICData, Object); |
| 2057 friend class Class; | 2057 friend class Class; |
| 2058 }; | 2058 }; |
| 2059 | 2059 |
| 2060 | 2060 |
| 2061 class Function : public Object { | 2061 class Function : public Object { |
| 2062 public: | 2062 public: |
| 2063 RawString* name() const { return raw_ptr()->name_; } | 2063 RawString* name() const { return raw_ptr()->name_; } |
| 2064 RawString* PrettyName() const; | 2064 RawString* PrettyName() const; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; } | 2130 RawArray* parameter_types() const { return raw_ptr()->parameter_types_; } |
| 2131 void set_parameter_types(const Array& value) const; | 2131 void set_parameter_types(const Array& value) const; |
| 2132 | 2132 |
| 2133 // Parameter names are valid for all valid parameter indices, and are not | 2133 // Parameter names are valid for all valid parameter indices, and are not |
| 2134 // limited to named optional parameters. | 2134 // limited to named optional parameters. |
| 2135 RawString* ParameterNameAt(intptr_t index) const; | 2135 RawString* ParameterNameAt(intptr_t index) const; |
| 2136 void SetParameterNameAt(intptr_t index, const String& value) const; | 2136 void SetParameterNameAt(intptr_t index, const String& value) const; |
| 2137 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } | 2137 RawArray* parameter_names() const { return raw_ptr()->parameter_names_; } |
| 2138 void set_parameter_names(const Array& value) const; | 2138 void set_parameter_names(const Array& value) const; |
| 2139 | 2139 |
| 2140 // Not thread-safe; must be called in the main thread. |
| 2140 // Sets function's code and code's function. | 2141 // Sets function's code and code's function. |
| 2142 void InstallOptimizedCode(const Code& code, bool is_osr) const; |
| 2141 void AttachCode(const Code& value) const; | 2143 void AttachCode(const Code& value) const; |
| 2142 void SetInstructions(const Code& value) const; | 2144 void SetInstructions(const Code& value) const; |
| 2143 void ClearCode() const; | 2145 void ClearCode() const; |
| 2144 | 2146 |
| 2145 // Disables optimized code and switches to unoptimized code. | 2147 // Disables optimized code and switches to unoptimized code. |
| 2146 void SwitchToUnoptimizedCode() const; | 2148 void SwitchToUnoptimizedCode() const; |
| 2147 | 2149 |
| 2148 // Return the most recently compiled and installed code for this function. | 2150 // Return the most recently compiled and installed code for this function. |
| 2149 // It is not the only Code object that points to this function. | 2151 // It is not the only Code object that points to this function. |
| 2150 RawCode* CurrentCode() const { | 2152 RawCode* CurrentCode() const { |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 set_kind_tag(name##Bit::update(value, raw_ptr()->kind_tag_)); \ | 2659 set_kind_tag(name##Bit::update(value, raw_ptr()->kind_tag_)); \ |
| 2658 } \ | 2660 } \ |
| 2659 bool accessor_name() const { \ | 2661 bool accessor_name() const { \ |
| 2660 return name##Bit::decode(raw_ptr()->kind_tag_); \ | 2662 return name##Bit::decode(raw_ptr()->kind_tag_); \ |
| 2661 } | 2663 } |
| 2662 FOR_EACH_FUNCTION_KIND_BIT(DEFINE_ACCESSORS) | 2664 FOR_EACH_FUNCTION_KIND_BIT(DEFINE_ACCESSORS) |
| 2663 #undef DEFINE_ACCESSORS | 2665 #undef DEFINE_ACCESSORS |
| 2664 | 2666 |
| 2665 private: | 2667 private: |
| 2666 void set_ic_data_array(const Array& value) const; | 2668 void set_ic_data_array(const Array& value) const; |
| 2669 void SetInstructionsSafe(const Code& value) const; |
| 2667 | 2670 |
| 2668 enum KindTagBits { | 2671 enum KindTagBits { |
| 2669 kKindTagPos = 0, | 2672 kKindTagPos = 0, |
| 2670 kKindTagSize = 4, | 2673 kKindTagSize = 4, |
| 2671 kRecognizedTagPos = kKindTagPos + kKindTagSize, | 2674 kRecognizedTagPos = kKindTagPos + kKindTagSize, |
| 2672 kRecognizedTagSize = 9, | 2675 kRecognizedTagSize = 9, |
| 2673 kModifierPos = kRecognizedTagPos + kRecognizedTagSize, | 2676 kModifierPos = kRecognizedTagPos + kRecognizedTagSize, |
| 2674 kModifierSize = 2, | 2677 kModifierSize = 2, |
| 2675 kLastModifierBitPos = kModifierPos + (kModifierSize - 1), | 2678 kLastModifierBitPos = kModifierPos + (kModifierSize - 1), |
| 2676 // Single bit sized fields start here. | 2679 // Single bit sized fields start here. |
| (...skipping 5496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8173 | 8176 |
| 8174 | 8177 |
| 8175 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 8178 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 8176 intptr_t index) { | 8179 intptr_t index) { |
| 8177 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 8180 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 8178 } | 8181 } |
| 8179 | 8182 |
| 8180 } // namespace dart | 8183 } // namespace dart |
| 8181 | 8184 |
| 8182 #endif // VM_OBJECT_H_ | 8185 #endif // VM_OBJECT_H_ |
| OLD | NEW |