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 RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_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 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3368 bool is_unboxing_candidate() const { | 3368 bool is_unboxing_candidate() const { |
3369 return UnboxingCandidateBit::decode(raw_ptr()->kind_bits_); | 3369 return UnboxingCandidateBit::decode(raw_ptr()->kind_bits_); |
3370 } | 3370 } |
3371 // Default 'true', set to false once optimizing compiler determines it should | 3371 // Default 'true', set to false once optimizing compiler determines it should |
3372 // be boxed. | 3372 // be boxed. |
3373 void set_is_unboxing_candidate(bool b) const { | 3373 void set_is_unboxing_candidate(bool b) const { |
3374 ASSERT(IsOriginal()); | 3374 ASSERT(IsOriginal()); |
3375 set_kind_bits(UnboxingCandidateBit::update(b, raw_ptr()->kind_bits_)); | 3375 set_kind_bits(UnboxingCandidateBit::update(b, raw_ptr()->kind_bits_)); |
3376 } | 3376 } |
3377 | 3377 |
3378 static bool IsExternalizableCid(intptr_t cid); | |
3379 | |
3380 enum { | 3378 enum { |
3381 kUnknownLengthOffset = -1, | 3379 kUnknownLengthOffset = -1, |
3382 kUnknownFixedLength = -1, | 3380 kUnknownFixedLength = -1, |
3383 kNoFixedLength = -2, | 3381 kNoFixedLength = -2, |
3384 }; | 3382 }; |
3385 // Returns false if any value read from this field is guaranteed to be | 3383 // Returns false if any value read from this field is guaranteed to be |
3386 // not null. | 3384 // not null. |
3387 // Internally we is_nullable_ field contains either kNullCid (nullable) or | 3385 // Internally we is_nullable_ field contains either kNullCid (nullable) or |
3388 // any other value (non-nullable) instead of boolean. This is done to simplify | 3386 // any other value (non-nullable) instead of boolean. This is done to simplify |
3389 // guarding sequence in the generated code. | 3387 // guarding sequence in the generated code. |
(...skipping 3533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6923 } | 6921 } |
6924 | 6922 |
6925 bool IsExternal() const { | 6923 bool IsExternal() const { |
6926 return RawObject::IsExternalStringClassId(raw()->GetClassId()); | 6924 return RawObject::IsExternalStringClassId(raw()->GetClassId()); |
6927 } | 6925 } |
6928 | 6926 |
6929 void* GetPeer() const; | 6927 void* GetPeer() const; |
6930 | 6928 |
6931 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; | 6929 void ToUTF8(uint8_t* utf8_array, intptr_t array_len) const; |
6932 | 6930 |
6933 // Copies the string characters into the provided external array | |
6934 // and morphs the string object into an external string object. | |
6935 // The remaining unused part of the original string object is marked as | |
6936 // an Array object or a regular Object so that it can be traversed during | |
6937 // garbage collection. | |
6938 RawString* MakeExternal(void* array, | |
6939 intptr_t external_size, | |
6940 void* peer, | |
6941 Dart_PeerFinalizer cback) const; | |
6942 | |
6943 // Creates a new String object from a C string that is assumed to contain | 6931 // Creates a new String object from a C string that is assumed to contain |
6944 // UTF-8 encoded characters and '\0' is considered a termination character. | 6932 // UTF-8 encoded characters and '\0' is considered a termination character. |
6945 // TODO(7123) - Rename this to FromCString(....). | 6933 // TODO(7123) - Rename this to FromCString(....). |
6946 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); | 6934 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); |
6947 | 6935 |
6948 // Creates a new String object from an array of UTF-8 encoded characters. | 6936 // Creates a new String object from an array of UTF-8 encoded characters. |
6949 static RawString* FromUTF8(const uint8_t* utf8_array, | 6937 static RawString* FromUTF8(const uint8_t* utf8_array, |
6950 intptr_t array_len, | 6938 intptr_t array_len, |
6951 Heap::Space space = Heap::kNew); | 6939 Heap::Space space = Heap::kNew); |
6952 | 6940 |
(...skipping 2053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9006 | 8994 |
9007 inline void TypeArguments::SetHash(intptr_t value) const { | 8995 inline void TypeArguments::SetHash(intptr_t value) const { |
9008 // This is only safe because we create a new Smi, which does not cause | 8996 // This is only safe because we create a new Smi, which does not cause |
9009 // heap allocation. | 8997 // heap allocation. |
9010 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8998 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
9011 } | 8999 } |
9012 | 9000 |
9013 } // namespace dart | 9001 } // namespace dart |
9014 | 9002 |
9015 #endif // RUNTIME_VM_OBJECT_H_ | 9003 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |