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

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

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

Powered by Google App Engine
This is Rietveld 408576698