| 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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (vm_isolate_snapshot != NULL) { | 207 if (vm_isolate_snapshot != NULL) { |
| 208 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), | 208 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), |
| 209 "VMIsolateSnapshot")); | 209 "VMIsolateSnapshot")); |
| 210 if (data_snapshot != NULL) { | 210 if (data_snapshot != NULL) { |
| 211 vm_isolate_->SetupDataSnapshotPage(data_snapshot); | 211 vm_isolate_->SetupDataSnapshotPage(data_snapshot); |
| 212 } | 212 } |
| 213 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); | 213 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); |
| 214 if (snapshot == NULL) { | 214 if (snapshot == NULL) { |
| 215 return "Invalid vm isolate snapshot seen."; | 215 return "Invalid vm isolate snapshot seen."; |
| 216 } | 216 } |
| 217 ASSERT(snapshot->kind() == Snapshot::kFull); | 217 ASSERT(Snapshot::IsFull(snapshot->kind())); |
| 218 VmIsolateSnapshotReader reader(snapshot->content(), | 218 VmIsolateSnapshotReader reader(snapshot->kind(), |
| 219 snapshot->content(), |
| 219 snapshot->length(), | 220 snapshot->length(), |
| 220 instructions_snapshot, | 221 instructions_snapshot, |
| 221 data_snapshot, | 222 data_snapshot, |
| 222 T); | 223 T); |
| 223 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot()); | 224 const Error& error = Error::Handle(reader.ReadVmIsolateSnapshot()); |
| 224 if (!error.IsNull()) { | 225 if (!error.IsNull()) { |
| 225 return error.ToCString(); | 226 return error.ToCString(); |
| 226 } | 227 } |
| 227 NOT_IN_PRODUCT(if (tds.enabled()) { | 228 NOT_IN_PRODUCT(if (tds.enabled()) { |
| 228 tds.SetNumArguments(2); | 229 tds.SetNumArguments(2); |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 // Read the snapshot and setup the initial state. | 476 // Read the snapshot and setup the initial state. |
| 476 NOT_IN_PRODUCT(TimelineDurationScope tds(T, | 477 NOT_IN_PRODUCT(TimelineDurationScope tds(T, |
| 477 Timeline::GetIsolateStream(), "IsolateSnapshotReader")); | 478 Timeline::GetIsolateStream(), "IsolateSnapshotReader")); |
| 478 // TODO(turnidge): Remove once length is not part of the snapshot. | 479 // TODO(turnidge): Remove once length is not part of the snapshot. |
| 479 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); | 480 const Snapshot* snapshot = Snapshot::SetupFromBuffer(snapshot_buffer); |
| 480 if (snapshot == NULL) { | 481 if (snapshot == NULL) { |
| 481 const String& message = String::Handle( | 482 const String& message = String::Handle( |
| 482 String::New("Invalid snapshot.")); | 483 String::New("Invalid snapshot.")); |
| 483 return ApiError::New(message); | 484 return ApiError::New(message); |
| 484 } | 485 } |
| 485 ASSERT(snapshot->kind() == Snapshot::kFull); | 486 ASSERT(Snapshot::IsFull(snapshot->kind())); |
| 486 if (FLAG_trace_isolates) { | 487 if (FLAG_trace_isolates) { |
| 487 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); | 488 OS::Print("Size of isolate snapshot = %" Pd "\n", snapshot->length()); |
| 488 } | 489 } |
| 489 IsolateSnapshotReader reader(snapshot->content(), | 490 IsolateSnapshotReader reader(snapshot->kind(), |
| 491 snapshot->content(), |
| 490 snapshot->length(), | 492 snapshot->length(), |
| 491 Dart::instructions_snapshot_buffer(), | 493 Dart::instructions_snapshot_buffer(), |
| 492 Dart::data_snapshot_buffer(), | 494 Dart::data_snapshot_buffer(), |
| 493 T); | 495 T); |
| 494 const Error& error = Error::Handle(reader.ReadFullSnapshot()); | 496 const Error& error = Error::Handle(reader.ReadFullSnapshot()); |
| 495 if (!error.IsNull()) { | 497 if (!error.IsNull()) { |
| 496 return error.raw(); | 498 return error.raw(); |
| 497 } | 499 } |
| 498 NOT_IN_PRODUCT(if (tds.enabled()) { | 500 NOT_IN_PRODUCT(if (tds.enabled()) { |
| 499 tds.SetNumArguments(2); | 501 tds.SetNumArguments(2); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 return predefined_handles_->handles_.IsValidScopedHandle(address); | 630 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 629 } | 631 } |
| 630 | 632 |
| 631 | 633 |
| 632 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 634 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
| 633 ASSERT(predefined_handles_ != NULL); | 635 ASSERT(predefined_handles_ != NULL); |
| 634 return predefined_handles_->api_handles_.IsValidHandle(handle); | 636 return predefined_handles_->api_handles_.IsValidHandle(handle); |
| 635 } | 637 } |
| 636 | 638 |
| 637 } // namespace dart | 639 } // namespace dart |
| OLD | NEW |