| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_observers.h" | 7 #include "vm/code_observers.h" |
| 8 #include "vm/cpu.h" | 8 #include "vm/cpu.h" |
| 9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 if (!error.IsNull()) { | 225 if (!error.IsNull()) { |
| 226 return error.raw(); | 226 return error.raw(); |
| 227 } | 227 } |
| 228 } else { | 228 } else { |
| 229 // Initialize from snapshot (this should replicate the functionality | 229 // Initialize from snapshot (this should replicate the functionality |
| 230 // of Object::Init(..) in a regular isolate creation path. | 230 // of Object::Init(..) in a regular isolate creation path. |
| 231 Object::InitFromSnapshot(isolate); | 231 Object::InitFromSnapshot(isolate); |
| 232 | 232 |
| 233 // TODO(turnidge): Remove once length is not part of the snapshot. | 233 // TODO(turnidge): Remove once length is not part of the snapshot. |
| 234 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); | 234 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); |
| 235 if (snapshot == NULL) { |
| 236 const String& message = String::Handle( |
| 237 String::New("Invalid snapshot.")); |
| 238 return ApiError::New(message); |
| 239 } |
| 235 ASSERT(snapshot->kind() == Snapshot::kFull); | 240 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 236 if (FLAG_trace_isolates) { | 241 if (FLAG_trace_isolates) { |
| 237 OS::Print("Size of isolate snapshot = %" Pd64 "\n", snapshot->length()); | 242 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); |
| 238 } | 243 } |
| 239 SnapshotReader reader(snapshot->content(), snapshot->length(), | 244 SnapshotReader reader(snapshot->content(), snapshot->length(), |
| 240 Snapshot::kFull, isolate); | 245 Snapshot::kFull, isolate); |
| 241 reader.ReadFullSnapshot(); | 246 reader.ReadFullSnapshot(); |
| 242 if (FLAG_trace_isolates) { | 247 if (FLAG_trace_isolates) { |
| 243 isolate->heap()->PrintSizes(); | 248 isolate->heap()->PrintSizes(); |
| 244 isolate->megamorphic_cache_table()->PrintSizes(); | 249 isolate->megamorphic_cache_table()->PrintSizes(); |
| 245 } | 250 } |
| 246 } | 251 } |
| 247 | 252 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 return predefined_handles_->handles_.AllocateScopedHandle(); | 304 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 300 } | 305 } |
| 301 | 306 |
| 302 | 307 |
| 303 bool Dart::IsReadOnlyHandle(uword address) { | 308 bool Dart::IsReadOnlyHandle(uword address) { |
| 304 ASSERT(predefined_handles_ != NULL); | 309 ASSERT(predefined_handles_ != NULL); |
| 305 return predefined_handles_->handles_.IsValidScopedHandle(address); | 310 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 306 } | 311 } |
| 307 | 312 |
| 308 } // namespace dart | 313 } // namespace dart |
| OLD | NEW |