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/become.h" | 7 #include "vm/become.h" |
8 #include "vm/clustered_snapshot.h" | 8 #include "vm/clustered_snapshot.h" |
9 #include "vm/code_observers.h" | 9 #include "vm/code_observers.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 if (vm_isolate_snapshot != NULL) { | 208 if (vm_isolate_snapshot != NULL) { |
209 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), | 209 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), |
210 "VMIsolateSnapshot")); | 210 "VMIsolateSnapshot")); |
211 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); | 211 const Snapshot* snapshot = Snapshot::SetupFromBuffer(vm_isolate_snapshot); |
212 if (snapshot == NULL) { | 212 if (snapshot == NULL) { |
213 return strdup("Invalid vm isolate snapshot seen"); | 213 return strdup("Invalid vm isolate snapshot seen"); |
214 } | 214 } |
215 vm_snapshot_kind_ = snapshot->kind(); | 215 vm_snapshot_kind_ = snapshot->kind(); |
216 | 216 |
217 if (Snapshot::IncludesCode(vm_snapshot_kind_)) { | 217 if (Snapshot::IncludesCode(vm_snapshot_kind_)) { |
218 if (vm_snapshot_kind_ == Snapshot::kAppAOT) { | 218 if (vm_snapshot_kind_ == Snapshot::kFullAOT) { |
219 #if defined(DART_PRECOMPILED_RUNTIME) | 219 #if defined(DART_PRECOMPILED_RUNTIME) |
220 vm_isolate_->set_compilation_allowed(false); | 220 vm_isolate_->set_compilation_allowed(false); |
221 if (!FLAG_precompiled_runtime) { | 221 if (!FLAG_precompiled_runtime) { |
222 return strdup("Flag --precompilation was not specified"); | 222 return strdup("Flag --precompilation was not specified"); |
223 } | 223 } |
224 #else | 224 #else |
225 return strdup("JIT runtime cannot run a precompiled snapshot"); | 225 return strdup("JIT runtime cannot run a precompiled snapshot"); |
226 #endif | 226 #endif |
227 } | 227 } |
228 if (instructions_snapshot == NULL) { | 228 if (instructions_snapshot == NULL) { |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 const Dart_IsolateFlags& api_flags) { | 503 const Dart_IsolateFlags& api_flags) { |
504 // Create a new isolate. | 504 // Create a new isolate. |
505 Isolate* isolate = Isolate::Init(name_prefix, api_flags); | 505 Isolate* isolate = Isolate::Init(name_prefix, api_flags); |
506 return isolate; | 506 return isolate; |
507 } | 507 } |
508 | 508 |
509 | 509 |
510 static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, | 510 static bool IsSnapshotCompatible(Snapshot::Kind vm_kind, |
511 Snapshot::Kind isolate_kind) { | 511 Snapshot::Kind isolate_kind) { |
512 if (vm_kind == isolate_kind) return true; | 512 if (vm_kind == isolate_kind) return true; |
513 if (vm_kind == Snapshot::kCore && isolate_kind == Snapshot::kAppJIT) | 513 if (vm_kind == Snapshot::kFull && isolate_kind == Snapshot::kFullJIT) |
514 return true; | 514 return true; |
515 return Snapshot::IsFull(isolate_kind); | 515 return Snapshot::IsFull(isolate_kind); |
516 } | 516 } |
517 | 517 |
518 | 518 |
519 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, | 519 RawError* Dart::InitializeIsolate(const uint8_t* snapshot_data, |
520 const uint8_t* snapshot_instructions, | 520 const uint8_t* snapshot_instructions, |
521 intptr_t snapshot_length, | 521 intptr_t snapshot_length, |
522 kernel::Program* kernel_program, | 522 kernel::Program* kernel_program, |
523 void* data) { | 523 void* data) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 buffer.AddString("release"); | 667 buffer.AddString("release"); |
668 #endif | 668 #endif |
669 | 669 |
670 if (Snapshot::IncludesCode(kind)) { | 670 if (Snapshot::IncludesCode(kind)) { |
671 // Checked mode affects deopt ids. | 671 // Checked mode affects deopt ids. |
672 #define ADD_FLAG(name, isolate_flag, flag) \ | 672 #define ADD_FLAG(name, isolate_flag, flag) \ |
673 do { \ | 673 do { \ |
674 const bool name = (isolate != NULL) ? isolate->name() : flag; \ | 674 const bool name = (isolate != NULL) ? isolate->name() : flag; \ |
675 buffer.AddString(name ? (" " #name) : (" no-" #name)); \ | 675 buffer.AddString(name ? (" " #name) : (" no-" #name)); \ |
676 } while (0); | 676 } while (0); |
677 ISOLATE_FLAG_LIST(ADD_FLAG); | 677 ADD_FLAG(type_checks, enable_type_checks, FLAG_enable_type_checks); |
| 678 ADD_FLAG(asserts, enable_asserts, FLAG_enable_asserts); |
| 679 ADD_FLAG(error_on_bad_type, enable_error_on_bad_type, |
| 680 FLAG_error_on_bad_type); |
| 681 ADD_FLAG(error_on_bad_override, enable_error_on_bad_override, |
| 682 FLAG_error_on_bad_override); |
| 683 if (kind == Snapshot::kFullJIT) { |
| 684 ADD_FLAG(use_field_guards, use_field_guards, FLAG_use_field_guards); |
| 685 ADD_FLAG(use_osr, use_osr, FLAG_use_osr); |
| 686 } |
678 #undef ADD_FLAG | 687 #undef ADD_FLAG |
679 | 688 |
680 // Generated code must match the host architecture and ABI. | 689 // Generated code must match the host architecture and ABI. |
681 #if defined(TARGET_ARCH_ARM) | 690 #if defined(TARGET_ARCH_ARM) |
682 #if defined(TARGET_OS_MACOS) || defined(TARGET_OS_MACOS_IOS) | 691 #if defined(TARGET_OS_MACOS) || defined(TARGET_OS_MACOS_IOS) |
683 buffer.AddString(" arm-ios"); | 692 buffer.AddString(" arm-ios"); |
684 #else | 693 #else |
685 buffer.AddString(" arm-eabi"); | 694 buffer.AddString(" arm-eabi"); |
686 #endif | 695 #endif |
687 buffer.AddString(TargetCPUFeatures::hardfp_supported() ? " hardfp" | 696 buffer.AddString(TargetCPUFeatures::hardfp_supported() ? " hardfp" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 return predefined_handles_->handles_.IsValidScopedHandle(address); | 775 return predefined_handles_->handles_.IsValidScopedHandle(address); |
767 } | 776 } |
768 | 777 |
769 | 778 |
770 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { | 779 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { |
771 ASSERT(predefined_handles_ != NULL); | 780 ASSERT(predefined_handles_ != NULL); |
772 return predefined_handles_->api_handles_.IsValidHandle(handle); | 781 return predefined_handles_->api_handles_.IsValidHandle(handle); |
773 } | 782 } |
774 | 783 |
775 } // namespace dart | 784 } // namespace dart |
OLD | NEW |