| 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 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1582 case RawFunction::kSetterFunction: | 1582 case RawFunction::kSetterFunction: |
| 1583 case RawFunction::kImplicitGetter: | 1583 case RawFunction::kImplicitGetter: |
| 1584 case RawFunction::kImplicitSetter: | 1584 case RawFunction::kImplicitSetter: |
| 1585 case RawFunction::kMethodExtractor: | 1585 case RawFunction::kMethodExtractor: |
| 1586 case RawFunction::kNoSuchMethodDispatcher: | 1586 case RawFunction::kNoSuchMethodDispatcher: |
| 1587 case RawFunction::kInvokeFieldDispatcher: | 1587 case RawFunction::kInvokeFieldDispatcher: |
| 1588 return true; | 1588 return true; |
| 1589 case RawFunction::kClosureFunction: | 1589 case RawFunction::kClosureFunction: |
| 1590 case RawFunction::kConstructor: | 1590 case RawFunction::kConstructor: |
| 1591 case RawFunction::kImplicitStaticFinalGetter: | 1591 case RawFunction::kImplicitStaticFinalGetter: |
| 1592 case RawFunction::kStaticInitializer: |
| 1592 return false; | 1593 return false; |
| 1593 default: | 1594 default: |
| 1594 UNREACHABLE(); | 1595 UNREACHABLE(); |
| 1595 return false; | 1596 return false; |
| 1596 } | 1597 } |
| 1597 } | 1598 } |
| 1598 bool IsStaticFunction() const { | 1599 bool IsStaticFunction() const { |
| 1599 if (!is_static()) { | 1600 if (!is_static()) { |
| 1600 return false; | 1601 return false; |
| 1601 } | 1602 } |
| 1602 switch (kind()) { | 1603 switch (kind()) { |
| 1603 case RawFunction::kRegularFunction: | 1604 case RawFunction::kRegularFunction: |
| 1604 case RawFunction::kGetterFunction: | 1605 case RawFunction::kGetterFunction: |
| 1605 case RawFunction::kSetterFunction: | 1606 case RawFunction::kSetterFunction: |
| 1606 case RawFunction::kImplicitGetter: | 1607 case RawFunction::kImplicitGetter: |
| 1607 case RawFunction::kImplicitSetter: | 1608 case RawFunction::kImplicitSetter: |
| 1608 case RawFunction::kImplicitStaticFinalGetter: | 1609 case RawFunction::kImplicitStaticFinalGetter: |
| 1610 case RawFunction::kStaticInitializer: |
| 1609 return true; | 1611 return true; |
| 1610 case RawFunction::kClosureFunction: | 1612 case RawFunction::kClosureFunction: |
| 1611 case RawFunction::kConstructor: | 1613 case RawFunction::kConstructor: |
| 1612 return false; | 1614 return false; |
| 1613 default: | 1615 default: |
| 1614 UNREACHABLE(); | 1616 UNREACHABLE(); |
| 1615 return false; | 1617 return false; |
| 1616 } | 1618 } |
| 1617 } | 1619 } |
| 1618 bool IsInFactoryScope() const; | 1620 bool IsInFactoryScope() const; |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1802 // Returns true if this function represents an explicit setter function. | 1804 // Returns true if this function represents an explicit setter function. |
| 1803 bool IsSetterFunction() const { | 1805 bool IsSetterFunction() const { |
| 1804 return kind() == RawFunction::kSetterFunction; | 1806 return kind() == RawFunction::kSetterFunction; |
| 1805 } | 1807 } |
| 1806 | 1808 |
| 1807 // Returns true if this function represents an implicit setter function. | 1809 // Returns true if this function represents an implicit setter function. |
| 1808 bool IsImplicitSetterFunction() const { | 1810 bool IsImplicitSetterFunction() const { |
| 1809 return kind() == RawFunction::kImplicitSetter; | 1811 return kind() == RawFunction::kImplicitSetter; |
| 1810 } | 1812 } |
| 1811 | 1813 |
| 1814 // Returns true if this function represents an static initializer function. |
| 1815 bool IsStaticInitializerFunction() const { |
| 1816 return kind() == RawFunction::kStaticInitializer; |
| 1817 } |
| 1818 |
| 1812 // Returns true if this function represents a (possibly implicit) closure | 1819 // Returns true if this function represents a (possibly implicit) closure |
| 1813 // function. | 1820 // function. |
| 1814 bool IsClosureFunction() const { | 1821 bool IsClosureFunction() const { |
| 1815 return kind() == RawFunction::kClosureFunction; | 1822 return kind() == RawFunction::kClosureFunction; |
| 1816 } | 1823 } |
| 1817 | 1824 |
| 1818 // Returns true if this function represents an implicit closure function. | 1825 // Returns true if this function represents an implicit closure function. |
| 1819 bool IsImplicitClosureFunction() const; | 1826 bool IsImplicitClosureFunction() const; |
| 1820 | 1827 |
| 1821 // Returns true if this function represents a non implicit closure function. | 1828 // Returns true if this function represents a non implicit closure function. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1860 intptr_t token_pos); | 1867 intptr_t token_pos); |
| 1861 | 1868 |
| 1862 // Allocates a new Function object representing a closure function, as well as | 1869 // Allocates a new Function object representing a closure function, as well as |
| 1863 // a new associated Class object representing the signature class of the | 1870 // a new associated Class object representing the signature class of the |
| 1864 // function. | 1871 // function. |
| 1865 // The function and the class share the same given name. | 1872 // The function and the class share the same given name. |
| 1866 static RawFunction* NewClosureFunction(const String& name, | 1873 static RawFunction* NewClosureFunction(const String& name, |
| 1867 const Function& parent, | 1874 const Function& parent, |
| 1868 intptr_t token_pos); | 1875 intptr_t token_pos); |
| 1869 | 1876 |
| 1877 // Creates a new static initializer function which is invoked in the implicit |
| 1878 // static getter function. |
| 1879 static RawFunction* NewStaticInitializer(const String& field_name, |
| 1880 const AbstractType& result_type, |
| 1881 const Class& cls, |
| 1882 intptr_t token_pos); |
| 1883 |
| 1870 // Allocate new function object, clone values from this function. The | 1884 // Allocate new function object, clone values from this function. The |
| 1871 // owner of the clone is new_owner. | 1885 // owner of the clone is new_owner. |
| 1872 RawFunction* Clone(const Class& new_owner) const; | 1886 RawFunction* Clone(const Class& new_owner) const; |
| 1873 | 1887 |
| 1874 // Slow function, use in asserts to track changes in important library | 1888 // Slow function, use in asserts to track changes in important library |
| 1875 // functions. | 1889 // functions. |
| 1876 int32_t SourceFingerprint() const; | 1890 int32_t SourceFingerprint() const; |
| 1877 | 1891 |
| 1878 // Return false and report an error if the fingerprint does not match. | 1892 // Return false and report an error if the fingerprint does not match. |
| 1879 bool CheckSourceFingerprint(int32_t fp) const; | 1893 bool CheckSourceFingerprint(int32_t fp) const; |
| (...skipping 4416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6296 | 6310 |
| 6297 | 6311 |
| 6298 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6312 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6299 intptr_t index) { | 6313 intptr_t index) { |
| 6300 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6314 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6301 } | 6315 } |
| 6302 | 6316 |
| 6303 } // namespace dart | 6317 } // namespace dart |
| 6304 | 6318 |
| 6305 #endif // VM_OBJECT_H_ | 6319 #endif // VM_OBJECT_H_ |
| OLD | NEW |