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 1647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 void SetRedirectionType(const Type& type) const; | 1658 void SetRedirectionType(const Type& type) const; |
1659 RawString* RedirectionIdentifier() const; | 1659 RawString* RedirectionIdentifier() const; |
1660 void SetRedirectionIdentifier(const String& identifier) const; | 1660 void SetRedirectionIdentifier(const String& identifier) const; |
1661 RawFunction* RedirectionTarget() const; | 1661 RawFunction* RedirectionTarget() const; |
1662 void SetRedirectionTarget(const Function& target) const; | 1662 void SetRedirectionTarget(const Function& target) const; |
1663 | 1663 |
1664 RawFunction::Kind kind() const { | 1664 RawFunction::Kind kind() const { |
1665 return KindBits::decode(raw_ptr()->kind_tag_); | 1665 return KindBits::decode(raw_ptr()->kind_tag_); |
1666 } | 1666 } |
1667 | 1667 |
1668 RawFunction::AsyncModifier modifier() const { | |
1669 return ModifierBits::decode(raw_ptr()->kind_tag_); | |
1670 } | |
1671 | |
1672 static const char* KindToCString(RawFunction::Kind kind); | 1668 static const char* KindToCString(RawFunction::Kind kind); |
1673 | 1669 |
1674 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } | 1670 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } |
1675 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } | 1671 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } |
1676 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } | 1672 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } |
1677 bool IsConstructor() const { | 1673 bool IsConstructor() const { |
1678 return (kind() == RawFunction::kConstructor) && !is_static(); | 1674 return (kind() == RawFunction::kConstructor) && !is_static(); |
1679 } | 1675 } |
1680 bool IsImplicitConstructor() const; | 1676 bool IsImplicitConstructor() const; |
1681 bool IsFactory() const { | 1677 bool IsFactory() const { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1808 value = kMaxInstructionCount; | 1804 value = kMaxInstructionCount; |
1809 } | 1805 } |
1810 raw_ptr()->optimized_call_site_count_ = static_cast<uint16_t>(value); | 1806 raw_ptr()->optimized_call_site_count_ = static_cast<uint16_t>(value); |
1811 } | 1807 } |
1812 | 1808 |
1813 bool IsOptimizable() const; | 1809 bool IsOptimizable() const; |
1814 bool IsNativeAutoSetupScope() const; | 1810 bool IsNativeAutoSetupScope() const; |
1815 void SetIsOptimizable(bool value) const; | 1811 void SetIsOptimizable(bool value) const; |
1816 void SetIsNativeAutoSetupScope(bool value) const; | 1812 void SetIsNativeAutoSetupScope(bool value) const; |
1817 | 1813 |
1818 bool is_async_closure() const { | |
1819 return AsyncClosureBit::decode(raw_ptr()->kind_tag_); | |
1820 } | |
1821 void set_is_async_closure(bool value) const; | |
1822 | |
1823 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } | 1814 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } |
1824 void set_is_native(bool value) const; | 1815 void set_is_native(bool value) const; |
1825 | 1816 |
1826 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } | 1817 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } |
1827 void set_is_abstract(bool value) const; | 1818 void set_is_abstract(bool value) const; |
1828 | 1819 |
1829 bool IsInlineable() const; | 1820 bool IsInlineable() const; |
1830 void set_is_inlinable(bool value) const; | 1821 void set_is_inlinable(bool value) const; |
1831 | 1822 |
1832 bool is_visible() const { | 1823 bool is_visible() const { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1963 // Returns true if this function represents a local function. | 1954 // Returns true if this function represents a local function. |
1964 bool IsLocalFunction() const { | 1955 bool IsLocalFunction() const { |
1965 return parent_function() != Function::null(); | 1956 return parent_function() != Function::null(); |
1966 } | 1957 } |
1967 | 1958 |
1968 // Returns true if this function represents a signature function without code. | 1959 // Returns true if this function represents a signature function without code. |
1969 bool IsSignatureFunction() const { | 1960 bool IsSignatureFunction() const { |
1970 return kind() == RawFunction::kSignatureFunction; | 1961 return kind() == RawFunction::kSignatureFunction; |
1971 } | 1962 } |
1972 | 1963 |
1973 bool IsAsyncFunction() const { | |
1974 return modifier() == RawFunction::kAsync; | |
1975 } | |
1976 | |
1977 static intptr_t InstanceSize() { | 1964 static intptr_t InstanceSize() { |
1978 return RoundedAllocationSize(sizeof(RawFunction)); | 1965 return RoundedAllocationSize(sizeof(RawFunction)); |
1979 } | 1966 } |
1980 | 1967 |
1981 static RawFunction* New(const String& name, | 1968 static RawFunction* New(const String& name, |
1982 RawFunction::Kind kind, | 1969 RawFunction::Kind kind, |
1983 bool is_static, | 1970 bool is_static, |
1984 bool is_const, | 1971 bool is_const, |
1985 bool is_abstract, | 1972 bool is_abstract, |
1986 bool is_external, | 1973 bool is_external, |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2021 void RestoreICDataMap( | 2008 void RestoreICDataMap( |
2022 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const; | 2009 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const; |
2023 | 2010 |
2024 RawArray* ic_data_array() const; | 2011 RawArray* ic_data_array() const; |
2025 void ClearICData() const; | 2012 void ClearICData() const; |
2026 | 2013 |
2027 static const int kCtorPhaseInit = 1 << 0; | 2014 static const int kCtorPhaseInit = 1 << 0; |
2028 static const int kCtorPhaseBody = 1 << 1; | 2015 static const int kCtorPhaseBody = 1 << 1; |
2029 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); | 2016 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); |
2030 | 2017 |
2031 void set_modifier(RawFunction::AsyncModifier value) const; | |
2032 | |
2033 private: | 2018 private: |
2034 void set_ic_data_array(const Array& value) const; | 2019 void set_ic_data_array(const Array& value) const; |
2035 | 2020 |
2036 enum KindTagBits { | 2021 enum KindTagBits { |
2037 kKindTagPos = 0, | 2022 kKindTagPos = 0, |
2038 kKindTagSize = 4, | 2023 kKindTagSize = 4, |
2039 kStaticBit = kKindTagPos + kKindTagSize, // = 4 | 2024 kStaticBit = kKindTagPos + kKindTagSize, // = 4 |
2040 kConstBit = 5, | 2025 kConstBit = 5, |
2041 kAbstractBit = 6, | 2026 kAbstractBit = 6, |
2042 kVisibleBit = 7, | 2027 kVisibleBit = 7, |
2043 kOptimizableBit = 8, | 2028 kOptimizableBit = 8, |
2044 kInlinableBit = 9, | 2029 kInlinableBit = 9, |
2045 kIntrinsicBit = 10, | 2030 kIntrinsicBit = 10, |
2046 kRecognizedBit = 11, | 2031 kRecognizedBit = 11, |
2047 kNativeBit = 12, | 2032 kNativeBit = 12, |
2048 kRedirectingBit = 13, | 2033 kRedirectingBit = 13, |
2049 kExternalBit = 14, | 2034 kExternalBit = 14, |
2050 kAllowsHoistingCheckClassBit = 15, | 2035 kAllowsHoistingCheckClassBit = 15, |
2051 kModifierPos = 16, | |
2052 kAsyncClosureBit = 18, | |
2053 }; | 2036 }; |
2054 class KindBits : | 2037 class KindBits : |
2055 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT | 2038 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT |
2056 class StaticBit : public BitField<bool, kStaticBit, 1> {}; | 2039 class StaticBit : public BitField<bool, kStaticBit, 1> {}; |
2057 class ConstBit : public BitField<bool, kConstBit, 1> {}; | 2040 class ConstBit : public BitField<bool, kConstBit, 1> {}; |
2058 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; | 2041 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; |
2059 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; | 2042 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; |
2060 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; | 2043 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; |
2061 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; | 2044 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; |
2062 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; | 2045 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; |
2063 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; | 2046 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; |
2064 class NativeBit : public BitField<bool, kNativeBit, 1> {}; | 2047 class NativeBit : public BitField<bool, kNativeBit, 1> {}; |
2065 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; | 2048 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; |
2066 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {}; | 2049 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {}; |
2067 class AllowsHoistingCheckClassBit : | 2050 class AllowsHoistingCheckClassBit : |
2068 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT | 2051 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT |
2069 class ModifierBits : | |
2070 public BitField<RawFunction::AsyncModifier, kModifierPos, 2> {}; // NOLIN
T | |
2071 class AsyncClosureBit : public BitField<bool, kAsyncClosureBit, 1> {}; | |
2072 | 2052 |
2073 void set_name(const String& value) const; | 2053 void set_name(const String& value) const; |
2074 void set_kind(RawFunction::Kind value) const; | 2054 void set_kind(RawFunction::Kind value) const; |
2075 void set_is_static(bool value) const; | 2055 void set_is_static(bool value) const; |
2076 void set_is_const(bool value) const; | 2056 void set_is_const(bool value) const; |
2077 void set_is_external(bool value) const; | 2057 void set_is_external(bool value) const; |
2078 void set_parent_function(const Function& value) const; | 2058 void set_parent_function(const Function& value) const; |
2079 void set_owner(const Object& value) const; | 2059 void set_owner(const Object& value) const; |
2080 RawFunction* implicit_closure_function() const; | 2060 RawFunction* implicit_closure_function() const; |
2081 void set_implicit_closure_function(const Function& value) const; | 2061 void set_implicit_closure_function(const Function& value) const; |
(...skipping 5221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7303 | 7283 |
7304 | 7284 |
7305 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7285 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7306 intptr_t index) { | 7286 intptr_t index) { |
7307 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7287 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7308 } | 7288 } |
7309 | 7289 |
7310 } // namespace dart | 7290 } // namespace dart |
7311 | 7291 |
7312 #endif // VM_OBJECT_H_ | 7292 #endif // VM_OBJECT_H_ |
OLD | NEW |