| 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 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 #include "vm/object_store.h" | 6 #include "vm/object_store.h" |
| 7 #include "vm/snapshot.h" | 7 #include "vm/snapshot.h" |
| 8 #include "vm/stub_code.h" | 8 #include "vm/stub_code.h" |
| 9 #include "vm/symbols.h" | 9 #include "vm/symbols.h" |
| 10 #include "vm/visitor.h" | 10 #include "vm/visitor.h" |
| (...skipping 1885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 isolate->current_zone()->Alloc<CharacterType>(len); | 1896 isolate->current_zone()->Alloc<CharacterType>(len); |
| 1897 for (intptr_t i = 0; i < len; i++) { | 1897 for (intptr_t i = 0; i < len; i++) { |
| 1898 ptr[i] = reader->Read<CharacterType>(); | 1898 ptr[i] = reader->Read<CharacterType>(); |
| 1899 } | 1899 } |
| 1900 *str_obj ^= (*new_symbol)(ptr, len); | 1900 *str_obj ^= (*new_symbol)(ptr, len); |
| 1901 } else { | 1901 } else { |
| 1902 // Set up the string object. | 1902 // Set up the string object. |
| 1903 *str_obj = StringType::New(len, HEAP_SPACE(kind)); | 1903 *str_obj = StringType::New(len, HEAP_SPACE(kind)); |
| 1904 str_obj->set_tags(tags); | 1904 str_obj->set_tags(tags); |
| 1905 str_obj->SetHash(0); // Will get computed when needed. | 1905 str_obj->SetHash(0); // Will get computed when needed. |
| 1906 if (len == 0) { |
| 1907 return; |
| 1908 } |
| 1906 NoGCScope no_gc; | 1909 NoGCScope no_gc; |
| 1910 CharacterType* str_addr = StringType::CharAddr(*str_obj, 0); |
| 1907 for (intptr_t i = 0; i < len; i++) { | 1911 for (intptr_t i = 0; i < len; i++) { |
| 1908 *StringType::CharAddr(*str_obj, i) = reader->Read<CharacterType>(); | 1912 *str_addr = reader->Read<CharacterType>(); |
| 1913 str_addr++; |
| 1909 } | 1914 } |
| 1910 } | 1915 } |
| 1911 } | 1916 } |
| 1912 | 1917 |
| 1913 | 1918 |
| 1914 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, | 1919 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, |
| 1915 intptr_t object_id, | 1920 intptr_t object_id, |
| 1916 intptr_t tags, | 1921 intptr_t tags, |
| 1917 Snapshot::Kind kind) { | 1922 Snapshot::Kind kind) { |
| 1918 // Read the length so that we can determine instance size to allocate. | 1923 // Read the length so that we can determine instance size to allocate. |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 // We do not allow objects with native fields in an isolate message. | 2906 // We do not allow objects with native fields in an isolate message. |
| 2902 writer->SetWriteException(Exceptions::kArgument, | 2907 writer->SetWriteException(Exceptions::kArgument, |
| 2903 "Illegal argument in isolate message" | 2908 "Illegal argument in isolate message" |
| 2904 " : (object is a UserTag)"); | 2909 " : (object is a UserTag)"); |
| 2905 } else { | 2910 } else { |
| 2906 UNREACHABLE(); | 2911 UNREACHABLE(); |
| 2907 } | 2912 } |
| 2908 } | 2913 } |
| 2909 | 2914 |
| 2910 } // namespace dart | 2915 } // namespace dart |
| OLD | NEW |