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

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

Issue 379353003: Implement Evaluate without creating new classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 bool IsImplicitConstructor() const; 1677 bool IsImplicitConstructor() const;
1678 bool IsFactory() const { 1678 bool IsFactory() const {
1679 return (kind() == RawFunction::kConstructor) && is_static(); 1679 return (kind() == RawFunction::kConstructor) && is_static();
1680 } 1680 }
1681 bool IsDynamicFunction() const { 1681 bool IsDynamicFunction() const {
1682 if (is_static() || is_abstract()) { 1682 if (is_static() || is_abstract()) {
1683 return false; 1683 return false;
1684 } 1684 }
1685 switch (kind()) { 1685 switch (kind()) {
1686 case RawFunction::kRegularFunction: 1686 case RawFunction::kRegularFunction:
1687 case RawFunction::kEvalFunction:
1687 case RawFunction::kGetterFunction: 1688 case RawFunction::kGetterFunction:
1688 case RawFunction::kSetterFunction: 1689 case RawFunction::kSetterFunction:
1689 case RawFunction::kImplicitGetter: 1690 case RawFunction::kImplicitGetter:
1690 case RawFunction::kImplicitSetter: 1691 case RawFunction::kImplicitSetter:
1691 case RawFunction::kMethodExtractor: 1692 case RawFunction::kMethodExtractor:
1692 case RawFunction::kNoSuchMethodDispatcher: 1693 case RawFunction::kNoSuchMethodDispatcher:
1693 case RawFunction::kInvokeFieldDispatcher: 1694 case RawFunction::kInvokeFieldDispatcher:
1694 return true; 1695 return true;
1695 case RawFunction::kClosureFunction: 1696 case RawFunction::kClosureFunction:
1696 case RawFunction::kConstructor: 1697 case RawFunction::kConstructor:
1697 case RawFunction::kImplicitStaticFinalGetter: 1698 case RawFunction::kImplicitStaticFinalGetter:
1698 case RawFunction::kStaticInitializer: 1699 case RawFunction::kStaticInitializer:
1699 return false; 1700 return false;
1700 default: 1701 default:
1701 UNREACHABLE(); 1702 UNREACHABLE();
1702 return false; 1703 return false;
1703 } 1704 }
1704 } 1705 }
1705 bool IsStaticFunction() const { 1706 bool IsStaticFunction() const {
1706 if (!is_static()) { 1707 if (!is_static()) {
1707 return false; 1708 return false;
1708 } 1709 }
1709 switch (kind()) { 1710 switch (kind()) {
1710 case RawFunction::kRegularFunction: 1711 case RawFunction::kRegularFunction:
1712 case RawFunction::kEvalFunction:
1711 case RawFunction::kGetterFunction: 1713 case RawFunction::kGetterFunction:
1712 case RawFunction::kSetterFunction: 1714 case RawFunction::kSetterFunction:
1713 case RawFunction::kImplicitGetter: 1715 case RawFunction::kImplicitGetter:
1714 case RawFunction::kImplicitSetter: 1716 case RawFunction::kImplicitSetter:
1715 case RawFunction::kImplicitStaticFinalGetter: 1717 case RawFunction::kImplicitStaticFinalGetter:
1716 case RawFunction::kStaticInitializer: 1718 case RawFunction::kStaticInitializer:
1717 return true; 1719 return true;
1718 case RawFunction::kClosureFunction: 1720 case RawFunction::kClosureFunction:
1719 case RawFunction::kConstructor: 1721 case RawFunction::kConstructor:
1720 return false; 1722 return false;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1955 // Returns true if this function represents a local function. 1957 // Returns true if this function represents a local function.
1956 bool IsLocalFunction() const { 1958 bool IsLocalFunction() const {
1957 return parent_function() != Function::null(); 1959 return parent_function() != Function::null();
1958 } 1960 }
1959 1961
1960 // Returns true if this function represents a signature function without code. 1962 // Returns true if this function represents a signature function without code.
1961 bool IsSignatureFunction() const { 1963 bool IsSignatureFunction() const {
1962 return kind() == RawFunction::kSignatureFunction; 1964 return kind() == RawFunction::kSignatureFunction;
1963 } 1965 }
1964 1966
1967 bool IsEvalFunction() const {
1968 return kind() == RawFunction::kEvalFunction;
1969 }
1970
1965 static intptr_t InstanceSize() { 1971 static intptr_t InstanceSize() {
1966 return RoundedAllocationSize(sizeof(RawFunction)); 1972 return RoundedAllocationSize(sizeof(RawFunction));
1967 } 1973 }
1968 1974
1969 static RawFunction* New(const String& name, 1975 static RawFunction* New(const String& name,
1970 RawFunction::Kind kind, 1976 RawFunction::Kind kind,
1971 bool is_static, 1977 bool is_static,
1972 bool is_const, 1978 bool is_const,
1973 bool is_abstract, 1979 bool is_abstract,
1974 bool is_external, 1980 bool is_external,
1975 bool is_native, 1981 bool is_native,
1976 const Object& owner, 1982 const Object& owner,
1977 intptr_t token_pos); 1983 intptr_t token_pos);
1978 1984
1979 // Allocates a new Function object representing a closure function, as well as 1985 // Allocates a new Function object representing a closure function, as well as
1980 // a new associated Class object representing the signature class of the 1986 // a new associated Class object representing the signature class of the
1981 // function. 1987 // function.
1982 // The function and the class share the same given name. 1988 // The function and the class share the same given name.
1983 static RawFunction* NewClosureFunction(const String& name, 1989 static RawFunction* NewClosureFunction(const String& name,
1984 const Function& parent, 1990 const Function& parent,
1985 intptr_t token_pos); 1991 intptr_t token_pos);
1986 1992
1993 static RawFunction* NewEvalFunction(const Class& owner,
1994 const Script& script,
1995 bool is_static);
1996
1987 // Creates a new static initializer function which is invoked in the implicit 1997 // Creates a new static initializer function which is invoked in the implicit
1988 // static getter function. 1998 // static getter function.
1989 static RawFunction* NewStaticInitializer(const Field& field); 1999 static RawFunction* NewStaticInitializer(const Field& field);
1990 2000
1991 // Allocate new function object, clone values from this function. The 2001 // Allocate new function object, clone values from this function. The
1992 // owner of the clone is new_owner. 2002 // owner of the clone is new_owner.
1993 RawFunction* Clone(const Class& new_owner) const; 2003 RawFunction* Clone(const Class& new_owner) const;
1994 2004
1995 // Slow function, use in asserts to track changes in important library 2005 // Slow function, use in asserts to track changes in important library
1996 // functions. 2006 // functions.
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
2051 void set_kind(RawFunction::Kind value) const; 2061 void set_kind(RawFunction::Kind value) const;
2052 void set_is_static(bool value) const; 2062 void set_is_static(bool value) const;
2053 void set_is_const(bool value) const; 2063 void set_is_const(bool value) const;
2054 void set_is_external(bool value) const; 2064 void set_is_external(bool value) const;
2055 void set_parent_function(const Function& value) const; 2065 void set_parent_function(const Function& value) const;
2056 void set_owner(const Object& value) const; 2066 void set_owner(const Object& value) const;
2057 RawFunction* implicit_closure_function() const; 2067 RawFunction* implicit_closure_function() const;
2058 void set_implicit_closure_function(const Function& value) const; 2068 void set_implicit_closure_function(const Function& value) const;
2059 RawInstance* implicit_static_closure() const; 2069 RawInstance* implicit_static_closure() const;
2060 void set_implicit_static_closure(const Instance& closure) const; 2070 void set_implicit_static_closure(const Instance& closure) const;
2071 RawScript* eval_script() const;
2072 void set_eval_script(const Script& value) const;
2061 void set_num_optional_parameters(intptr_t value) const; // Encoded value. 2073 void set_num_optional_parameters(intptr_t value) const; // Encoded value.
2062 void set_kind_tag(intptr_t value) const; 2074 void set_kind_tag(intptr_t value) const;
2063 void set_data(const Object& value) const; 2075 void set_data(const Object& value) const;
2064 bool is_optimizable() const { 2076 bool is_optimizable() const {
2065 return OptimizableBit::decode(raw_ptr()->kind_tag_); 2077 return OptimizableBit::decode(raw_ptr()->kind_tag_);
2066 } 2078 }
2067 void set_is_optimizable(bool value) const; 2079 void set_is_optimizable(bool value) const;
2068 2080
2069 static RawFunction* New(); 2081 static RawFunction* New();
2070 2082
(...skipping 5077 matching lines...) Expand 10 before | Expand all | Expand 10 after
7148 7160
7149 7161
7150 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7162 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7151 intptr_t index) { 7163 intptr_t index) {
7152 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7164 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7153 } 7165 }
7154 7166
7155 } // namespace dart 7167 } // namespace dart
7156 7168
7157 #endif // VM_OBJECT_H_ 7169 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/lib/mirrors_impl.dart ('k') | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698