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

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

Issue 2481013006: Check that Dart_CreateIsolate is given a correct kind of snapshot. (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/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 return kBoolType; 125 return kBoolType;
126 } else if (raw_type == object_store->string_type()) { 126 } else if (raw_type == object_store->string_type()) {
127 return kStringType; 127 return kStringType;
128 } else if (raw_type == object_store->array_type()) { 128 } else if (raw_type == object_store->array_type()) {
129 return kArrayType; 129 return kArrayType;
130 } 130 }
131 return kInvalidIndex; 131 return kInvalidIndex;
132 } 132 }
133 133
134 134
135 const char* Snapshot::KindToCString(Kind kind) {
136 switch (kind) {
137 case kCore: return "core";
138 case kScript: return "script";
139 case kMessage: return "message";
140 case kAppWithJIT: return "app-jit";
141 case kAppNoJIT: return "app-aot";
142 case kNone: return "none";
143 case kInvalid:
144 default:
145 return "invalid";
146 }
147 }
148
149
135 // TODO(5411462): Temporary setup of snapshot for testing purposes, 150 // TODO(5411462): Temporary setup of snapshot for testing purposes,
136 // the actual creation of a snapshot maybe done differently. 151 // the actual creation of a snapshot maybe done differently.
137 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) { 152 const Snapshot* Snapshot::SetupFromBuffer(const void* raw_memory) {
138 ASSERT(raw_memory != NULL); 153 ASSERT(raw_memory != NULL);
139 ASSERT(kHeaderSize == sizeof(Snapshot)); 154 ASSERT(kHeaderSize == sizeof(Snapshot));
140 ASSERT(kLengthIndex == length_offset()); 155 ASSERT(kLengthIndex == length_offset());
141 ASSERT((kSnapshotFlagIndex * sizeof(int64_t)) == kind_offset()); 156 ASSERT((kSnapshotFlagIndex * sizeof(int64_t)) == kind_offset());
142 ASSERT((kHeapObjectTag & kInlined)); 157 ASSERT((kHeapObjectTag & kInlined));
143 const Snapshot* snapshot = reinterpret_cast<const Snapshot*>(raw_memory); 158 const Snapshot* snapshot = reinterpret_cast<const Snapshot*>(raw_memory);
144 // If the raw length is negative or greater than what the local machine can 159 // If the raw length is negative or greater than what the local machine can
(...skipping 1811 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 if (setjmp(*jump.Set()) == 0) { 1971 if (setjmp(*jump.Set()) == 0) {
1957 NoSafepointScope no_safepoint; 1972 NoSafepointScope no_safepoint;
1958 WriteObject(obj.raw()); 1973 WriteObject(obj.raw());
1959 } else { 1974 } else {
1960 ThrowException(exception_type(), exception_msg()); 1975 ThrowException(exception_type(), exception_msg());
1961 } 1976 }
1962 } 1977 }
1963 1978
1964 1979
1965 } // namespace dart 1980 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/snapshot.h ('k') | runtime/vm/snapshot_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698