Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: vm/object.h

Issue 11443005: Issue - 7123 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after
3821 // UTF-8 encoded characters and '\0' is considered a termination character. 3821 // UTF-8 encoded characters and '\0' is considered a termination character.
3822 // TODO(7123) - Rename this to FromCString(....). 3822 // TODO(7123) - Rename this to FromCString(....).
3823 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew); 3823 static RawString* New(const char* cstr, Heap::Space space = Heap::kNew);
3824 3824
3825 // Creates a new String object from an array of UTF-8 encoded characters. 3825 // Creates a new String object from an array of UTF-8 encoded characters.
3826 static RawString* FromUTF8(const uint8_t* utf8_array, 3826 static RawString* FromUTF8(const uint8_t* utf8_array,
3827 intptr_t array_len, 3827 intptr_t array_len,
3828 Heap::Space space = Heap::kNew); 3828 Heap::Space space = Heap::kNew);
3829 3829
3830 // Creates a new String object from an array of Latin-1 encoded characters. 3830 // Creates a new String object from an array of Latin-1 encoded characters.
3831 // TODO(7123) - Rename this to FromLatin1(....). 3831 static RawString* FromLatin1(const uint8_t* latin1_array,
3832 static RawString* New(const uint8_t* latin1_array, 3832 intptr_t array_len,
3833 intptr_t array_len, 3833 Heap::Space space = Heap::kNew);
3834 Heap::Space space = Heap::kNew);
3835 3834
3836 // Creates a new String object from an array of UTF-16 encoded characters. 3835 // Creates a new String object from an array of UTF-16 encoded characters.
3837 // TODO(7123) - Rename this to FromUTF16(....). 3836 static RawString* FromUTF16(const uint16_t* utf16_array,
3838 static RawString* New(const uint16_t* utf16_array, 3837 intptr_t array_len,
3839 intptr_t array_len, 3838 Heap::Space space = Heap::kNew);
3840 Heap::Space space = Heap::kNew);
3841 3839
3842 // Creates a new String object from an array of UTF-32 encoded characters. 3840 // Creates a new String object from an array of UTF-32 encoded characters.
3843 // TODO(7123) - Rename this to FromUTF32(....). 3841 static RawString* FromUTF32(const int32_t* utf32_array,
3844 static RawString* New(const int32_t* utf32_array, 3842 intptr_t array_len,
3845 intptr_t array_len, 3843 Heap::Space space = Heap::kNew);
3846 Heap::Space space = Heap::kNew);
3847 3844
3848 // Create a new String object from another Dart String instance. 3845 // Create a new String object from another Dart String instance.
3849 static RawString* New(const String& str, Heap::Space space = Heap::kNew); 3846 static RawString* New(const String& str, Heap::Space space = Heap::kNew);
3850 3847
3851 // Creates a new External String object using the specified array of 3848 // Creates a new External String object using the specified array of
3852 // UTF-8 encoded characters as the external reference. 3849 // UTF-8 encoded characters as the external reference.
3853 static RawString* NewExternal(const uint8_t* utf8_array, 3850 static RawString* NewExternal(const uint8_t* utf8_array,
3854 intptr_t array_len, 3851 intptr_t array_len,
3855 void* peer, 3852 void* peer,
3856 Dart_PeerFinalizer callback, 3853 Dart_PeerFinalizer callback,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 // heap allocation. 3915 // heap allocation.
3919 raw_ptr()->length_ = Smi::New(value); 3916 raw_ptr()->length_ = Smi::New(value);
3920 } 3917 }
3921 3918
3922 void SetHash(intptr_t value) const { 3919 void SetHash(intptr_t value) const {
3923 // This is only safe because we create a new Smi, which does not cause 3920 // This is only safe because we create a new Smi, which does not cause
3924 // heap allocation. 3921 // heap allocation.
3925 raw_ptr()->hash_ = Smi::New(value); 3922 raw_ptr()->hash_ = Smi::New(value);
3926 } 3923 }
3927 3924
3928 template<typename HandleType, typename ElementType> 3925 template<typename HandleType, typename ElementType, typename CallbackType>
3929 static void ReadFromImpl(SnapshotReader* reader, 3926 static void ReadFromImpl(SnapshotReader* reader,
3930 String* str_obj, 3927 String* str_obj,
3931 intptr_t len, 3928 intptr_t len,
3932 intptr_t tags, 3929 intptr_t tags,
3930 CallbackType new_symbol,
3933 Snapshot::Kind kind); 3931 Snapshot::Kind kind);
3934 3932
3935 HEAP_OBJECT_IMPLEMENTATION(String, Instance); 3933 HEAP_OBJECT_IMPLEMENTATION(String, Instance);
3936 3934
3937 friend class Class; 3935 friend class Class;
3938 friend class Symbols; 3936 friend class Symbols;
3939 friend class OneByteString; 3937 friend class OneByteString;
3940 friend class TwoByteString; 3938 friend class TwoByteString;
3941 friend class ExternalOneByteString; 3939 friend class ExternalOneByteString;
3942 friend class ExternalTwoByteString; 3940 friend class ExternalTwoByteString;
(...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after
5993 if (this->CharAt(i) != str.CharAt(begin_index + i)) { 5991 if (this->CharAt(i) != str.CharAt(begin_index + i)) {
5994 return false; 5992 return false;
5995 } 5993 }
5996 } 5994 }
5997 return true; 5995 return true;
5998 } 5996 }
5999 5997
6000 } // namespace dart 5998 } // namespace dart
6001 5999
6002 #endif // VM_OBJECT_H_ 6000 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « vm/dart_api_impl.cc ('k') | vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698