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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 10783035: Create frequently used symbols in the vm isolate (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « vm/parser_test.cc ('k') | vm/resolver_test.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/bigint_operations.h" 5 #include "vm/bigint_operations.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/symbols.h"
9 #include "vm/visitor.h" 10 #include "vm/visitor.h"
10 11
11 namespace dart { 12 namespace dart {
12 13
13 #define NEW_OBJECT(type) \ 14 #define NEW_OBJECT(type) \
14 ((kind == Snapshot::kFull) ? reader->New##type() : type::New()) 15 ((kind == Snapshot::kFull) ? reader->New##type() : type::New())
15 16
16 #define NEW_OBJECT_WITH_LEN(type, len) \ 17 #define NEW_OBJECT_WITH_LEN(type, len) \
17 ((kind == Snapshot::kFull) ? reader->New##type(len) : type::New(len)) 18 ((kind == Snapshot::kFull) ? reader->New##type(len) : type::New(len))
18 19
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 intptr_t len, 1355 intptr_t len,
1355 intptr_t tags) { 1356 intptr_t tags) {
1356 ASSERT(reader != NULL); 1357 ASSERT(reader != NULL);
1357 if (RawObject::IsCanonical(tags)) { 1358 if (RawObject::IsCanonical(tags)) {
1358 // Set up canonical string object. 1359 // Set up canonical string object.
1359 ASSERT(reader != NULL); 1360 ASSERT(reader != NULL);
1360 CharacterType* ptr = reinterpret_cast<CharacterType*>(ZoneAllocator(len)); 1361 CharacterType* ptr = reinterpret_cast<CharacterType*>(ZoneAllocator(len));
1361 for (intptr_t i = 0; i < len; i++) { 1362 for (intptr_t i = 0; i < len; i++) {
1362 ptr[i] = reader->Read<CharacterType>(); 1363 ptr[i] = reader->Read<CharacterType>();
1363 } 1364 }
1364 *str_obj ^= String::NewSymbol(ptr, len); 1365 *str_obj ^= Symbols::New(ptr, len);
1365 } else { 1366 } else {
1366 // Set up the string object. 1367 // Set up the string object.
1367 *str_obj = HandleType::New(len, Heap::kNew); 1368 *str_obj = HandleType::New(len, Heap::kNew);
1368 str_obj->set_tags(tags); 1369 str_obj->set_tags(tags);
1369 str_obj->SetHash(0); // Will get computed when needed. 1370 str_obj->SetHash(0); // Will get computed when needed.
1370 for (intptr_t i = 0; i < len; i++) { 1371 for (intptr_t i = 0; i < len; i++) {
1371 *str_obj->CharAddr(i) = reader->Read<CharacterType>(); 1372 *str_obj->CharAddr(i) = reader->Read<CharacterType>();
1372 } 1373 }
1373 } 1374 }
1374 } 1375 }
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 1987 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
1987 writer->WriteObjectImpl(ptr()->pattern_); 1988 writer->WriteObjectImpl(ptr()->pattern_);
1988 writer->WriteIntptrValue(ptr()->type_); 1989 writer->WriteIntptrValue(ptr()->type_);
1989 writer->WriteIntptrValue(ptr()->flags_); 1990 writer->WriteIntptrValue(ptr()->flags_);
1990 1991
1991 // Do not write out the data part which is native. 1992 // Do not write out the data part which is native.
1992 } 1993 }
1993 1994
1994 1995
1995 } // namespace dart 1996 } // namespace dart
OLDNEW
« no previous file with comments | « vm/parser_test.cc ('k') | vm/resolver_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698