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

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

Issue 10829444: Avoid trusting the length encoded in the Snapshot if there is an (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/dart_api_impl.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/dart.h" 5 #include "vm/dart.h"
6 6
7 #include "vm/dart_api_state.h" 7 #include "vm/dart_api_state.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/freelist.h" 9 #include "vm/freelist.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 134
135 if (snapshot_buffer == NULL) { 135 if (snapshot_buffer == NULL) {
136 const Error& error = Error::Handle(Object::Init(isolate)); 136 const Error& error = Error::Handle(Object::Init(isolate));
137 if (!error.IsNull()) { 137 if (!error.IsNull()) {
138 return error.raw(); 138 return error.raw();
139 } 139 }
140 } else { 140 } else {
141 // Initialize from snapshot (this should replicate the functionality 141 // Initialize from snapshot (this should replicate the functionality
142 // of Object::Init(..) in a regular isolate creation path. 142 // of Object::Init(..) in a regular isolate creation path.
143 Object::InitFromSnapshot(isolate); 143 Object::InitFromSnapshot(isolate);
144
145 // TODO(turnidge): Remove once length is not part of the snapshot.
144 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); 146 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer);
147 ASSERT(snapshot->kind() == Snapshot::kFull);
145 if (FLAG_trace_isolates) { 148 if (FLAG_trace_isolates) {
146 OS::Print("Size of isolate snapshot = %ld\n", snapshot->length()); 149 OS::Print("Size of isolate snapshot = %ld\n", snapshot->length());
147 } 150 }
148 SnapshotReader reader(snapshot, isolate); 151 SnapshotReader reader(snapshot->content(), snapshot->length(),
152 Snapshot::kFull, isolate);
149 reader.ReadFullSnapshot(); 153 reader.ReadFullSnapshot();
150 if (FLAG_trace_isolates) { 154 if (FLAG_trace_isolates) {
151 isolate->heap()->PrintSizes(); 155 isolate->heap()->PrintSizes();
152 } 156 }
153 if (FLAG_print_bootstrap) { 157 if (FLAG_print_bootstrap) {
154 PrintLibrarySources(isolate); 158 PrintLibrarySources(isolate);
155 } 159 }
156 } 160 }
157 161
158 StubCode::Init(isolate); 162 StubCode::Init(isolate);
(...skipping 12 matching lines...) Expand all
171 isolate->Shutdown(); 175 isolate->Shutdown();
172 delete isolate; 176 delete isolate;
173 177
174 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); 178 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback();
175 if (callback != NULL) { 179 if (callback != NULL) {
176 (callback)(callback_data); 180 (callback)(callback_data);
177 } 181 }
178 } 182 }
179 183
180 } // namespace dart 184 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/isolate.cc ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698