| 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 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 867 | 867 |
| 868 // Check if this type represents the 'bool' interface. | 868 // Check if this type represents the 'bool' interface. |
| 869 bool IsBoolInterface() const; | 869 bool IsBoolInterface() const; |
| 870 | 870 |
| 871 // Check if this type represents the 'int' interface. | 871 // Check if this type represents the 'int' interface. |
| 872 bool IsIntInterface() const; | 872 bool IsIntInterface() const; |
| 873 | 873 |
| 874 // Check if this type represents the 'double' interface. | 874 // Check if this type represents the 'double' interface. |
| 875 bool IsDoubleInterface() const; | 875 bool IsDoubleInterface() const; |
| 876 | 876 |
| 877 // Check if this type represents the 'num' interface. | 877 // Check if this type represents the 'num' type. |
| 878 bool IsNumberInterface() const; | 878 bool IsNumberType() const; |
| 879 | 879 |
| 880 // Check if this type represents the 'String' interface. | 880 // Check if this type represents the 'String' interface. |
| 881 bool IsStringInterface() const; | 881 bool IsStringInterface() const; |
| 882 | 882 |
| 883 // Check if this type represents the 'Function' interface. | 883 // Check if this type represents the 'Function' type. |
| 884 bool IsFunctionInterface() const; | 884 bool IsFunctionType() const; |
| 885 | 885 |
| 886 // Check if this type represents the 'List' interface. | 886 // Check if this type represents the 'List' interface. |
| 887 bool IsListInterface() const; | 887 bool IsListInterface() const; |
| 888 | 888 |
| 889 // Check if this type is an interface type. | 889 // Check if this type is an interface type. |
| 890 bool IsInterfaceType() const { | 890 bool IsInterfaceType() const { |
| 891 if (!HasResolvedTypeClass()) { | 891 if (!HasResolvedTypeClass()) { |
| 892 return false; | 892 return false; |
| 893 } | 893 } |
| 894 const Class& cls = Class::Handle(type_class()); | 894 const Class& cls = Class::Handle(type_class()); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 // The 'bool' interface type. | 986 // The 'bool' interface type. |
| 987 static RawType* BoolInterface(); | 987 static RawType* BoolInterface(); |
| 988 | 988 |
| 989 // The 'int' interface type. | 989 // The 'int' interface type. |
| 990 static RawType* IntInterface(); | 990 static RawType* IntInterface(); |
| 991 | 991 |
| 992 // The 'double' interface type. | 992 // The 'double' interface type. |
| 993 static RawType* DoubleInterface(); | 993 static RawType* DoubleInterface(); |
| 994 | 994 |
| 995 // The 'num' interface type. | 995 // The 'num' interface type. |
| 996 static RawType* NumberInterface(); | 996 static RawType* Number(); |
| 997 | 997 |
| 998 // The 'String' interface type. | 998 // The 'String' interface type. |
| 999 static RawType* StringInterface(); | 999 static RawType* StringInterface(); |
| 1000 | 1000 |
| 1001 // The 'Function' interface type. | 1001 // The 'Function' interface type. |
| 1002 static RawType* FunctionInterface(); | 1002 static RawType* Function(); |
| 1003 | 1003 |
| 1004 // The 'List' interface type. | 1004 // The 'List' interface type. |
| 1005 static RawType* ListInterface(); | 1005 static RawType* ListInterface(); |
| 1006 | 1006 |
| 1007 // The finalized type of the given non-parameterized class. | 1007 // The finalized type of the given non-parameterized class. |
| 1008 static RawType* NewNonParameterizedType(const Class& type_class); | 1008 static RawType* NewNonParameterizedType(const Class& type_class); |
| 1009 | 1009 |
| 1010 static RawType* New(const Object& clazz, | 1010 static RawType* New(const Object& clazz, |
| 1011 const AbstractTypeArguments& arguments, | 1011 const AbstractTypeArguments& arguments, |
| 1012 intptr_t token_pos, | 1012 intptr_t token_pos, |
| (...skipping 2124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3137 // Number is an abstract class. | 3137 // Number is an abstract class. |
| 3138 UNREACHABLE(); | 3138 UNREACHABLE(); |
| 3139 return false; | 3139 return false; |
| 3140 } | 3140 } |
| 3141 virtual bool IsNegative() const { | 3141 virtual bool IsNegative() const { |
| 3142 // Number is an abstract class. | 3142 // Number is an abstract class. |
| 3143 UNREACHABLE(); | 3143 UNREACHABLE(); |
| 3144 return false; | 3144 return false; |
| 3145 } | 3145 } |
| 3146 OBJECT_IMPLEMENTATION(Number, Instance); | 3146 OBJECT_IMPLEMENTATION(Number, Instance); |
| 3147 friend class Class; |
| 3147 }; | 3148 }; |
| 3148 | 3149 |
| 3149 | 3150 |
| 3150 class Integer : public Number { | 3151 class Integer : public Number { |
| 3151 public: | 3152 public: |
| 3152 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); | 3153 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); |
| 3153 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); | 3154 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); |
| 3154 | 3155 |
| 3155 virtual double AsDoubleValue() const; | 3156 virtual double AsDoubleValue() const; |
| 3156 virtual int64_t AsInt64Value() const; | 3157 virtual int64_t AsInt64Value() const; |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5222 void SetExternalData(ExternalByteArrayData<double>* data) { | 5223 void SetExternalData(ExternalByteArrayData<double>* data) { |
| 5223 raw_ptr()->external_data_ = data; | 5224 raw_ptr()->external_data_ = data; |
| 5224 } | 5225 } |
| 5225 | 5226 |
| 5226 HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array, ByteArray); | 5227 HEAP_OBJECT_IMPLEMENTATION(ExternalFloat64Array, ByteArray); |
| 5227 friend class ByteArray; | 5228 friend class ByteArray; |
| 5228 friend class Class; | 5229 friend class Class; |
| 5229 }; | 5230 }; |
| 5230 | 5231 |
| 5231 | 5232 |
| 5233 // DartFunction represents the abstract Dart class 'Function'. |
| 5234 class DartFunction : public Instance { |
| 5235 private: |
| 5236 HEAP_OBJECT_IMPLEMENTATION(DartFunction, Instance); |
| 5237 friend class Class; |
| 5238 friend class Instance; |
| 5239 }; |
| 5240 |
| 5241 |
| 5232 class Closure : public Instance { | 5242 class Closure : public Instance { |
| 5233 public: | 5243 public: |
| 5234 RawFunction* function() const { return raw_ptr()->function_; } | 5244 RawFunction* function() const { return raw_ptr()->function_; } |
| 5235 static intptr_t function_offset() { | 5245 static intptr_t function_offset() { |
| 5236 return OFFSET_OF(RawClosure, function_); | 5246 return OFFSET_OF(RawClosure, function_); |
| 5237 } | 5247 } |
| 5238 | 5248 |
| 5239 RawContext* context() const { return raw_ptr()->context_; } | 5249 RawContext* context() const { return raw_ptr()->context_; } |
| 5240 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } | 5250 static intptr_t context_offset() { return OFFSET_OF(RawClosure, context_); } |
| 5241 | 5251 |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5518 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5528 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5519 return false; | 5529 return false; |
| 5520 } | 5530 } |
| 5521 } | 5531 } |
| 5522 return true; | 5532 return true; |
| 5523 } | 5533 } |
| 5524 | 5534 |
| 5525 } // namespace dart | 5535 } // namespace dart |
| 5526 | 5536 |
| 5527 #endif // VM_OBJECT_H_ | 5537 #endif // VM_OBJECT_H_ |
| OLD | NEW |