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

Side by Side Diff: runtime/vm/raw_object_snapshot.cc

Issue 2952193002: VM: Speed up output of UTF8 for 1-byte strings.
Patch Set: Add test that would have caught bug pointed out by Slava Created 3 years, 2 months 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
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.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 #include "vm/native_entry.h" 5 #include "vm/native_entry.h"
6 #include "vm/object.h" 6 #include "vm/object.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/snapshot.h" 8 #include "vm/snapshot.h"
9 #include "vm/stub_code.h" 9 #include "vm/stub_code.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
1979 } 1979 }
1980 *str_obj ^= (*new_symbol)(reader->thread(), ptr, len); 1980 *str_obj ^= (*new_symbol)(reader->thread(), ptr, len);
1981 } else { 1981 } else {
1982 // Set up the string object. 1982 // Set up the string object.
1983 *str_obj = StringType::New(len, HEAP_SPACE(kind)); 1983 *str_obj = StringType::New(len, HEAP_SPACE(kind));
1984 str_obj->SetHash(0); // Will get computed when needed. 1984 str_obj->SetHash(0); // Will get computed when needed.
1985 if (len == 0) { 1985 if (len == 0) {
1986 return; 1986 return;
1987 } 1987 }
1988 NoSafepointScope no_safepoint; 1988 NoSafepointScope no_safepoint;
1989 CharacterType* str_addr = StringType::CharAddr(*str_obj, 0); 1989 CharacterType* str_addr = StringType::DataStart(*str_obj);
1990 for (intptr_t i = 0; i < len; i++) { 1990 for (intptr_t i = 0; i < len; i++) {
1991 *str_addr = reader->Read<CharacterType>(); 1991 *str_addr = reader->Read<CharacterType>();
1992 str_addr++; 1992 str_addr++;
1993 } 1993 }
1994 } 1994 }
1995 } 1995 }
1996 1996
1997 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader, 1997 RawOneByteString* OneByteString::ReadFrom(SnapshotReader* reader,
1998 intptr_t object_id, 1998 intptr_t object_id,
1999 intptr_t tags, 1999 intptr_t tags,
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2934 // We do not allow objects with native fields in an isolate message. 2934 // We do not allow objects with native fields in an isolate message.
2935 writer->SetWriteException(Exceptions::kArgument, 2935 writer->SetWriteException(Exceptions::kArgument,
2936 "Illegal argument in isolate message" 2936 "Illegal argument in isolate message"
2937 " : (object is a UserTag)"); 2937 " : (object is a UserTag)");
2938 } else { 2938 } else {
2939 UNREACHABLE(); 2939 UNREACHABLE();
2940 } 2940 }
2941 } 2941 }
2942 2942
2943 } // namespace dart 2943 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698