| 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 6662 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6673   void* GetPeer() const; | 6673   void* GetPeer() const; | 
| 6674 | 6674 | 
| 6675   void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; | 6675   void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; | 
| 6676 | 6676 | 
| 6677   // Copies the string characters into the provided external array | 6677   // Copies the string characters into the provided external array | 
| 6678   // and morphs the string object into an external string object. | 6678   // and morphs the string object into an external string object. | 
| 6679   // The remaining unused part of the original string object is marked as | 6679   // The remaining unused part of the original string object is marked as | 
| 6680   // an Array object or a regular Object so that it can be traversed during | 6680   // an Array object or a regular Object so that it can be traversed during | 
| 6681   // garbage collection. | 6681   // garbage collection. | 
| 6682   RawString* MakeExternal(void* array, | 6682   RawString* MakeExternal(void* array, | 
| 6683                           intptr_t length, | 6683                           intptr_t external_size, | 
| 6684                           void* peer, | 6684                           void* peer, | 
| 6685                           Dart_PeerFinalizer cback) const; | 6685                           Dart_PeerFinalizer cback) const; | 
| 6686 | 6686 | 
| 6687   // Creates a new String object from a C string that is assumed to contain | 6687   // Creates a new String object from a C string that is assumed to contain | 
| 6688   // UTF-8 encoded characters and '\0' is considered a termination character. | 6688   // UTF-8 encoded characters and '\0' is considered a termination character. | 
| 6689   // TODO(7123) - Rename this to FromCString(....). | 6689   // TODO(7123) - Rename this to FromCString(....). | 
| 6690   static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); | 6690   static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); | 
| 6691 | 6691 | 
| 6692   // Creates a new String object from an array of UTF-8 encoded characters. | 6692   // Creates a new String object from an array of UTF-8 encoded characters. | 
| 6693   static RawString* FromUTF8(const uint8_t* utf8_array, | 6693   static RawString* FromUTF8(const uint8_t* utf8_array, | 
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6929                                      Heap::Space space); | 6929                                      Heap::Space space); | 
| 6930 | 6930 | 
| 6931   // High performance version of substring for one-byte strings. | 6931   // High performance version of substring for one-byte strings. | 
| 6932   // "str" must be OneByteString. | 6932   // "str" must be OneByteString. | 
| 6933   static RawOneByteString* SubStringUnchecked(const String& str, | 6933   static RawOneByteString* SubStringUnchecked(const String& str, | 
| 6934                                               intptr_t begin_index, | 6934                                               intptr_t begin_index, | 
| 6935                                               intptr_t length, | 6935                                               intptr_t length, | 
| 6936                                               Heap::Space space); | 6936                                               Heap::Space space); | 
| 6937 | 6937 | 
| 6938   static void SetPeer(const String& str, | 6938   static void SetPeer(const String& str, | 
|  | 6939                       intptr_t external_size, | 
| 6939                       void* peer, | 6940                       void* peer, | 
| 6940                       Dart_PeerFinalizer cback); | 6941                       Dart_PeerFinalizer cback); | 
| 6941 | 6942 | 
| 6942   static void Finalize(void* isolate_callback_data, | 6943   static void Finalize(void* isolate_callback_data, | 
| 6943                        Dart_WeakPersistentHandle handle, | 6944                        Dart_WeakPersistentHandle handle, | 
| 6944                        void* peer); | 6945                        void* peer); | 
| 6945 | 6946 | 
| 6946   static const ClassId kClassId = kOneByteStringCid; | 6947   static const ClassId kClassId = kOneByteStringCid; | 
| 6947 | 6948 | 
| 6948   static RawOneByteString* null() { | 6949   static RawOneByteString* null() { | 
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7044                                      intptr_t start, | 7045                                      intptr_t start, | 
| 7045                                      intptr_t end, | 7046                                      intptr_t end, | 
| 7046                                      intptr_t len, | 7047                                      intptr_t len, | 
| 7047                                      Heap::Space space); | 7048                                      Heap::Space space); | 
| 7048 | 7049 | 
| 7049   static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), | 7050   static RawTwoByteString* Transform(int32_t (*mapping)(int32_t ch), | 
| 7050                                      const String& str, | 7051                                      const String& str, | 
| 7051                                      Heap::Space space); | 7052                                      Heap::Space space); | 
| 7052 | 7053 | 
| 7053   static void SetPeer(const String& str, | 7054   static void SetPeer(const String& str, | 
|  | 7055                       intptr_t external_size, | 
| 7054                       void* peer, | 7056                       void* peer, | 
| 7055                       Dart_PeerFinalizer cback); | 7057                       Dart_PeerFinalizer cback); | 
| 7056 | 7058 | 
| 7057   static void Finalize(void* isolate_callback_data, | 7059   static void Finalize(void* isolate_callback_data, | 
| 7058                        Dart_WeakPersistentHandle handle, | 7060                        Dart_WeakPersistentHandle handle, | 
| 7059                        void* peer); | 7061                        void* peer); | 
| 7060 | 7062 | 
| 7061   static RawTwoByteString* null() { | 7063   static RawTwoByteString* null() { | 
| 7062     return reinterpret_cast<RawTwoByteString*>(Object::null()); | 7064     return reinterpret_cast<RawTwoByteString*>(Object::null()); | 
| 7063   } | 7065   } | 
| (...skipping 825 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7889   TYPED_GETTER_SETTER(Uint64, uint64_t) | 7891   TYPED_GETTER_SETTER(Uint64, uint64_t) | 
| 7890   TYPED_GETTER_SETTER(Float32, float) | 7892   TYPED_GETTER_SETTER(Float32, float) | 
| 7891   TYPED_GETTER_SETTER(Float64, double) | 7893   TYPED_GETTER_SETTER(Float64, double) | 
| 7892   TYPED_GETTER_SETTER(Float32x4, simd128_value_t) | 7894   TYPED_GETTER_SETTER(Float32x4, simd128_value_t) | 
| 7893   TYPED_GETTER_SETTER(Int32x4, simd128_value_t) | 7895   TYPED_GETTER_SETTER(Int32x4, simd128_value_t) | 
| 7894   TYPED_GETTER_SETTER(Float64x2, simd128_value_t) | 7896   TYPED_GETTER_SETTER(Float64x2, simd128_value_t) | 
| 7895 | 7897 | 
| 7896 #undef TYPED_GETTER_SETTER | 7898 #undef TYPED_GETTER_SETTER | 
| 7897 | 7899 | 
| 7898   FinalizablePersistentHandle* AddFinalizer( | 7900   FinalizablePersistentHandle* AddFinalizer( | 
| 7899       void* peer, Dart_WeakPersistentHandleFinalizer callback) const; | 7901       void* peer, | 
|  | 7902       Dart_WeakPersistentHandleFinalizer callback, | 
|  | 7903       intptr_t external_size) const; | 
| 7900 | 7904 | 
| 7901   static intptr_t length_offset() { | 7905   static intptr_t length_offset() { | 
| 7902     return OFFSET_OF(RawExternalTypedData, length_); | 7906     return OFFSET_OF(RawExternalTypedData, length_); | 
| 7903   } | 7907   } | 
| 7904 | 7908 | 
| 7905   static intptr_t data_offset() { | 7909   static intptr_t data_offset() { | 
| 7906     return OFFSET_OF(RawExternalTypedData, data_); | 7910     return OFFSET_OF(RawExternalTypedData, data_); | 
| 7907   } | 7911   } | 
| 7908 | 7912 | 
| 7909   static intptr_t InstanceSize() { | 7913   static intptr_t InstanceSize() { | 
| (...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 8779 | 8783 | 
| 8780 inline void TypeArguments::SetHash(intptr_t value) const { | 8784 inline void TypeArguments::SetHash(intptr_t value) const { | 
| 8781   // This is only safe because we create a new Smi, which does not cause | 8785   // This is only safe because we create a new Smi, which does not cause | 
| 8782   // heap allocation. | 8786   // heap allocation. | 
| 8783   StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8787   StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 
| 8784 } | 8788 } | 
| 8785 | 8789 | 
| 8786 }  // namespace dart | 8790 }  // namespace dart | 
| 8787 | 8791 | 
| 8788 #endif  // VM_OBJECT_H_ | 8792 #endif  // VM_OBJECT_H_ | 
| OLD | NEW | 
|---|