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