Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: runtime/vm/dart.cc

Issue 1902423003: Make Dart_Initialize fail if a VM built as a JIT runtime gets a precompiled snapshot or vice versa. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 Dart_FileReadCallback file_read, 124 Dart_FileReadCallback file_read,
125 Dart_FileWriteCallback file_write, 125 Dart_FileWriteCallback file_write,
126 Dart_FileCloseCallback file_close, 126 Dart_FileCloseCallback file_close,
127 Dart_EntropySource entropy_source, 127 Dart_EntropySource entropy_source,
128 Dart_GetVMServiceAssetsArchive get_service_assets) { 128 Dart_GetVMServiceAssetsArchive get_service_assets) {
129 CheckOffsets(); 129 CheckOffsets();
130 // TODO(iposva): Fix race condition here. 130 // TODO(iposva): Fix race condition here.
131 if (vm_isolate_ != NULL || !Flags::Initialized()) { 131 if (vm_isolate_ != NULL || !Flags::Initialized()) {
132 return "VM already initialized or flags not initialized."; 132 return "VM already initialized or flags not initialized.";
133 } 133 }
134 #if defined(DART_PRECOMPILED_RUNTIME)
135 if (instructions_snapshot == NULL) {
136 return "Precompiled runtime requires a precompiled snapshot";
137 }
138 #else
139 if (instructions_snapshot != NULL) {
140 return "JIT runtime cannot run a precompiled snapshot";
141 }
142 #endif
134 set_thread_exit_callback(thread_exit); 143 set_thread_exit_callback(thread_exit);
135 SetFileCallbacks(file_open, file_read, file_write, file_close); 144 SetFileCallbacks(file_open, file_read, file_write, file_close);
136 set_entropy_source_callback(entropy_source); 145 set_entropy_source_callback(entropy_source);
137 OS::InitOnce(); 146 OS::InitOnce();
138 VirtualMemory::InitOnce(); 147 VirtualMemory::InitOnce();
139 OSThread::InitOnce(); 148 OSThread::InitOnce();
140 if (FLAG_support_timeline) { 149 if (FLAG_support_timeline) {
141 Timeline::InitOnce(); 150 Timeline::InitOnce();
142 } 151 }
143 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(), 152 NOT_IN_PRODUCT(TimelineDurationScope tds(Timeline::GetVMStream(),
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
619 return predefined_handles_->handles_.IsValidScopedHandle(address); 628 return predefined_handles_->handles_.IsValidScopedHandle(address);
620 } 629 }
621 630
622 631
623 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) { 632 bool Dart::IsReadOnlyApiHandle(Dart_Handle handle) {
624 ASSERT(predefined_handles_ != NULL); 633 ASSERT(predefined_handles_ != NULL);
625 return predefined_handles_->api_handles_.IsValidHandle(handle); 634 return predefined_handles_->api_handles_.IsValidHandle(handle);
626 } 635 }
627 636
628 } // namespace dart 637 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698