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

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

Issue 2490363002: Clean up encoding of size and single entry flag in Instructions. (Closed)
Patch Set: Created 4 years, 1 month 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.cc ('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/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 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 assembly_stream_.Print("Precompiled_%s_%" Pd ":\n", name, i); 807 assembly_stream_.Print("Precompiled_%s_%" Pd ":\n", name, i);
808 } else { 808 } else {
809 UNREACHABLE(); 809 UNREACHABLE();
810 } 810 }
811 811
812 { 812 {
813 // 3. Write from the entry point to the end. 813 // 3. Write from the entry point to the end.
814 NoSafepointScope no_safepoint; 814 NoSafepointScope no_safepoint;
815 uword beginning = reinterpret_cast<uword>(insns.raw()) - kHeapObjectTag; 815 uword beginning = reinterpret_cast<uword>(insns.raw()) - kHeapObjectTag;
816 uword entry = beginning + Instructions::HeaderSize(); 816 uword entry = beginning + Instructions::HeaderSize();
817 uword payload_size = insns.size(); 817 uword payload_size = insns.Size();
818 payload_size = Utils::RoundUp(payload_size, OS::PreferredCodeAlignment()); 818 payload_size = Utils::RoundUp(payload_size, OS::PreferredCodeAlignment());
819 uword end = entry + payload_size; 819 uword end = entry + payload_size;
820 820
821 ASSERT(Utils::IsAligned(beginning, sizeof(uint64_t))); 821 ASSERT(Utils::IsAligned(beginning, sizeof(uint64_t)));
822 ASSERT(Utils::IsAligned(entry, sizeof(uint64_t))); 822 ASSERT(Utils::IsAligned(entry, sizeof(uint64_t)));
823 ASSERT(Utils::IsAligned(end, sizeof(uint64_t))); 823 ASSERT(Utils::IsAligned(end, sizeof(uint64_t)));
824 824
825 for (uword* cursor = reinterpret_cast<uword*>(entry); 825 for (uword* cursor = reinterpret_cast<uword*>(entry);
826 cursor < reinterpret_cast<uword*>(end); cursor++) { 826 cursor < reinterpret_cast<uword*>(end); cursor++) {
827 WriteWordLiteralText(*cursor); 827 WriteWordLiteralText(*cursor);
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
938 cursor < reinterpret_cast<uword*>(entry); cursor++) { 938 cursor < reinterpret_cast<uword*>(entry); cursor++) {
939 instructions_blob_stream_.WriteWord(*cursor); 939 instructions_blob_stream_.WriteWord(*cursor);
940 } 940 }
941 } 941 }
942 942
943 // 2. Write from the entry point to the end. 943 // 2. Write from the entry point to the end.
944 { 944 {
945 NoSafepointScope no_safepoint; 945 NoSafepointScope no_safepoint;
946 uword beginning = reinterpret_cast<uword>(insns.raw()) - kHeapObjectTag; 946 uword beginning = reinterpret_cast<uword>(insns.raw()) - kHeapObjectTag;
947 uword entry = beginning + Instructions::HeaderSize(); 947 uword entry = beginning + Instructions::HeaderSize();
948 uword payload_size = insns.size(); 948 uword payload_size = insns.Size();
949 payload_size = Utils::RoundUp(payload_size, OS::PreferredCodeAlignment()); 949 payload_size = Utils::RoundUp(payload_size, OS::PreferredCodeAlignment());
950 uword end = entry + payload_size; 950 uword end = entry + payload_size;
951 951
952 ASSERT(Utils::IsAligned(beginning, sizeof(uint64_t))); 952 ASSERT(Utils::IsAligned(beginning, sizeof(uint64_t)));
953 ASSERT(Utils::IsAligned(entry, sizeof(uint64_t))); 953 ASSERT(Utils::IsAligned(entry, sizeof(uint64_t)));
954 ASSERT(Utils::IsAligned(end, sizeof(uint64_t))); 954 ASSERT(Utils::IsAligned(end, sizeof(uint64_t)));
955 955
956 for (uword* cursor = reinterpret_cast<uword*>(entry); 956 for (uword* cursor = reinterpret_cast<uword*>(entry);
957 cursor < reinterpret_cast<uword*>(end); cursor++) { 957 cursor < reinterpret_cast<uword*>(end); cursor++) {
958 instructions_blob_stream_.WriteWord(*cursor); 958 instructions_blob_stream_.WriteWord(*cursor);
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 if (setjmp(*jump.Set()) == 0) { 1956 if (setjmp(*jump.Set()) == 0) {
1957 NoSafepointScope no_safepoint; 1957 NoSafepointScope no_safepoint;
1958 WriteObject(obj.raw()); 1958 WriteObject(obj.raw());
1959 } else { 1959 } else {
1960 ThrowException(exception_type(), exception_msg()); 1960 ThrowException(exception_type(), exception_msg());
1961 } 1961 }
1962 } 1962 }
1963 1963
1964 1964
1965 } // namespace dart 1965 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698