| 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 4590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4601 // Copies the string characters into the provided external array | 4601 // Copies the string characters into the provided external array |
| 4602 // and morphs the string object into an external string object. | 4602 // and morphs the string object into an external string object. |
| 4603 // The remaining unused part of the original string object is marked as | 4603 // The remaining unused part of the original string object is marked as |
| 4604 // an Array object or a regular Object so that it can be traversed during | 4604 // an Array object or a regular Object so that it can be traversed during |
| 4605 // garbage collection. | 4605 // garbage collection. |
| 4606 RawString* MakeExternal(void* array, | 4606 RawString* MakeExternal(void* array, |
| 4607 intptr_t length, | 4607 intptr_t length, |
| 4608 void* peer, | 4608 void* peer, |
| 4609 Dart_PeerFinalizer cback) const; | 4609 Dart_PeerFinalizer cback) const; |
| 4610 | 4610 |
| 4611 | |
| 4612 // Creates a new String object from a C string that is assumed to contain | 4611 // Creates a new String object from a C string that is assumed to contain |
| 4613 // UTF-8 encoded characters and '\0' is considered a termination character. | 4612 // UTF-8 encoded characters and '\0' is considered a termination character. |
| 4614 // TODO(7123) - Rename this to FromCString(....). | 4613 // TODO(7123) - Rename this to FromCString(....). |
| 4615 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); | 4614 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); |
| 4616 | 4615 |
| 4617 // Creates a new String object from an array of UTF-8 encoded characters. | 4616 // Creates a new String object from an array of UTF-8 encoded characters. |
| 4618 static RawString* FromUTF8(const uint8_t* utf8_array, | 4617 static RawString* FromUTF8(const uint8_t* utf8_array, |
| 4619 intptr_t array_len, | 4618 intptr_t array_len, |
| 4620 Heap::Space space = Heap::kNew); | 4619 Heap::Space space = Heap::kNew); |
| 4621 | 4620 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4801 const String& str, | 4800 const String& str, |
| 4802 Heap::Space space); | 4801 Heap::Space space); |
| 4803 | 4802 |
| 4804 // High performance version of substring for one-byte strings. | 4803 // High performance version of substring for one-byte strings. |
| 4805 // "str" must be OneByteString. | 4804 // "str" must be OneByteString. |
| 4806 static RawOneByteString* SubStringUnchecked(const String& str, | 4805 static RawOneByteString* SubStringUnchecked(const String& str, |
| 4807 intptr_t begin_index, | 4806 intptr_t begin_index, |
| 4808 intptr_t length, | 4807 intptr_t length, |
| 4809 Heap::Space space); | 4808 Heap::Space space); |
| 4810 | 4809 |
| 4810 static void SetPeer(const String& str, |
| 4811 void* peer, |
| 4812 Dart_PeerFinalizer cback); |
| 4813 |
| 4814 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
| 4815 |
| 4811 static const ClassId kClassId = kOneByteStringCid; | 4816 static const ClassId kClassId = kOneByteStringCid; |
| 4812 | 4817 |
| 4813 static RawOneByteString* null() { | 4818 static RawOneByteString* null() { |
| 4814 return reinterpret_cast<RawOneByteString*>(Object::null()); | 4819 return reinterpret_cast<RawOneByteString*>(Object::null()); |
| 4815 } | 4820 } |
| 4816 | 4821 |
| 4817 private: | 4822 private: |
| 4818 static RawOneByteString* raw(const String& str) { | 4823 static RawOneByteString* raw(const String& str) { |
| 4819 return reinterpret_cast<RawOneByteString*>(str.raw()); | 4824 return reinterpret_cast<RawOneByteString*>(str.raw()); |
| 4820 } | 4825 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4883 const String& str2, | 4888 const String& str2, |
| 4884 Heap::Space space); | 4889 Heap::Space space); |
| 4885 static RawTwoByteString* ConcatAll(const Array& strings, | 4890 static RawTwoByteString* ConcatAll(const Array& strings, |
| 4886 intptr_t len, | 4891 intptr_t len, |
| 4887 Heap::Space space); | 4892 Heap::Space space); |
| 4888 | 4893 |
| 4889 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), | 4894 static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), |
| 4890 const String& str, | 4895 const String& str, |
| 4891 Heap::Space space); | 4896 Heap::Space space); |
| 4892 | 4897 |
| 4898 static void SetPeer(const String& str, |
| 4899 void* peer, |
| 4900 Dart_PeerFinalizer cback); |
| 4901 |
| 4902 static void Finalize(Dart_WeakPersistentHandle handle, void* peer); |
| 4903 |
| 4893 static RawTwoByteString* null() { | 4904 static RawTwoByteString* null() { |
| 4894 return reinterpret_cast<RawTwoByteString*>(Object::null()); | 4905 return reinterpret_cast<RawTwoByteString*>(Object::null()); |
| 4895 } | 4906 } |
| 4896 | 4907 |
| 4897 | 4908 |
| 4898 static const ClassId kClassId = kTwoByteStringCid; | 4909 static const ClassId kClassId = kTwoByteStringCid; |
| 4899 | 4910 |
| 4900 private: | 4911 private: |
| 4901 static RawTwoByteString* raw(const String& str) { | 4912 static RawTwoByteString* raw(const String& str) { |
| 4902 return reinterpret_cast<RawTwoByteString*>(str.raw()); | 4913 return reinterpret_cast<RawTwoByteString*>(str.raw()); |
| (...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6105 | 6116 |
| 6106 | 6117 |
| 6107 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6118 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6108 intptr_t index) { | 6119 intptr_t index) { |
| 6109 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6120 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6110 } | 6121 } |
| 6111 | 6122 |
| 6112 } // namespace dart | 6123 } // namespace dart |
| 6113 | 6124 |
| 6114 #endif // VM_OBJECT_H_ | 6125 #endif // VM_OBJECT_H_ |
| OLD | NEW |