| 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 5555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5566 } | 5566 } |
| 5567 | 5567 |
| 5568 bool IsExternal() const { | 5568 bool IsExternal() const { |
| 5569 return RawObject::IsExternalStringClassId(raw()->GetClassId()); | 5569 return RawObject::IsExternalStringClassId(raw()->GetClassId()); |
| 5570 } | 5570 } |
| 5571 | 5571 |
| 5572 void* GetPeer() const; | 5572 void* GetPeer() const; |
| 5573 | 5573 |
| 5574 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; | 5574 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; |
| 5575 | 5575 |
| 5576 // Produces a quoted, escaped, (possibly) truncated string. | 5576 const char* ToCString(intptr_t *length) const; |
| 5577 const char* ToUserCString(intptr_t max_len) const; | 5577 const char* ToCStringTruncated(intptr_t max_len, |
| 5578 bool* did_truncate, |
| 5579 intptr_t *length) const; |
| 5578 | 5580 |
| 5579 // Copies the string characters into the provided external array | 5581 // Copies the string characters into the provided external array |
| 5580 // and morphs the string object into an external string object. | 5582 // and morphs the string object into an external string object. |
| 5581 // The remaining unused part of the original string object is marked as | 5583 // The remaining unused part of the original string object is marked as |
| 5582 // an Array object or a regular Object so that it can be traversed during | 5584 // an Array object or a regular Object so that it can be traversed during |
| 5583 // garbage collection. | 5585 // garbage collection. |
| 5584 RawString* MakeExternal(void* array, | 5586 RawString* MakeExternal(void* array, |
| 5585 intptr_t length, | 5587 intptr_t length, |
| 5586 void* peer, | 5588 void* peer, |
| 5587 Dart_PeerFinalizer cback) const; | 5589 Dart_PeerFinalizer cback) const; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5713 } | 5715 } |
| 5714 | 5716 |
| 5715 template<typename HandleType, typename ElementType, typename CallbackType> | 5717 template<typename HandleType, typename ElementType, typename CallbackType> |
| 5716 static void ReadFromImpl(SnapshotReader* reader, | 5718 static void ReadFromImpl(SnapshotReader* reader, |
| 5717 String* str_obj, | 5719 String* str_obj, |
| 5718 intptr_t len, | 5720 intptr_t len, |
| 5719 intptr_t tags, | 5721 intptr_t tags, |
| 5720 CallbackType new_symbol, | 5722 CallbackType new_symbol, |
| 5721 Snapshot::Kind kind); | 5723 Snapshot::Kind kind); |
| 5722 | 5724 |
| 5723 intptr_t EscapedString(char* buffer, int max_len) const; | |
| 5724 intptr_t EscapedStringLen(intptr_t tooLong) const; | |
| 5725 | |
| 5726 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); | 5725 FINAL_HEAP_OBJECT_IMPLEMENTATION(String, Instance); |
| 5727 | 5726 |
| 5728 friend class Class; | 5727 friend class Class; |
| 5729 friend class Symbols; | 5728 friend class Symbols; |
| 5730 friend class StringSlice; // SetHash | 5729 friend class StringSlice; // SetHash |
| 5731 template<typename CharType> friend class CharArray; // SetHash | 5730 template<typename CharType> friend class CharArray; // SetHash |
| 5732 friend class ConcatString; // SetHash | 5731 friend class ConcatString; // SetHash |
| 5733 friend class OneByteString; | 5732 friend class OneByteString; |
| 5734 friend class TwoByteString; | 5733 friend class TwoByteString; |
| 5735 friend class ExternalOneByteString; | 5734 friend class ExternalOneByteString; |
| (...skipping 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7415 | 7414 |
| 7416 | 7415 |
| 7417 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7416 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7418 intptr_t index) { | 7417 intptr_t index) { |
| 7419 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7418 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7420 } | 7419 } |
| 7421 | 7420 |
| 7422 } // namespace dart | 7421 } // namespace dart |
| 7423 | 7422 |
| 7424 #endif // VM_OBJECT_H_ | 7423 #endif // VM_OBJECT_H_ |
| OLD | NEW |