| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 bool IsNull() const { return raw_ == null_; } | 182 bool IsNull() const { return raw_ == null_; } |
| 183 | 183 |
| 184 virtual const char* ToCString() const { | 184 virtual const char* ToCString() const { |
| 185 if (IsNull()) { | 185 if (IsNull()) { |
| 186 return "null"; | 186 return "null"; |
| 187 } else { | 187 } else { |
| 188 return "Object"; | 188 return "Object"; |
| 189 } | 189 } |
| 190 } | 190 } |
| 191 | 191 |
| 192 // Returns the name that is used to identify an object in the |
| 193 // namespace dictionary. |
| 194 // Object::DictionaryName() returns String::null(). Only subclasses |
| 195 // of Object that need to be entered in the library and library prefix |
| 196 // namespaces need to provide an implementation. |
| 197 virtual RawString* DictionaryName() const; |
| 198 |
| 192 bool IsNew() const { return raw()->IsNewObject(); } | 199 bool IsNew() const { return raw()->IsNewObject(); } |
| 193 bool IsOld() const { return raw()->IsOldObject(); } | 200 bool IsOld() const { return raw()->IsOldObject(); } |
| 194 | 201 |
| 195 // Print the object on stdout for debugging. | 202 // Print the object on stdout for debugging. |
| 196 void Print() const; | 203 void Print() const; |
| 197 | 204 |
| 198 bool IsZoneHandle() const { | 205 bool IsZoneHandle() const { |
| 199 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this)); | 206 return VMHandles::IsZoneHandle(reinterpret_cast<uword>(this)); |
| 200 } | 207 } |
| 201 | 208 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 void set_handle_vtable(cpp_vtable value) const { | 459 void set_handle_vtable(cpp_vtable value) const { |
| 453 raw_ptr()->handle_vtable_ = value; | 460 raw_ptr()->handle_vtable_ = value; |
| 454 } | 461 } |
| 455 | 462 |
| 456 intptr_t id() const { return raw_ptr()->id_; } | 463 intptr_t id() const { return raw_ptr()->id_; } |
| 457 void set_id(intptr_t value) const { | 464 void set_id(intptr_t value) const { |
| 458 raw_ptr()->id_ = value; | 465 raw_ptr()->id_ = value; |
| 459 } | 466 } |
| 460 | 467 |
| 461 RawString* Name() const; | 468 RawString* Name() const; |
| 469 RawString* UserVisibleName() const; |
| 462 | 470 |
| 463 RawString* UserVisibleName() const; | 471 virtual RawString* DictionaryName() const { return Name(); } |
| 464 | 472 |
| 465 RawScript* script() const { return raw_ptr()->script_; } | 473 RawScript* script() const { return raw_ptr()->script_; } |
| 466 void set_script(const Script& value) const; | 474 void set_script(const Script& value) const; |
| 467 | 475 |
| 468 intptr_t token_pos() const { return raw_ptr()->token_pos_; } | 476 intptr_t token_pos() const { return raw_ptr()->token_pos_; } |
| 469 | 477 |
| 470 // This class represents the signature class of a closure function if | 478 // This class represents the signature class of a closure function if |
| 471 // signature_function() is not null. | 479 // signature_function() is not null. |
| 472 // The associated function may be a closure function (with code) or a | 480 // The associated function may be a closure function (with code) or a |
| 473 // signature function (without code) solely describing the result type and | 481 // signature function (without code) solely describing the result type and |
| (...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); | 1337 HEAP_OBJECT_IMPLEMENTATION(PatchClass, Object); |
| 1330 friend class Class; | 1338 friend class Class; |
| 1331 }; | 1339 }; |
| 1332 | 1340 |
| 1333 | 1341 |
| 1334 class Function : public Object { | 1342 class Function : public Object { |
| 1335 public: | 1343 public: |
| 1336 RawString* name() const { return raw_ptr()->name_; } | 1344 RawString* name() const { return raw_ptr()->name_; } |
| 1337 RawString* UserVisibleName() const; | 1345 RawString* UserVisibleName() const; |
| 1338 RawString* QualifiedUserVisibleName() const; | 1346 RawString* QualifiedUserVisibleName() const; |
| 1347 virtual RawString* DictionaryName() const { return name(); } |
| 1339 | 1348 |
| 1340 // Build a string of the form '<T, R>(T, [b: B, c: C]) => R' representing the | 1349 // Build a string of the form '<T, R>(T, [b: B, c: C]) => R' representing the |
| 1341 // internal signature of the given function. | 1350 // internal signature of the given function. |
| 1342 RawString* Signature() const { | 1351 RawString* Signature() const { |
| 1343 const bool instantiate = false; | 1352 const bool instantiate = false; |
| 1344 return BuildSignature(instantiate, kInternalName, TypeArguments::Handle()); | 1353 return BuildSignature(instantiate, kInternalName, TypeArguments::Handle()); |
| 1345 } | 1354 } |
| 1346 | 1355 |
| 1347 // Build a string of the form '(A, [b: B, c: C]) => D' representing the | 1356 // Build a string of the form '(A, [b: B, c: C]) => D' representing the |
| 1348 // signature of the given function, where all generic types (e.g. '<T, R>' in | 1357 // signature of the given function, where all generic types (e.g. '<T, R>' in |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1750 friend class Class; | 1759 friend class Class; |
| 1751 friend class Function; | 1760 friend class Function; |
| 1752 friend class HeapProfiler; | 1761 friend class HeapProfiler; |
| 1753 }; | 1762 }; |
| 1754 | 1763 |
| 1755 | 1764 |
| 1756 class Field : public Object { | 1765 class Field : public Object { |
| 1757 public: | 1766 public: |
| 1758 RawString* name() const { return raw_ptr()->name_; } | 1767 RawString* name() const { return raw_ptr()->name_; } |
| 1759 RawString* UserVisibleName() const; | 1768 RawString* UserVisibleName() const; |
| 1769 virtual RawString* DictionaryName() const { return name(); } |
| 1760 | 1770 |
| 1761 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } | 1771 bool is_static() const { return StaticBit::decode(raw_ptr()->kind_bits_); } |
| 1762 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } | 1772 bool is_final() const { return FinalBit::decode(raw_ptr()->kind_bits_); } |
| 1763 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } | 1773 bool is_const() const { return ConstBit::decode(raw_ptr()->kind_bits_); } |
| 1764 | 1774 |
| 1765 inline intptr_t Offset() const; | 1775 inline intptr_t Offset() const; |
| 1766 inline void SetOffset(intptr_t value) const; | 1776 inline void SetOffset(intptr_t value) const; |
| 1767 | 1777 |
| 1768 RawInstance* value() const; | 1778 RawInstance* value() const; |
| 1769 void set_value(const Instance& value) const; | 1779 void set_value(const Instance& value) const; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2169 friend class Class; | 2179 friend class Class; |
| 2170 friend class Debugger; | 2180 friend class Debugger; |
| 2171 friend class DictionaryIterator; | 2181 friend class DictionaryIterator; |
| 2172 friend class Isolate; | 2182 friend class Isolate; |
| 2173 }; | 2183 }; |
| 2174 | 2184 |
| 2175 | 2185 |
| 2176 class LibraryPrefix : public Object { | 2186 class LibraryPrefix : public Object { |
| 2177 public: | 2187 public: |
| 2178 RawString* name() const { return raw_ptr()->name_; } | 2188 RawString* name() const { return raw_ptr()->name_; } |
| 2189 virtual RawString* DictionaryName() const { return name(); } |
| 2190 |
| 2179 RawArray* libraries() const { return raw_ptr()->libraries_; } | 2191 RawArray* libraries() const { return raw_ptr()->libraries_; } |
| 2180 intptr_t num_libs() const { return raw_ptr()->num_libs_; } | 2192 intptr_t num_libs() const { return raw_ptr()->num_libs_; } |
| 2181 | 2193 |
| 2182 bool ContainsLibrary(const Library& library) const; | 2194 bool ContainsLibrary(const Library& library) const; |
| 2183 RawLibrary* GetLibrary(int index) const; | 2195 RawLibrary* GetLibrary(int index) const; |
| 2184 void AddLibrary(const Library& library) const; | 2196 void AddLibrary(const Library& library) const; |
| 2185 RawClass* LookupLocalClass(const String& class_name) const; | 2197 RawClass* LookupLocalClass(const String& class_name) const; |
| 2186 | 2198 |
| 2187 static intptr_t InstanceSize() { | 2199 static intptr_t InstanceSize() { |
| 2188 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); | 2200 return RoundedAllocationSize(sizeof(RawLibraryPrefix)); |
| (...skipping 3442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5631 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5643 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5632 return false; | 5644 return false; |
| 5633 } | 5645 } |
| 5634 } | 5646 } |
| 5635 return true; | 5647 return true; |
| 5636 } | 5648 } |
| 5637 | 5649 |
| 5638 } // namespace dart | 5650 } // namespace dart |
| 5639 | 5651 |
| 5640 #endif // VM_OBJECT_H_ | 5652 #endif // VM_OBJECT_H_ |
| OLD | NEW |