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

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

Issue 2598623002: Cache hash code for closures. (Closed)
Patch Set: remove redundant assertion Created 4 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
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | 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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 bool as_reference) { 583 bool as_reference) {
584 ASSERT(reader != NULL); 584 ASSERT(reader != NULL);
585 ASSERT(kind == Snapshot::kScript); 585 ASSERT(kind == Snapshot::kScript);
586 586
587 // Allocate closure data object. 587 // Allocate closure data object.
588 ClosureData& data = 588 ClosureData& data =
589 ClosureData::ZoneHandle(reader->zone(), ClosureData::New()); 589 ClosureData::ZoneHandle(reader->zone(), ClosureData::New());
590 reader->AddBackRef(object_id, &data, kIsDeserialized); 590 reader->AddBackRef(object_id, &data, kIsDeserialized);
591 591
592 // Set all the object fields. 592 // Set all the object fields.
593 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to(), 593 // Cached hash is null-initialized by ClosureData::New()
594 READ_OBJECT_FIELDS(data, data.raw()->from(), data.raw()->to_snapshot(),
594 kAsInlinedObject); 595 kAsInlinedObject);
595 596
596 return data.raw(); 597 return data.raw();
597 } 598 }
598 599
599 600
600 void RawClosureData::WriteTo(SnapshotWriter* writer, 601 void RawClosureData::WriteTo(SnapshotWriter* writer,
601 intptr_t object_id, 602 intptr_t object_id,
602 Snapshot::Kind kind, 603 Snapshot::Kind kind,
603 bool as_reference) { 604 bool as_reference) {
(...skipping 2445 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 // We do not allow objects with native fields in an isolate message. 3050 // We do not allow objects with native fields in an isolate message.
3050 writer->SetWriteException(Exceptions::kArgument, 3051 writer->SetWriteException(Exceptions::kArgument,
3051 "Illegal argument in isolate message" 3052 "Illegal argument in isolate message"
3052 " : (object is a UserTag)"); 3053 " : (object is a UserTag)");
3053 } else { 3054 } else {
3054 UNREACHABLE(); 3055 UNREACHABLE();
3055 } 3056 }
3056 } 3057 }
3057 3058
3058 } // namespace dart 3059 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698