Chromium Code Reviews| 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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 197 Heap::Init(isolate, | 197 Heap::Init(isolate, |
| 198 FLAG_new_gen_semi_max_size * MBInWords, | 198 FLAG_new_gen_semi_max_size * MBInWords, |
| 199 FLAG_old_gen_heap_size * MBInWords); | 199 FLAG_old_gen_heap_size * MBInWords); |
| 200 ObjectIdRing::Init(isolate); | 200 ObjectIdRing::Init(isolate); |
| 201 ObjectStore::Init(isolate); | 201 ObjectStore::Init(isolate); |
| 202 | 202 |
| 203 // Setup for profiling. | 203 // Setup for profiling. |
| 204 Profiler::InitProfilingForIsolate(isolate); | 204 Profiler::InitProfilingForIsolate(isolate); |
| 205 | 205 |
| 206 if (snapshot_buffer == NULL) { | 206 if (snapshot_buffer == NULL) { |
| 207 const Error& error = Error::Handle(Object::Init(isolate)); | 207 Error& error = Error::Handle(Object::Init(isolate)); |
| 208 if (!error.IsNull()) { | |
| 209 return error.raw(); | |
| 210 } | |
| 211 | |
| 212 StubCode::InitBootstrapStubs(isolate); | |
|
Vyacheslav Egorov (Google)
2014/10/24 10:58:08
Why don't you move this into Object::Init?
Florian Schneider
2014/10/24 11:24:39
Done.
| |
| 213 | |
| 214 error = Object::FinishInit(isolate); | |
| 208 if (!error.IsNull()) { | 215 if (!error.IsNull()) { |
| 209 return error.raw(); | 216 return error.raw(); |
| 210 } | 217 } |
| 211 } else { | 218 } else { |
| 212 // Initialize from snapshot (this should replicate the functionality | 219 // Initialize from snapshot (this should replicate the functionality |
| 213 // of Object::Init(..) in a regular isolate creation path. | 220 // of Object::Init(..) in a regular isolate creation path. |
| 214 Object::InitFromSnapshot(isolate); | 221 Object::InitFromSnapshot(isolate); |
| 215 | 222 |
| 223 StubCode::InitBootstrapStubs(isolate); | |
| 224 | |
| 216 // TODO(turnidge): Remove once length is not part of the snapshot. | 225 // TODO(turnidge): Remove once length is not part of the snapshot. |
| 217 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); | 226 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); |
| 218 if (snapshot == NULL) { | 227 if (snapshot == NULL) { |
| 219 const String& message = String::Handle( | 228 const String& message = String::Handle( |
| 220 String::New("Invalid snapshot.")); | 229 String::New("Invalid snapshot.")); |
| 221 return ApiError::New(message); | 230 return ApiError::New(message); |
| 222 } | 231 } |
| 223 ASSERT(snapshot->kind() == Snapshot::kFull); | 232 ASSERT(snapshot->kind() == Snapshot::kFull); |
| 224 if (FLAG_trace_isolates) { | 233 if (FLAG_trace_isolates) { |
| 225 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); | 234 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 290 return predefined_handles_->handles_.AllocateScopedHandle(); | 299 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 291 } | 300 } |
| 292 | 301 |
| 293 | 302 |
| 294 bool Dart::IsReadOnlyHandle(uword address) { | 303 bool Dart::IsReadOnlyHandle(uword address) { |
| 295 ASSERT(predefined_handles_ != NULL); | 304 ASSERT(predefined_handles_ != NULL); |
| 296 return predefined_handles_->handles_.IsValidScopedHandle(address); | 305 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 297 } | 306 } |
| 298 | 307 |
| 299 } // namespace dart | 308 } // namespace dart |
| OLD | NEW |