OLD | NEW |
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 Loading... |
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(uint8_t* vmisolate_buffer, | 707 void AssemblyInstructionsWriter::Write() { |
708 intptr_t vmisolate_length, | |
709 uint8_t* isolate_buffer, | |
710 intptr_t isolate_length) { | |
711 Thread* thread = Thread::Current(); | 708 Thread* thread = Thread::Current(); |
712 Zone* zone = thread->zone(); | 709 Zone* zone = thread->zone(); |
713 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, | 710 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, |
714 Timeline::GetIsolateStream(), "WriteInstructions")); | 711 Timeline::GetIsolateStream(), "WriteInstructions")); |
715 | 712 |
716 // Handlify collected raw pointers as building the names below | 713 // Handlify collected raw pointers as building the names below |
717 // will allocate on the Dart heap. | 714 // will allocate on the Dart heap. |
718 for (intptr_t i = 0; i < instructions_.length(); i++) { | 715 for (intptr_t i = 0; i < instructions_.length(); i++) { |
719 InstructionsData& data = instructions_[i]; | 716 InstructionsData& data = instructions_[i]; |
720 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); | 717 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); | 842 marked_tags = RawObject::VMHeapObjectTag::update(true, marked_tags); |
846 marked_tags = RawObject::MarkBit::update(true, marked_tags); | 843 marked_tags = RawObject::MarkBit::update(true, marked_tags); |
847 WriteWordLiteralData(marked_tags); | 844 WriteWordLiteralData(marked_tags); |
848 start += sizeof(uword); | 845 start += sizeof(uword); |
849 for (uword* cursor = reinterpret_cast<uword*>(start); | 846 for (uword* cursor = reinterpret_cast<uword*>(start); |
850 cursor < reinterpret_cast<uword*>(end); | 847 cursor < reinterpret_cast<uword*>(end); |
851 cursor++) { | 848 cursor++) { |
852 WriteWordLiteralData(*cursor); | 849 WriteWordLiteralData(*cursor); |
853 } | 850 } |
854 } | 851 } |
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 } | |
870 } | 852 } |
871 | 853 |
872 | 854 |
873 void BlobInstructionsWriter::Write(uint8_t* vmisolate_buffer, | 855 void BlobInstructionsWriter::Write() { |
874 intptr_t vmisolate_len, | |
875 uint8_t* isolate_buffer, | |
876 intptr_t isolate_length) { | |
877 Thread* thread = Thread::Current(); | 856 Thread* thread = Thread::Current(); |
878 Zone* zone = thread->zone(); | 857 Zone* zone = thread->zone(); |
879 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, | 858 NOT_IN_PRODUCT(TimelineDurationScope tds(thread, |
880 Timeline::GetIsolateStream(), "WriteInstructions")); | 859 Timeline::GetIsolateStream(), "WriteInstructions")); |
881 | 860 |
882 // Handlify collected raw pointers as building the names below | 861 // Handlify collected raw pointers as building the names below |
883 // will allocate on the Dart heap. | 862 // will allocate on the Dart heap. |
884 for (intptr_t i = 0; i < instructions_.length(); i++) { | 863 for (intptr_t i = 0; i < instructions_.length(); i++) { |
885 InstructionsData& data = instructions_[i]; | 864 InstructionsData& data = instructions_[i]; |
886 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); | 865 data.insns_ = &Instructions::Handle(zone, data.raw_insns_); |
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1956 if (setjmp(*jump.Set()) == 0) { | 1935 if (setjmp(*jump.Set()) == 0) { |
1957 NoSafepointScope no_safepoint; | 1936 NoSafepointScope no_safepoint; |
1958 WriteObject(obj.raw()); | 1937 WriteObject(obj.raw()); |
1959 } else { | 1938 } else { |
1960 ThrowException(exception_type(), exception_msg()); | 1939 ThrowException(exception_type(), exception_msg()); |
1961 } | 1940 } |
1962 } | 1941 } |
1963 | 1942 |
1964 | 1943 |
1965 } // namespace dart | 1944 } // namespace dart |
OLD | NEW |