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

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

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

Powered by Google App Engine
This is Rietveld 408576698