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

Side by Side Diff: vm/raw_object_snapshot.cc

Issue 10414005: Remove script source from the snapshot in order to reduce the size and to make the image size small… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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/visitor.h" 9 #include "vm/visitor.h"
10 10
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 // Allocate script object. 635 // Allocate script object.
636 Script& script = Script::ZoneHandle(reader->isolate(), NEW_OBJECT(Script)); 636 Script& script = Script::ZoneHandle(reader->isolate(), NEW_OBJECT(Script));
637 reader->AddBackwardReference(object_id, &script); 637 reader->AddBackwardReference(object_id, &script);
638 638
639 // Set the object tags. 639 // Set the object tags.
640 script.set_tags(tags); 640 script.set_tags(tags);
641 641
642 // Set all the object fields. 642 // Set all the object fields.
643 // TODO(5411462): Need to assert No GC can happen here, even though 643 // TODO(5411462): Need to assert No GC can happen here, even though
644 // allocations may happen. 644 // allocations may happen.
645 intptr_t num_flds = (script.raw()->to() - script.raw()->from()); 645 *reader->StringHandle() ^= reader->ReadObject();
646 for (intptr_t i = 0; i <= num_flds; i++) { 646 script.set_url(*reader->StringHandle());
647 *(script.raw()->from() + i) = reader->ReadObject(); 647 *reader->StringHandle() ^= String::null();
648 } 648 script.set_source(*reader->StringHandle());
649 TokenStream& stream = TokenStream::Handle();
650 stream ^= reader->ReadObject();
651 script.set_tokens(stream);
649 652
650 return script.raw(); 653 return script.raw();
651 } 654 }
652 655
653 656
654 void RawScript::WriteTo(SnapshotWriter* writer, 657 void RawScript::WriteTo(SnapshotWriter* writer,
655 intptr_t object_id, 658 intptr_t object_id,
656 Snapshot::Kind kind) { 659 Snapshot::Kind kind) {
657 ASSERT(writer != NULL); 660 ASSERT(writer != NULL);
658 ASSERT(tokens_ != TokenStream::null()); 661 ASSERT(tokens_ != TokenStream::null());
659 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot()); 662 ASSERT(kind != Snapshot::kMessage && !IsCreatedFromSnapshot());
660 663
661 // Write out the serialization header value for this object. 664 // Write out the serialization header value for this object.
662 writer->WriteSerializationMarker(kInlined, object_id); 665 writer->WriteSerializationMarker(kInlined, object_id);
663 666
664 // Write out the class and tags information. 667 // Write out the class and tags information.
665 writer->WriteObjectHeader(Object::kScriptClass, ptr()->tags_); 668 writer->WriteObjectHeader(Object::kScriptClass, ptr()->tags_);
666 669
667 // Write out all the object pointer fields. 670 // Write out all the object pointer fields.
668 SnapshotWriterVisitor visitor(writer); 671 writer->WriteObject(ptr()->url_);
669 visitor.VisitPointers(from(), to()); 672 writer->WriteObject(ptr()->tokens_);
670 } 673 }
671 674
672 675
673 RawLibrary* Library::ReadFrom(SnapshotReader* reader, 676 RawLibrary* Library::ReadFrom(SnapshotReader* reader,
674 intptr_t object_id, 677 intptr_t object_id,
675 intptr_t tags, 678 intptr_t tags,
676 Snapshot::Kind kind) { 679 Snapshot::Kind kind) {
677 ASSERT(reader != NULL); 680 ASSERT(reader != NULL);
678 ASSERT(kind != Snapshot::kMessage); 681 ASSERT(kind != Snapshot::kMessage);
679 682
(...skipping 1700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2380 writer->Write<RawObject*>(ptr()->num_bracket_expressions_); 2383 writer->Write<RawObject*>(ptr()->num_bracket_expressions_);
2381 writer->WriteObject(ptr()->pattern_); 2384 writer->WriteObject(ptr()->pattern_);
2382 writer->WriteIntptrValue(ptr()->type_); 2385 writer->WriteIntptrValue(ptr()->type_);
2383 writer->WriteIntptrValue(ptr()->flags_); 2386 writer->WriteIntptrValue(ptr()->flags_);
2384 2387
2385 // Do not write out the data part which is native. 2388 // Do not write out the data part which is native.
2386 } 2389 }
2387 2390
2388 2391
2389 } // namespace dart 2392 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.cc ('k') | vm/snapshot_test.cc » ('j') | vm/snapshot_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698