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 5574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5585 } | 5585 } |
5586 | 5586 |
5587 bool IsExternal() const { | 5587 bool IsExternal() const { |
5588 return RawObject::IsExternalStringClassId(raw()->GetClassId()); | 5588 return RawObject::IsExternalStringClassId(raw()->GetClassId()); |
5589 } | 5589 } |
5590 | 5590 |
5591 void* GetPeer() const; | 5591 void* GetPeer() const; |
5592 | 5592 |
5593 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; | 5593 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; |
5594 | 5594 |
5595 // Creates a UTF-8, NUL-terminated string in the current zone. The size of the | |
5596 // created string in UTF-8 code units (bytes) is answered in 'length'; this | |
5597 // can be longer than strlen of the result when the string has internal NULs. | |
5598 // For the truncating version, 'max_length' is in UTF-16 code units, and will | |
5599 // be rounded down if necessary to prevent splitting a surrogate pair. | |
5600 const char* ToCString(intptr_t *length) const; | |
5601 const char* ToCStringTruncated(intptr_t max_len, | |
5602 bool* did_truncate, | |
5603 intptr_t *length) const; | |
5604 | |
5605 // Copies the string characters into the provided external array | 5595 // Copies the string characters into the provided external array |
5606 // and morphs the string object into an external string object. | 5596 // and morphs the string object into an external string object. |
5607 // The remaining unused part of the original string object is marked as | 5597 // The remaining unused part of the original string object is marked as |
5608 // an Array object or a regular Object so that it can be traversed during | 5598 // an Array object or a regular Object so that it can be traversed during |
5609 // garbage collection. | 5599 // garbage collection. |
5610 RawString* MakeExternal(void* array, | 5600 RawString* MakeExternal(void* array, |
5611 intptr_t length, | 5601 intptr_t length, |
5612 void* peer, | 5602 void* peer, |
5613 Dart_PeerFinalizer cback) const; | 5603 Dart_PeerFinalizer cback) const; |
5614 | 5604 |
(...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7461 | 7451 |
7462 | 7452 |
7463 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7453 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7464 intptr_t index) { | 7454 intptr_t index) { |
7465 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7455 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7466 } | 7456 } |
7467 | 7457 |
7468 } // namespace dart | 7458 } // namespace dart |
7469 | 7459 |
7470 #endif // VM_OBJECT_H_ | 7460 #endif // VM_OBJECT_H_ |
OLD | NEW |