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

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

Issue 2902313004: CoreJIT snapshots without training. (Closed)
Patch Set: . Created 3 years, 6 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 #ifndef RUNTIME_VM_SNAPSHOT_H_ 5 #ifndef RUNTIME_VM_SNAPSHOT_H_
6 #define RUNTIME_VM_SNAPSHOT_H_ 6 #define RUNTIME_VM_SNAPSHOT_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/bitfield.h" 10 #include "vm/bitfield.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 148
149 // Structure capturing the raw snapshot. 149 // Structure capturing the raw snapshot.
150 // 150 //
151 // TODO(turnidge): Remove this class once the snapshot does not have a 151 // TODO(turnidge): Remove this class once the snapshot does not have a
152 // header anymore. This is pending on making the embedder pass in the 152 // header anymore. This is pending on making the embedder pass in the
153 // length of their snapshot. 153 // length of their snapshot.
154 class Snapshot { 154 class Snapshot {
155 public: 155 public:
156 enum Kind { 156 enum Kind {
157 kCore = 0, // Full snapshot of core libraries. No root library, no code. 157 // N.B. The order of these values must be preserved to give proper error
158 // messages for old snapshots.
159 kFull = 0, // Full snapshot of core libraries or an application.
158 kScript, // A partial snapshot of only the application script. 160 kScript, // A partial snapshot of only the application script.
159 kMessage, // A partial snapshot used only for isolate messaging. 161 kMessage, // A partial snapshot used only for isolate messaging.
160 kAppJIT, // Full snapshot of core libraries and application. Has some 162 kFullJIT, // Full + JIT code
161 // code, but may compile in the future because we haven't 163 kFullAOT, // Full + AOT code
162 // necessarily included code for every function or to
163 // (de)optimize.
164 kAppAOT, // Full snapshot of core libraries and application. Has
165 // complete code for the application that never deopts. Will
166 // not compile in the future.
167 kNone, // dart_bootstrap/gen_snapshot 164 kNone, // dart_bootstrap/gen_snapshot
168 kInvalid 165 kInvalid
169 }; 166 };
170 static const char* KindToCString(Kind kind); 167 static const char* KindToCString(Kind kind);
171 168
172 static const int kHeaderSize = 2 * sizeof(int64_t); 169 static const int kHeaderSize = 2 * sizeof(int64_t);
173 static const int kLengthIndex = 0; 170 static const int kLengthIndex = 0;
174 static const int kSnapshotFlagIndex = 1; 171 static const int kSnapshotFlagIndex = 1;
175 172
176 static const Snapshot* SetupFromBuffer(const void* raw_memory); 173 static const Snapshot* SetupFromBuffer(const void* raw_memory);
177 174
178 // Getters. 175 // Getters.
179 const uint8_t* content() const { OPEN_ARRAY_START(uint8_t, uint8_t); } 176 const uint8_t* content() const { OPEN_ARRAY_START(uint8_t, uint8_t); }
180 intptr_t length() const { 177 intptr_t length() const {
181 return static_cast<intptr_t>(ReadUnaligned(&unaligned_length_)); 178 return static_cast<intptr_t>(ReadUnaligned(&unaligned_length_));
182 } 179 }
183 Kind kind() const { 180 Kind kind() const {
184 return static_cast<Kind>(ReadUnaligned(&unaligned_kind_)); 181 return static_cast<Kind>(ReadUnaligned(&unaligned_kind_));
185 } 182 }
186 183
187 static bool IsFull(Kind kind) { 184 static bool IsFull(Kind kind) {
188 return (kind == kCore) || (kind == kAppJIT) || (kind == kAppAOT); 185 return (kind == kFull) || (kind == kFullJIT) || (kind == kFullAOT);
189 } 186 }
190 static bool IncludesCode(Kind kind) { 187 static bool IncludesCode(Kind kind) {
191 return (kind == kAppJIT) || (kind == kAppAOT); 188 return (kind == kFullJIT) || (kind == kFullAOT);
192 } 189 }
193 190
194 const uint8_t* Addr() const { return reinterpret_cast<const uint8_t*>(this); } 191 const uint8_t* Addr() const { return reinterpret_cast<const uint8_t*>(this); }
195 192
196 static intptr_t length_offset() { 193 static intptr_t length_offset() {
197 return OFFSET_OF(Snapshot, unaligned_length_); 194 return OFFSET_OF(Snapshot, unaligned_length_);
198 } 195 }
199 static intptr_t kind_offset() { return OFFSET_OF(Snapshot, unaligned_kind_); } 196 static intptr_t kind_offset() { return OFFSET_OF(Snapshot, unaligned_kind_); }
200 197
201 private: 198 private:
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1013 private: 1010 private:
1014 SnapshotWriter* writer_; 1011 SnapshotWriter* writer_;
1015 bool as_references_; 1012 bool as_references_;
1016 1013
1017 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor); 1014 DISALLOW_COPY_AND_ASSIGN(SnapshotWriterVisitor);
1018 }; 1015 };
1019 1016
1020 } // namespace dart 1017 } // namespace dart
1021 1018
1022 #endif // RUNTIME_VM_SNAPSHOT_H_ 1019 #endif // RUNTIME_VM_SNAPSHOT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698