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

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: getters and setters 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 30 matching lines...) Expand all
2005 void RestoreICDataMap( 2021 void RestoreICDataMap(
2006 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const; 2022 ZoneGrowableArray<const ICData*>* deopt_id_to_ic_data) const;
2007 2023
2008 RawArray* ic_data_array() const; 2024 RawArray* ic_data_array() const;
2009 void ClearICData() const; 2025 void ClearICData() const;
2010 2026
2011 static const int kCtorPhaseInit = 1 << 0; 2027 static const int kCtorPhaseInit = 1 << 0;
2012 static const int kCtorPhaseBody = 1 << 1; 2028 static const int kCtorPhaseBody = 1 << 1;
2013 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody); 2029 static const int kCtorPhaseAll = (kCtorPhaseInit | kCtorPhaseBody);
2014 2030
2031 // TODO(mlippautz): This should be private in the end.
2032 void set_modifier(RawFunction::Modifier value) const;
2033
2015 private: 2034 private:
2016 void set_ic_data_array(const Array& value) const; 2035 void set_ic_data_array(const Array& value) const;
2017 2036
2018 enum KindTagBits { 2037 enum KindTagBits {
2019 kKindTagPos = 0, 2038 kKindTagPos = 0,
2020 kKindTagSize = 4, 2039 kKindTagSize = 4,
2021 kStaticBit = kKindTagPos + kKindTagSize, // = 4 2040 kStaticBit = kKindTagPos + kKindTagSize, // = 4
2022 kConstBit = 5, 2041 kConstBit = 5,
2023 kAbstractBit = 6, 2042 kAbstractBit = 6,
2024 kVisibleBit = 7, 2043 kVisibleBit = 7,
2025 kOptimizableBit = 8, 2044 kOptimizableBit = 8,
2026 kInlinableBit = 9, 2045 kInlinableBit = 9,
2027 kIntrinsicBit = 10, 2046 kIntrinsicBit = 10,
2028 kRecognizedBit = 11, 2047 kRecognizedBit = 11,
2029 kNativeBit = 12, 2048 kNativeBit = 12,
2030 kRedirectingBit = 13, 2049 kRedirectingBit = 13,
2031 kExternalBit = 14, 2050 kExternalBit = 14,
2032 kAllowsHoistingCheckClassBit = 15, 2051 kAllowsHoistingCheckClassBit = 15,
2052 kModifierPos = 16,
2053 kSyntheticContainerBit = 18,
2033 }; 2054 };
2034 class KindBits : 2055 class KindBits :
2035 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT 2056 public BitField<RawFunction::Kind, kKindTagPos, kKindTagSize> {}; // NOLINT
2036 class StaticBit : public BitField<bool, kStaticBit, 1> {}; 2057 class StaticBit : public BitField<bool, kStaticBit, 1> {};
2037 class ConstBit : public BitField<bool, kConstBit, 1> {}; 2058 class ConstBit : public BitField<bool, kConstBit, 1> {};
2038 class AbstractBit : public BitField<bool, kAbstractBit, 1> {}; 2059 class AbstractBit : public BitField<bool, kAbstractBit, 1> {};
2039 class VisibleBit : public BitField<bool, kVisibleBit, 1> {}; 2060 class VisibleBit : public BitField<bool, kVisibleBit, 1> {};
2040 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {}; 2061 class OptimizableBit : public BitField<bool, kOptimizableBit, 1> {};
2041 class InlinableBit : public BitField<bool, kInlinableBit, 1> {}; 2062 class InlinableBit : public BitField<bool, kInlinableBit, 1> {};
2042 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {}; 2063 class IntrinsicBit : public BitField<bool, kIntrinsicBit, 1> {};
2043 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {}; 2064 class RecognizedBit : public BitField<bool, kRecognizedBit, 1> {};
2044 class NativeBit : public BitField<bool, kNativeBit, 1> {}; 2065 class NativeBit : public BitField<bool, kNativeBit, 1> {};
2045 class ExternalBit : public BitField<bool, kExternalBit, 1> {}; 2066 class ExternalBit : public BitField<bool, kExternalBit, 1> {};
2046 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {}; 2067 class RedirectingBit : public BitField<bool, kRedirectingBit, 1> {};
2047 class AllowsHoistingCheckClassBit : 2068 class AllowsHoistingCheckClassBit :
2048 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT 2069 public BitField<bool, kAllowsHoistingCheckClassBit, 1> {}; // NOLINT
2070 class ModifierBits :
2071 public BitField<RawFunction::Modifier, kModifierPos, 2> {};
2072 class SyntheticContainerBit :
2073 public BitField<bool, kSyntheticContainerBit, 1> {};
2049 2074
2050 void set_name(const String& value) const; 2075 void set_name(const String& value) const;
2051 void set_kind(RawFunction::Kind value) const; 2076 void set_kind(RawFunction::Kind value) const;
2052 void set_is_static(bool value) const; 2077 void set_is_static(bool value) const;
2053 void set_is_const(bool value) const; 2078 void set_is_const(bool value) const;
2054 void set_is_external(bool value) const; 2079 void set_is_external(bool value) const;
2055 void set_parent_function(const Function& value) const; 2080 void set_parent_function(const Function& value) const;
2056 void set_owner(const Object& value) const; 2081 void set_owner(const Object& value) const;
2057 RawFunction* implicit_closure_function() const; 2082 RawFunction* implicit_closure_function() const;
2058 void set_implicit_closure_function(const Function& value) const; 2083 void set_implicit_closure_function(const Function& value) const;
(...skipping 5111 matching lines...) Expand 10 before | Expand all | Expand 10 after
7170 7195
7171 7196
7172 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7197 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7173 intptr_t index) { 7198 intptr_t index) {
7174 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7199 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7175 } 7200 }
7176 7201
7177 } // namespace dart 7202 } // namespace dart
7178 7203
7179 #endif // VM_OBJECT_H_ 7204 #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