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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 10823269: - Improve generated sources: (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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/object_test.cc ('k') | vm/snapshot_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/symbols.h"
10 #include "vm/visitor.h" 10 #include "vm/visitor.h"
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 // Read the stream of tokens into the TokenStream object. 611 // Read the stream of tokens into the TokenStream object.
612 { 612 {
613 NoGCScope no_gc; 613 NoGCScope no_gc;
614 reader->ReadBytes(reinterpret_cast<uint8_t*>(token_stream.EntryAddr(0)), 614 reader->ReadBytes(reinterpret_cast<uint8_t*>(token_stream.EntryAddr(0)),
615 len); 615 len);
616 } 616 }
617 617
618 // Read in the literal/identifier token array. 618 // Read in the literal/identifier token array.
619 *(reader->TokensHandle()) ^= reader->ReadObjectImpl(); 619 *(reader->TokensHandle()) ^= reader->ReadObjectImpl();
620 token_stream.SetTokenObjects(*(reader->TokensHandle())); 620 token_stream.SetTokenObjects(*(reader->TokensHandle()));
621 // Rean in the private key in use by the token stream.
hausner 2012/08/10 16:13:01 Rean -> Read
Ivan Posva 2012/08/10 16:57:20 Done.
622 *(reader->StringHandle()) ^= reader->ReadObjectImpl();
623 token_stream.SetPrivateKey(*(reader->StringHandle()));
621 624
622 return token_stream.raw(); 625 return token_stream.raw();
623 } 626 }
624 627
625 628
626 void RawTokenStream::WriteTo(SnapshotWriter* writer, 629 void RawTokenStream::WriteTo(SnapshotWriter* writer,
627 intptr_t object_id, 630 intptr_t object_id,
628 Snapshot::Kind kind) { 631 Snapshot::Kind kind) {
629 ASSERT(writer != NULL); 632 ASSERT(writer != NULL);
630 ASSERT(kind != Snapshot::kMessage && 633 ASSERT(kind != Snapshot::kMessage &&
631 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this))); 634 !RawObject::IsCreatedFromSnapshot(writer->GetObjectTags(this)));
632 635
633 // Write out the serialization header value for this object. 636 // Write out the serialization header value for this object.
634 writer->WriteSerializationMarker(kInlined, object_id); 637 writer->WriteSerializationMarker(kInlined, object_id);
635 638
636 // Write out the class and tags information. 639 // Write out the class and tags information.
637 writer->WriteObjectHeader(Object::kTokenStreamClass, 640 writer->WriteObjectHeader(Object::kTokenStreamClass,
638 writer->GetObjectTags(this)); 641 writer->GetObjectTags(this));
639 642
640 // Write out the length field and the token stream. 643 // Write out the length field and the token stream.
641 intptr_t len = Smi::Value(ptr()->length_); 644 intptr_t len = Smi::Value(ptr()->length_);
642 writer->Write<RawObject*>(ptr()->length_); 645 writer->Write<RawObject*>(ptr()->length_);
643 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len); 646 writer->WriteBytes(reinterpret_cast<uint8_t*>(ptr()->data_), len);
644 647
645 // Write out the literal/identifier token array. 648 // Write out the literal/identifier token array.
646 writer->WriteObjectImpl(ptr()->token_objects_); 649 writer->WriteObjectImpl(ptr()->token_objects_);
650 // Write out the private key in use by the token stream.
651 writer->WriteObjectImpl(ptr()->private_key_);
647 } 652 }
648 653
649 654
650 RawScript* Script::ReadFrom(SnapshotReader* reader, 655 RawScript* Script::ReadFrom(SnapshotReader* reader,
651 intptr_t object_id, 656 intptr_t object_id,
652 intptr_t tags, 657 intptr_t tags,
653 Snapshot::Kind kind) { 658 Snapshot::Kind kind) {
654 ASSERT(reader != NULL); 659 ASSERT(reader != NULL);
655 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags)); 660 ASSERT(kind != Snapshot::kMessage && !RawObject::IsCreatedFromSnapshot(tags));
656 661
(...skipping 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after
2008 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2013 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2009 writer->WriteObjectImpl(ptr()->pattern_); 2014 writer->WriteObjectImpl(ptr()->pattern_);
2010 writer->WriteIntptrValue(ptr()->type_); 2015 writer->WriteIntptrValue(ptr()->type_);
2011 writer->WriteIntptrValue(ptr()->flags_); 2016 writer->WriteIntptrValue(ptr()->flags_);
2012 2017
2013 // Do not write out the data part which is native. 2018 // Do not write out the data part which is native.
2014 } 2019 }
2015 2020
2016 2021
2017 } // namespace dart 2022 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object_test.cc ('k') | vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698