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

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

Issue 2416973003: Reapply "Use a single file for app snapshots." (Closed)
Patch Set: sync Created 4 years, 2 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
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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after
697 if (((c >= 'a') && (c <= 'z')) || 697 if (((c >= 'a') && (c <= 'z')) ||
698 ((c >= 'A') && (c <= 'Z')) || 698 ((c >= 'A') && (c <= 'Z')) ||
699 ((c >= '0') && (c <= '9'))) { 699 ((c >= '0') && (c <= '9'))) {
700 continue; 700 continue;
701 } 701 }
702 *label = '_'; 702 *label = '_';
703 } 703 }
704 } 704 }
705 705
706 706
707 void AssemblyInstructionsWriter::Write() { 707 void AssemblyInstructionsWriter::Write(uint8_t* vmisolate_buffer,
708 intptr_t vmisolate_length,
709 uint8_t* isolate_buffer,
710 intptr_t isolate_length) {
708 Thread* thread = Thread::Current(); 711 Thread* thread = Thread::Current();
709 Zone* zone = thread->zone(); 712 Zone* zone = thread->zone();
710 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, 713 NOT_IN_PRODUCT(TimelineDurationScope tds(thread,
711 Timeline::GetIsolateStream(), "WriteInstructions")); 714 Timeline::GetIsolateStream(), "WriteInstructions"));
712 715
713 // Handlify collected raw pointers as building the names below 716 // Handlify collected raw pointers as building the names below
714 // will allocate on the Dart heap. 717 // will allocate on the Dart heap.
715 for (intptr_t i = 0; i < instructions_.length(); i++) { 718 for (intptr_t i = 0; i < instructions_.length(); i++) {
716 InstructionsData& data = instructions_[i]; 719 InstructionsData& data = instructions_[i];
717 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); 720 data.insns_ = &Instructions::Handle(zone, data.raw_insns_);
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); 845 marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags);
843 marked_tags = RawObject::MarkBit::update(true, marked_tags); 846 marked_tags = RawObject::MarkBit::update(true, marked_tags);
844 WriteWordLiteralData(marked_tags); 847 WriteWordLiteralData(marked_tags);
845 start += sizeof(uword); 848 start += sizeof(uword);
846 for (uword* cursor = reinterpret_cast<uword*>(start); 849 for (uword* cursor = reinterpret_cast<uword*>(start);
847 cursor < reinterpret_cast<uword*>(end); 850 cursor < reinterpret_cast<uword*>(end);
848 cursor++) { 851 cursor++) {
849 WriteWordLiteralData(*cursor); 852 WriteWordLiteralData(*cursor);
850 } 853 }
851 } 854 }
855
856
857 assembly_stream_.Print(".globl _kVmIsolateSnapshot\n");
858 assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
859 assembly_stream_.Print("_kVmIsolateSnapshot:\n");
860 for (intptr_t i = 0; i < vmisolate_length; i++) {
861 assembly_stream_.Print(".byte %" Pd "\n", vmisolate_buffer[i]);
862 }
863
864 assembly_stream_.Print(".globl _kIsolateSnapshot\n");
865 assembly_stream_.Print(".balign %" Pd ", 0\n", VirtualMemory::PageSize());
866 assembly_stream_.Print("_kIsolateSnapshot:\n");
867 for (intptr_t i = 0; i < isolate_length; i++) {
868 assembly_stream_.Print(".byte %" Pd "\n", isolate_buffer[i]);
869 }
852 } 870 }
853 871
854 872
855 void BlobInstructionsWriter::Write() { 873 void BlobInstructionsWriter::Write(uint8_t* vmisolate_buffer,
874 intptr_t vmisolate_len,
875 uint8_t* isolate_buffer,
876 intptr_t isolate_length) {
856 Thread* thread = Thread::Current(); 877 Thread* thread = Thread::Current();
857 Zone* zone = thread->zone(); 878 Zone* zone = thread->zone();
858 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, 879 NOT_IN_PRODUCT(TimelineDurationScope tds(thread,
859 Timeline::GetIsolateStream(), "WriteInstructions")); 880 Timeline::GetIsolateStream(), "WriteInstructions"));
860 881
861 // Handlify collected raw pointers as building the names below 882 // Handlify collected raw pointers as building the names below
862 // will allocate on the Dart heap. 883 // will allocate on the Dart heap.
863 for (intptr_t i = 0; i < instructions_.length(); i++) { 884 for (intptr_t i = 0; i < instructions_.length(); i++) {
864 InstructionsData& data = instructions_[i]; 885 InstructionsData& data = instructions_[i];
865 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); 886 data.insns_ = &Instructions::Handle(zone, data.raw_insns_);
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1935 if (setjmp(*jump.Set()) == 0) { 1956 if (setjmp(*jump.Set()) == 0) {
1936 NoSafepointScope no_safepoint; 1957 NoSafepointScope no_safepoint;
1937 WriteObject(obj.raw()); 1958 WriteObject(obj.raw());
1938 } else { 1959 } else {
1939 ThrowException(exception_type(), exception_msg()); 1960 ThrowException(exception_type(), exception_msg());
1940 } 1961 }
1941 } 1962 }
1942 1963
1943 1964
1944 } // namespace dart 1965 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698