| 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/dart_api_state.h" | 8 #include "vm/dart_api_state.h" |
| 9 #include "vm/dart_entry.h" | 9 #include "vm/dart_entry.h" |
| 10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) | 121 #if defined(TARGET_ARCH_IA32) || defined(TARGET_ARCH_X64) |
| 122 // Dart VM requires at least SSE2. | 122 // Dart VM requires at least SSE2. |
| 123 if (!CPUFeatures::sse2_supported()) { | 123 if (!CPUFeatures::sse2_supported()) { |
| 124 return "SSE2 is required."; | 124 return "SSE2 is required."; |
| 125 } | 125 } |
| 126 #endif | 126 #endif |
| 127 PremarkingVisitor premarker(vm_isolate_); | 127 PremarkingVisitor premarker(vm_isolate_); |
| 128 vm_isolate_->heap()->IterateOldObjects(&premarker); | 128 vm_isolate_->heap()->IterateOldObjects(&premarker); |
| 129 vm_isolate_->heap()->WriteProtect(true); | 129 vm_isolate_->heap()->WriteProtect(true); |
| 130 } | 130 } |
| 131 // There is planned and know asymmetry here: We enter one scope for the VM |
| 132 // isolate so that we can allocate the "persistent" handles for the predefined |
| 133 // API values (such as Dart_True, Dart_False and Dart_Null). |
| 134 Dart_EnterScope(); |
| 135 Api::InitHandles(); |
| 136 |
| 131 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. | 137 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. |
| 132 Isolate::SetCreateCallback(create); | 138 Isolate::SetCreateCallback(create); |
| 133 Isolate::SetInterruptCallback(interrupt); | 139 Isolate::SetInterruptCallback(interrupt); |
| 134 Isolate::SetUnhandledExceptionCallback(unhandled); | 140 Isolate::SetUnhandledExceptionCallback(unhandled); |
| 135 Isolate::SetShutdownCallback(shutdown); | 141 Isolate::SetShutdownCallback(shutdown); |
| 136 return NULL; | 142 return NULL; |
| 137 } | 143 } |
| 138 | 144 |
| 139 | 145 |
| 140 Isolate* Dart::CreateIsolate(const char* name_prefix) { | 146 Isolate* Dart::CreateIsolate(const char* name_prefix) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 return predefined_handles_->handles_.AllocateScopedHandle(); | 224 return predefined_handles_->handles_.AllocateScopedHandle(); |
| 219 } | 225 } |
| 220 | 226 |
| 221 | 227 |
| 222 bool Dart::IsReadOnlyHandle(uword address) { | 228 bool Dart::IsReadOnlyHandle(uword address) { |
| 223 ASSERT(predefined_handles_ != NULL); | 229 ASSERT(predefined_handles_ != NULL); |
| 224 return predefined_handles_->handles_.IsValidScopedHandle(address); | 230 return predefined_handles_->handles_.IsValidScopedHandle(address); |
| 225 } | 231 } |
| 226 | 232 |
| 227 } // namespace dart | 233 } // namespace dart |
| OLD | NEW |