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 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 // Setup for profiling. | 224 // Setup for profiling. |
225 Profiler::InitProfilingForIsolate(isolate); | 225 Profiler::InitProfilingForIsolate(isolate); |
226 | 226 |
227 if (snapshot_buffer == NULL) { | 227 if (snapshot_buffer == NULL) { |
228 const Error& error = Error::Handle(Object::Init(isolate)); | 228 const Error& error = Error::Handle(Object::Init(isolate)); |
229 if (!error.IsNull()) { | 229 if (!error.IsNull()) { |
230 return error.raw(); | 230 return error.raw(); |
231 } | 231 } |
232 } else { | 232 } else { |
233 // Initialize from snapshot (this should replicate the functionality | 233 // Initialize from snapshot (this should replicate the functionality |
234 // of Object::Init(..) in a regular isolate creation path. | 234 // of Object::Init(..) in a regular isolate creation path. |
Ivan Posva
2015/05/08 23:52:00
Please update the comment.
siva
2015/05/11 18:22:13
Refactor the code a bit to do the Object::Init(..)
| |
235 Object::InitFromSnapshot(isolate); | 235 Object::Init(isolate); |
236 | 236 |
237 // TODO(turnidge): Remove once length is not part of the snapshot. | 237 // TODO(turnidge): Remove once length is not part of the snapshot. |
238 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); | 238 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); |
239 if (snapshot == NULL) { | 239 if (snapshot == NULL) { |
240 const String& message = String::Handle( | 240 const String& message = String::Handle( |
241 String::New("Invalid snapshot.")); | 241 String::New("Invalid snapshot.")); |
242 return ApiError::New(message); | 242 return ApiError::New(message); |
243 } | 243 } |
244 ASSERT(snapshot->kind() == Snapshot::kFull); | 244 ASSERT(snapshot->kind() == Snapshot::kFull); |
245 if (FLAG_trace_isolates) { | 245 if (FLAG_trace_isolates) { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
318 return predefined_handles_->handles_.AllocateScopedHandle(); | 318 return predefined_handles_->handles_.AllocateScopedHandle(); |
319 } | 319 } |
320 | 320 |
321 | 321 |
322 bool Dart::IsReadOnlyHandle(uword address) { | 322 bool Dart::IsReadOnlyHandle(uword address) { |
323 ASSERT(predefined_handles_ != NULL); | 323 ASSERT(predefined_handles_ != NULL); |
324 return predefined_handles_->handles_.IsValidScopedHandle(address); | 324 return predefined_handles_->handles_.IsValidScopedHandle(address); |
325 } | 325 } |
326 | 326 |
327 } // namespace dart | 327 } // namespace dart |
OLD | NEW |