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

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

Issue 362153002: Transform functions marked as async (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: first round of comments Created 6 years, 5 months 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
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/parser.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <limits> 8 #include <limits>
9 #include "include/dart_api.h" 9 #include "include/dart_api.h"
10 #include "platform/assert.h" 10 #include "platform/assert.h"
(...skipping 1648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 void SetRedirectionType(const Type& type) const; 1659 void SetRedirectionType(const Type& type) const;
1660 RawString* RedirectionIdentifier() const; 1660 RawString* RedirectionIdentifier() const;
1661 void SetRedirectionIdentifier(const String& identifier) const; 1661 void SetRedirectionIdentifier(const String& identifier) const;
1662 RawFunction* RedirectionTarget() const; 1662 RawFunction* RedirectionTarget() const;
1663 void SetRedirectionTarget(const Function& target) const; 1663 void SetRedirectionTarget(const Function& target) const;
1664 1664
1665 RawFunction::Kind kind() const { 1665 RawFunction::Kind kind() const {
1666 return KindBits::decode(raw_ptr()->kind_tag_); 1666 return KindBits::decode(raw_ptr()->kind_tag_);
1667 } 1667 }
1668 1668
1669 RawFunction::Modifier modifier() const {
1670 return ModifierBits::decode(raw_ptr()->kind_tag_);
1671 }
1672
1669 static const char* KindToCString(RawFunction::Kind kind); 1673 static const char* KindToCString(RawFunction::Kind kind);
1670 1674
1671 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); } 1675 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_tag_); }
1672 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); } 1676 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_tag_); }
1673 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); } 1677 bool is_external() const { return ExternalBit::decode(raw_ptr()->kind_tag_); }
1674 bool IsConstructor() const { 1678 bool IsConstructor() const {
1675 return (kind() == RawFunction::kConstructor) && !is_static(); 1679 return (kind() == RawFunction::kConstructor) && !is_static();
1676 } 1680 }
1677 bool IsImplicitConstructor() const; 1681 bool IsImplicitConstructor() const;
1678 bool IsFactory() const { 1682 bool IsFactory() const {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1805 value = kMaxInstructionCount; 1809 value = kMaxInstructionCount;
1806 } 1810 }
1807 raw_ptr()->optimized_call_site_count_ = static_cast<uint16_t>(value); 1811 raw_ptr()->optimized_call_site_count_ = static_cast<uint16_t>(value);
1808 } 1812 }
1809 1813
1810 bool IsOptimizable() const; 1814 bool IsOptimizable() const;
1811 bool IsNativeAutoSetupScope() const; 1815 bool IsNativeAutoSetupScope() const;
1812 void SetIsOptimizable(bool value) const; 1816 void SetIsOptimizable(bool value) const;
1813 void SetIsNativeAutoSetupScope(bool value) const; 1817 void SetIsNativeAutoSetupScope(bool value) const;
1814 1818
1819 bool is_synthetic_container() const {
1820 return SyntheticContainerBit::decode(raw_ptr()->kind_tag_);
1821 }
1822 void set_is_synthetic_container(bool value) const {
1823 set_kind_tag(SyntheticContainerBit::update(value, raw_ptr()->kind_tag_));
1824 }
1825
1815 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); } 1826 bool is_native() const { return NativeBit::decode(raw_ptr()->kind_tag_); }
1816 void set_is_native(bool value) const; 1827 void set_is_native(bool value) const;
1817 1828
1818 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); } 1829 bool is_abstract() const { return AbstractBit::decode(raw_ptr()->kind_tag_); }
1819 void set_is_abstract(bool value) const; 1830 void set_is_abstract(bool value) const;
1820 1831
1821 bool IsInlineable() const; 1832 bool IsInlineable() const;
1822 void set_is_inlinable(bool value) const; 1833 void set_is_inlinable(bool value) const;
1823 1834
1824 bool is_visible() const { 1835 bool is_visible() const {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 // Returns true if this function represents a local function. 1966 // Returns true if this function represents a local function.
1956 bool IsLocalFunction() const { 1967 bool IsLocalFunction() const {
1957 return parent_function() != Function::null(); 1968 return parent_function() != Function::null();
1958 } 1969 }
1959 1970
1960 // Returns true if this function represents a signature function without code. 1971 // Returns true if this function represents a signature function without code.
1961 bool IsSignatureFunction() const { 1972 bool IsSignatureFunction() const {
1962 return kind() == RawFunction::kSignatureFunction; 1973 return kind() == RawFunction::kSignatureFunction;
1963 } 1974 }
1964 1975
1976
1977 bool IsAsyncFunction() const {
1978 return modifier() == RawFunction::kAsync;
1979 }
1980
1965 static intptr_t InstanceSize() { 1981 static intptr_t InstanceSize() {
1966 return RoundedAllocationSize(sizeof(RawFunction)); 1982 return RoundedAllocationSize(sizeof(RawFunction));
1967 } 1983 }
1968 1984
1969 static RawFunction* New(const String& name, 1985 static RawFunction* New(const String& name,
1970 RawFunction::Kind kind, 1986 RawFunction::Kind kind,
1971 bool is_static, 1987 bool is_static,
1972 bool is_const, 1988 bool is_const,
1973 bool is_abstract, 1989 bool is_abstract,
1974 bool is_external, 1990 bool is_external,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 void RestoreICDataMap( 2025 void RestoreICDataMap(
2010 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const; 2026 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const;
2011 2027
2012 RawArray* ic_data_array() const; 2028 RawArray* ic_data_array() const;
2013 void ClearICData() const; 2029 void ClearICData() const;
2014 2030
2015 static const int kCtorPhaseInit = 1 << 0; 2031 static const int kCtorPhaseInit = 1 << 0;
2016 static const int kCtorPhaseBody = 1 << 1; 2032 static const int kCtorPhaseBody = 1 << 1;
2017 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); 2033 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody);
2018 2034
2035 void set_modifier(RawFunction::Modifier value) const;
2036
2019 private: 2037 private:
2020 void set_ic_data_array(const Array& value) const; 2038 void set_ic_data_array(const Array& value) const;
2021 2039
2022 enum KindTagBits { 2040 enum KindTagBits {
2023 kKindTagPos = 0, 2041 kKindTagPos = 0,
2024 kKindTagSize = 4, 2042 kKindTagSize = 4,
2025 kStaticBit = kKindTagPos + kKindTagSize, // = 4 2043 kStaticBit = kKindTagPos + kKindTagSize, // = 4
2026 kConstBit = 5, 2044 kConstBit = 5,
2027 kAbstractBit = 6, 2045 kAbstractBit = 6,
2028 kVisibleBit = 7, 2046 kVisibleBit = 7,
2029 kOptimizableBit = 8, 2047 kOptimizableBit = 8,
2030 kInlinableBit = 9, 2048 kInlinableBit = 9,
2031 kIntrinsicBit = 10, 2049 kIntrinsicBit = 10,
2032 kRecognizedBit = 11, 2050 kRecognizedBit = 11,
2033 kNativeBit = 12, 2051 kNativeBit = 12,
2034 kRedirectingBit = 13, 2052 kRedirectingBit = 13,
2035 kExternalBit = 14, 2053 kExternalBit = 14,
2036 kAllowsHoistingCheckClassBit = 15, 2054 kAllowsHoistingCheckClassBit = 15,
2055 kModifierPos = 16,
2056 kSyntheticContainerBit = 18,
2037 }; 2057 };
2038 class KindBits : 2058 class KindBits :
2039 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT 2059 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT
2040 class StaticBit : public BitField<bool, kStaticBit, 1> {}; 2060 class StaticBit : public BitField<bool, kStaticBit, 1> {};
2041 class ConstBit : public BitField<bool, kConstBit, 1> {}; 2061 class ConstBit : public BitField<bool, kConstBit, 1> {};
2042 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; 2062 class AbstractBit : public BitField<bool, kAbstractBit, 1> {};
2043 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; 2063 class VisibleBit : public BitField<bool, kVisibleBit, 1> {};
2044 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; 2064 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {};
2045 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; 2065 class InlinableBit : public BitField<bool, kInlinableBit, 1> {};
2046 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; 2066 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {};
2047 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; 2067 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {};
2048 class NativeBit : public BitField<bool, kNativeBit, 1> {}; 2068 class NativeBit : public BitField<bool, kNativeBit, 1> {};
2049 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; 2069 class ExternalBit : public BitField<bool, kExternalBit, 1> {};
2050 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {}; 2070 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {};
2051 class AllowsHoistingCheckClassBit : 2071 class AllowsHoistingCheckClassBit :
2052 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT 2072 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT
2073 class ModifierBits :
2074 public BitField<RawFunction::Modifier, kModifierPos, 2> {};
2075 class SyntheticContainerBit :
2076 public BitField<bool, kSyntheticContainerBit, 1> {};
2053 2077
2054 void set_name(const String& value) const; 2078 void set_name(const String& value) const;
2055 void set_kind(RawFunction::Kind value) const; 2079 void set_kind(RawFunction::Kind value) const;
2056 void set_is_static(bool value) const; 2080 void set_is_static(bool value) const;
2057 void set_is_const(bool value) const; 2081 void set_is_const(bool value) const;
2058 void set_is_external(bool value) const; 2082 void set_is_external(bool value) const;
2059 void set_parent_function(const Function& value) const; 2083 void set_parent_function(const Function& value) const;
2060 void set_owner(const Object& value) const; 2084 void set_owner(const Object& value) const;
2061 RawFunction* implicit_closure_function() const; 2085 RawFunction* implicit_closure_function() const;
2062 void set_implicit_closure_function(const Function& value) const; 2086 void set_implicit_closure_function(const Function& value) const;
(...skipping 5114 matching lines...) Expand 10 before | Expand all | Expand 10 after
7177 7201
7178 7202
7179 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7203 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7180 intptr_t index) { 7204 intptr_t index) {
7181 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7205 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7182 } 7206 }
7183 7207
7184 } // namespace dart 7208 } // namespace dart
7185 7209
7186 #endif // VM_OBJECT_H_ 7210 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698