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

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

Issue 167683002: Simplify type argument instantiation cache lookup by introducing an array (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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
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/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 446
447 TypeArguments& type_arguments = TypeArguments::ZoneHandle( 447 TypeArguments& type_arguments = TypeArguments::ZoneHandle(
448 reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind)); 448 reader->isolate(), NEW_OBJECT_WITH_LEN_SPACE(TypeArguments, len, kind));
449 reader->AddBackRef(object_id, &type_arguments, kIsDeserialized); 449 reader->AddBackRef(object_id, &type_arguments, kIsDeserialized);
450 450
451 // Set the instantiations field, which is only read from a full snapshot. 451 // Set the instantiations field, which is only read from a full snapshot.
452 if (kind == Snapshot::kFull) { 452 if (kind == Snapshot::kFull) {
453 *reader->ArrayHandle() ^= reader->ReadObjectImpl(); 453 *reader->ArrayHandle() ^= reader->ReadObjectImpl();
454 type_arguments.set_instantiations(*reader->ArrayHandle()); 454 type_arguments.set_instantiations(*reader->ArrayHandle());
455 } else { 455 } else {
456 // TODO(regis): Change to Object::zero_array() once supported. 456 type_arguments.set_instantiations(Object::zero_array());
457 type_arguments.set_instantiations(Object::empty_array());
458 } 457 }
459 458
460 // Now set all the type fields. 459 // Now set all the type fields.
461 for (intptr_t i = 0; i < len; i++) { 460 for (intptr_t i = 0; i < len; i++) {
462 *reader->TypeHandle() ^= reader->ReadObjectImpl(); 461 *reader->TypeHandle() ^= reader->ReadObjectImpl();
463 type_arguments.set_type_at(i, *reader->TypeHandle()); 462 type_arguments.set_type_at(i, *reader->TypeHandle());
464 } 463 }
465 464
466 // If object needs to be a canonical object, Canonicalize it. 465 // If object needs to be a canonical object, Canonicalize it.
467 // When reading a full snapshot we don't need to canonicalize the object 466 // When reading a full snapshot we don't need to canonicalize the object
(...skipping 2208 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 // We do not allow objects with native fields in an isolate message. 2675 // We do not allow objects with native fields in an isolate message.
2677 writer->SetWriteException(Exceptions::kArgument, 2676 writer->SetWriteException(Exceptions::kArgument,
2678 "Illegal argument in isolate message" 2677 "Illegal argument in isolate message"
2679 " : (object is a MirrorReference)"); 2678 " : (object is a MirrorReference)");
2680 } else { 2679 } else {
2681 UNREACHABLE(); 2680 UNREACHABLE();
2682 } 2681 }
2683 } 2682 }
2684 2683
2685 } // namespace dart 2684 } // namespace dart
OLDNEW
« runtime/vm/object.cc ('K') | « runtime/vm/object_test.cc ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698