| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ReadOnlyHandles() { } | 68 ReadOnlyHandles() { } |
| 69 | 69 |
| 70 private: | 70 private: |
| 71 VMHandles handles_; | 71 VMHandles handles_; |
| 72 | 72 |
| 73 friend class Dart; | 73 friend class Dart; |
| 74 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); | 74 DISALLOW_COPY_AND_ASSIGN(ReadOnlyHandles); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 | 77 |
| 78 const char* Dart::InitOnce(Dart_IsolateCreateCallback create, | 78 const char* Dart::InitOnce(const uint8_t* vm_isolate_snapshot, |
| 79 Dart_IsolateCreateCallback create, |
| 79 Dart_IsolateInterruptCallback interrupt, | 80 Dart_IsolateInterruptCallback interrupt, |
| 80 Dart_IsolateUnhandledExceptionCallback unhandled, | 81 Dart_IsolateUnhandledExceptionCallback unhandled, |
| 81 Dart_IsolateShutdownCallback shutdown, | 82 Dart_IsolateShutdownCallback shutdown, |
| 82 Dart_FileOpenCallback file_open, | 83 Dart_FileOpenCallback file_open, |
| 83 Dart_FileReadCallback file_read, | 84 Dart_FileReadCallback file_read, |
| 84 Dart_FileWriteCallback file_write, | 85 Dart_FileWriteCallback file_write, |
| 85 Dart_FileCloseCallback file_close, | 86 Dart_FileCloseCallback file_close, |
| 86 Dart_EntropySource entropy_source) { | 87 Dart_EntropySource entropy_source) { |
| 87 // TODO(iposva): Fix race condition here. | 88 // TODO(iposva): Fix race condition here. |
| 88 if (vm_isolate_ != NULL || !Flags::Initialized()) { | 89 if (vm_isolate_ != NULL || !Flags::Initialized()) { |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 // Now that the needed stub has been generated, set the stack limit. | 132 // Now that the needed stub has been generated, set the stack limit. |
| 132 vm_isolate_->InitializeStackLimit(); | 133 vm_isolate_->InitializeStackLimit(); |
| 133 Symbols::InitOnce(vm_isolate_); | 134 Symbols::InitOnce(vm_isolate_); |
| 134 Scanner::InitOnce(); | 135 Scanner::InitOnce(); |
| 135 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 136 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 136 // Dart VM requires at least SSE2. | 137 // Dart VM requires at least SSE2. |
| 137 if (!TargetCPUFeatures::sse2_supported()) { | 138 if (!TargetCPUFeatures::sse2_supported()) { |
| 138 return "SSE2 is required."; | 139 return "SSE2 is required."; |
| 139 } | 140 } |
| 140 #endif | 141 #endif |
| 142 if (vm_isolate_snapshot != NULL) { |
| 143 FATAL("Initializing the VM isolate from a snapshot is not implemented\n"); |
| 144 } |
| 141 Object::FinalizeVMIsolate(vm_isolate_); | 145 Object::FinalizeVMIsolate(vm_isolate_); |
| 142 } | 146 } |
| 143 // There is a planned and known asymmetry here: We enter one scope for the VM | 147 // There is a planned and known asymmetry here: We enter one scope for the VM |
| 144 // isolate so that we can allocate the "persistent" scoped handles for the | 148 // isolate so that we can allocate the "persistent" scoped handles for the |
| 145 // predefined API values (such as Dart_True, Dart_False and Dart_Null). | 149 // predefined API values (such as Dart_True, Dart_False and Dart_Null). |
| 146 Dart_EnterScope(); | 150 Dart_EnterScope(); |
| 147 Api::InitHandles(); | 151 Api::InitHandles(); |
| 148 | 152 |
| 149 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 153 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
| 150 Isolate::SetCreateCallback(create); | 154 Isolate::SetCreateCallback(create); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 return predefined_handles_->handles_.AllocateScopedHandle(); | 317 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 314 } | 318 } |
| 315 | 319 |
| 316 | 320 |
| 317 bool Dart::IsReadOnlyHandle(uword address) { | 321 bool Dart::IsReadOnlyHandle(uword address) { |
| 318 ASSERT(predefined_handles_ != NULL); | 322 ASSERT(predefined_handles_ != NULL); |
| 319 return predefined_handles_->handles_.IsValidScopedHandle(address); | 323 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 320 } | 324 } |
| 321 | 325 |
| 322 } // namespace dart | 326 } // namespace dart |
| OLD | NEW |