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 1609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 // Signature class of this closure function or signature function. | 1620 // Signature class of this closure function or signature function. |
1621 RawClass* signature_class() const; | 1621 RawClass* signature_class() const; |
1622 void set_signature_class(const Class& value) const; | 1622 void set_signature_class(const Class& value) const; |
1623 | 1623 |
1624 void set_extracted_method_closure(const Function& function) const; | 1624 void set_extracted_method_closure(const Function& function) const; |
1625 RawFunction* extracted_method_closure() const; | 1625 RawFunction* extracted_method_closure() const; |
1626 | 1626 |
1627 void set_saved_args_desc(const Array& array) const; | 1627 void set_saved_args_desc(const Array& array) const; |
1628 RawArray* saved_args_desc() const; | 1628 RawArray* saved_args_desc() const; |
1629 | 1629 |
1630 void set_saved_static_field(const Field& array) const; | |
1631 RawField* saved_static_field() const; | |
1632 | |
1633 bool IsMethodExtractor() const { | 1630 bool IsMethodExtractor() const { |
1634 return kind() == RawFunction::kMethodExtractor; | 1631 return kind() == RawFunction::kMethodExtractor; |
1635 } | 1632 } |
1636 | 1633 |
1637 bool IsNoSuchMethodDispatcher() const { | 1634 bool IsNoSuchMethodDispatcher() const { |
1638 return kind() == RawFunction::kNoSuchMethodDispatcher; | 1635 return kind() == RawFunction::kNoSuchMethodDispatcher; |
1639 } | 1636 } |
1640 | 1637 |
1641 bool IsInvokeFieldDispatcher() const { | 1638 bool IsInvokeFieldDispatcher() const { |
1642 return kind() == RawFunction::kInvokeFieldDispatcher; | 1639 return kind() == RawFunction::kInvokeFieldDispatcher; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1695 case RawFunction::kSetterFunction: | 1692 case RawFunction::kSetterFunction: |
1696 case RawFunction::kImplicitGetter: | 1693 case RawFunction::kImplicitGetter: |
1697 case RawFunction::kImplicitSetter: | 1694 case RawFunction::kImplicitSetter: |
1698 case RawFunction::kMethodExtractor: | 1695 case RawFunction::kMethodExtractor: |
1699 case RawFunction::kNoSuchMethodDispatcher: | 1696 case RawFunction::kNoSuchMethodDispatcher: |
1700 case RawFunction::kInvokeFieldDispatcher: | 1697 case RawFunction::kInvokeFieldDispatcher: |
1701 return true; | 1698 return true; |
1702 case RawFunction::kClosureFunction: | 1699 case RawFunction::kClosureFunction: |
1703 case RawFunction::kConstructor: | 1700 case RawFunction::kConstructor: |
1704 case RawFunction::kImplicitStaticFinalGetter: | 1701 case RawFunction::kImplicitStaticFinalGetter: |
1705 case RawFunction::kStaticInitializer: | |
1706 return false; | 1702 return false; |
1707 default: | 1703 default: |
1708 UNREACHABLE(); | 1704 UNREACHABLE(); |
1709 return false; | 1705 return false; |
1710 } | 1706 } |
1711 } | 1707 } |
1712 bool IsStaticFunction() const { | 1708 bool IsStaticFunction() const { |
1713 if (!is_static()) { | 1709 if (!is_static()) { |
1714 return false; | 1710 return false; |
1715 } | 1711 } |
1716 switch (kind()) { | 1712 switch (kind()) { |
1717 case RawFunction::kRegularFunction: | 1713 case RawFunction::kRegularFunction: |
1718 case RawFunction::kGetterFunction: | 1714 case RawFunction::kGetterFunction: |
1719 case RawFunction::kSetterFunction: | 1715 case RawFunction::kSetterFunction: |
1720 case RawFunction::kImplicitGetter: | 1716 case RawFunction::kImplicitGetter: |
1721 case RawFunction::kImplicitSetter: | 1717 case RawFunction::kImplicitSetter: |
1722 case RawFunction::kImplicitStaticFinalGetter: | 1718 case RawFunction::kImplicitStaticFinalGetter: |
1723 case RawFunction::kStaticInitializer: | |
1724 return true; | 1719 return true; |
1725 case RawFunction::kClosureFunction: | 1720 case RawFunction::kClosureFunction: |
1726 case RawFunction::kConstructor: | 1721 case RawFunction::kConstructor: |
1727 return false; | 1722 return false; |
1728 default: | 1723 default: |
1729 UNREACHABLE(); | 1724 UNREACHABLE(); |
1730 return false; | 1725 return false; |
1731 } | 1726 } |
1732 } | 1727 } |
1733 bool IsInFactoryScope() const; | 1728 bool IsInFactoryScope() const; |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1926 // Returns true if this function represents an explicit setter function. | 1921 // Returns true if this function represents an explicit setter function. |
1927 bool IsSetterFunction() const { | 1922 bool IsSetterFunction() const { |
1928 return kind() == RawFunction::kSetterFunction; | 1923 return kind() == RawFunction::kSetterFunction; |
1929 } | 1924 } |
1930 | 1925 |
1931 // Returns true if this function represents an implicit setter function. | 1926 // Returns true if this function represents an implicit setter function. |
1932 bool IsImplicitSetterFunction() const { | 1927 bool IsImplicitSetterFunction() const { |
1933 return kind() == RawFunction::kImplicitSetter; | 1928 return kind() == RawFunction::kImplicitSetter; |
1934 } | 1929 } |
1935 | 1930 |
1936 // Returns true if this function represents an static initializer function. | |
1937 bool IsStaticInitializerFunction() const { | |
1938 return kind() == RawFunction::kStaticInitializer; | |
1939 } | |
1940 | |
1941 // Returns true if this function represents a (possibly implicit) closure | 1931 // Returns true if this function represents a (possibly implicit) closure |
1942 // function. | 1932 // function. |
1943 bool IsClosureFunction() const { | 1933 bool IsClosureFunction() const { |
1944 return kind() == RawFunction::kClosureFunction; | 1934 return kind() == RawFunction::kClosureFunction; |
1945 } | 1935 } |
1946 | 1936 |
1947 // Returns true if this function represents an implicit closure function. | 1937 // Returns true if this function represents an implicit closure function. |
1948 bool IsImplicitClosureFunction() const; | 1938 bool IsImplicitClosureFunction() const; |
1949 | 1939 |
1950 // Returns true if this function represents a non implicit closure function. | 1940 // Returns true if this function represents a non implicit closure function. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1997 // function. | 1987 // function. |
1998 // The function and the class share the same given name. | 1988 // The function and the class share the same given name. |
1999 static RawFunction* NewClosureFunction(const String& name, | 1989 static RawFunction* NewClosureFunction(const String& name, |
2000 const Function& parent, | 1990 const Function& parent, |
2001 intptr_t token_pos); | 1991 intptr_t token_pos); |
2002 | 1992 |
2003 static RawFunction* NewEvalFunction(const Class& owner, | 1993 static RawFunction* NewEvalFunction(const Class& owner, |
2004 const Script& script, | 1994 const Script& script, |
2005 bool is_static); | 1995 bool is_static); |
2006 | 1996 |
2007 // Creates a new static initializer function which is invoked in the implicit | |
2008 // static getter function. | |
2009 static RawFunction* NewStaticInitializer(const Field& field); | |
2010 | |
2011 // Allocate new function object, clone values from this function. The | 1997 // Allocate new function object, clone values from this function. The |
2012 // owner of the clone is new_owner. | 1998 // owner of the clone is new_owner. |
2013 RawFunction* Clone(const Class& new_owner) const; | 1999 RawFunction* Clone(const Class& new_owner) const; |
2014 | 2000 |
2015 // Slow function, use in asserts to track changes in important library | 2001 // Slow function, use in asserts to track changes in important library |
2016 // functions. | 2002 // functions. |
2017 int32_t SourceFingerprint() const; | 2003 int32_t SourceFingerprint() const; |
2018 | 2004 |
2019 // Return false and report an error if the fingerprint does not match. | 2005 // Return false and report an error if the fingerprint does not match. |
2020 bool CheckSourceFingerprint(int32_t fp) const; | 2006 bool CheckSourceFingerprint(int32_t fp) const; |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 void set_dependent_code(const Array& array) const; | 2321 void set_dependent_code(const Array& array) const; |
2336 | 2322 |
2337 // Add the given code object to the list of dependent ones. | 2323 // Add the given code object to the list of dependent ones. |
2338 void RegisterDependentCode(const Code& code) const; | 2324 void RegisterDependentCode(const Code& code) const; |
2339 | 2325 |
2340 // Deoptimize all dependent code objects. | 2326 // Deoptimize all dependent code objects. |
2341 void DeoptimizeDependentCode() const; | 2327 void DeoptimizeDependentCode() const; |
2342 | 2328 |
2343 bool IsUninitialized() const; | 2329 bool IsUninitialized() const; |
2344 | 2330 |
| 2331 void EvaluateInitializer() const; |
| 2332 |
2345 // Constructs getter and setter names for fields and vice versa. | 2333 // Constructs getter and setter names for fields and vice versa. |
2346 static RawString* GetterName(const String& field_name); | 2334 static RawString* GetterName(const String& field_name); |
2347 static RawString* GetterSymbol(const String& field_name); | 2335 static RawString* GetterSymbol(const String& field_name); |
2348 static RawString* SetterName(const String& field_name); | 2336 static RawString* SetterName(const String& field_name); |
2349 static RawString* SetterSymbol(const String& field_name); | 2337 static RawString* SetterSymbol(const String& field_name); |
2350 static RawString* NameFromGetter(const String& getter_name); | 2338 static RawString* NameFromGetter(const String& getter_name); |
2351 static RawString* NameFromSetter(const String& setter_name); | 2339 static RawString* NameFromSetter(const String& setter_name); |
2352 static bool IsGetterName(const String& function_name); | 2340 static bool IsGetterName(const String& function_name); |
2353 static bool IsSetterName(const String& function_name); | 2341 static bool IsSetterName(const String& function_name); |
2354 | 2342 |
(...skipping 4964 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7319 | 7307 |
7320 | 7308 |
7321 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7309 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7322 intptr_t index) { | 7310 intptr_t index) { |
7323 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7311 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7324 } | 7312 } |
7325 | 7313 |
7326 } // namespace dart | 7314 } // namespace dart |
7327 | 7315 |
7328 #endif // VM_OBJECT_H_ | 7316 #endif // VM_OBJECT_H_ |
OLD | NEW |