OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "include/dart_native_api.h" | 5 #include "include/dart_native_api.h" |
6 #include "platform/assert.h" | 6 #include "platform/assert.h" |
7 #include "vm/bootstrap_natives.h" | 7 #include "vm/bootstrap_natives.h" |
8 #include "vm/class_finalizer.h" | 8 #include "vm/class_finalizer.h" |
9 #include "vm/dart.h" | 9 #include "vm/dart.h" |
10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 Dart_IsolateCreateCallback callback = Isolate::CreateCallback(); | 144 Dart_IsolateCreateCallback callback = Isolate::CreateCallback(); |
145 if (callback == NULL) { | 145 if (callback == NULL) { |
146 state_->DecrementSpawnCount(); | 146 state_->DecrementSpawnCount(); |
147 ReportError( | 147 ReportError( |
148 "Isolate spawn is not supported by this Dart implementation\n"); | 148 "Isolate spawn is not supported by this Dart implementation\n"); |
149 delete state_; | 149 delete state_; |
150 state_ = NULL; | 150 state_ = NULL; |
151 return; | 151 return; |
152 } | 152 } |
153 | 153 |
154 Dart_IsolateFlags api_flags; | 154 // Make a copy of the state's isolate flags and hand it to the callback. |
155 state_->isolate_flags()->CopyTo(&api_flags); | 155 Dart_IsolateFlags api_flags = *(state_->isolate_flags()); |
156 | 156 |
157 Isolate* isolate = reinterpret_cast<Isolate*>( | 157 Isolate* isolate = reinterpret_cast<Isolate*>( |
158 (callback)(state_->script_url(), | 158 (callback)(state_->script_url(), |
159 state_->function_name(), | 159 state_->function_name(), |
160 state_->package_root(), | 160 state_->package_root(), |
161 state_->package_config(), | 161 state_->package_config(), |
162 &api_flags, | 162 &api_flags, |
163 state_->init_data(), | 163 state_->init_data(), |
164 &error)); | 164 &error)); |
165 state_->DecrementSpawnCount(); | 165 state_->DecrementSpawnCount(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 isolate->spawn_count_monitor(), | 384 isolate->spawn_count_monitor(), |
385 isolate->spawn_count(), | 385 isolate->spawn_count(), |
386 paused.value(), | 386 paused.value(), |
387 fatal_errors, | 387 fatal_errors, |
388 on_exit_port, | 388 on_exit_port, |
389 on_error_port); | 389 on_error_port); |
390 | 390 |
391 // If we were passed a value then override the default flags state for | 391 // If we were passed a value then override the default flags state for |
392 // checked mode. | 392 // checked mode. |
393 if (!checked.IsNull()) { | 393 if (!checked.IsNull()) { |
394 state->isolate_flags()->set_checked(checked.value()); | 394 bool val = checked.value(); |
| 395 Dart_IsolateFlags* flags = state->isolate_flags(); |
| 396 flags->enable_asserts = val; |
| 397 flags->enable_type_checks = val; |
395 } | 398 } |
396 | 399 |
397 ThreadPool::Task* spawn_task = new SpawnIsolateTask(state); | 400 ThreadPool::Task* spawn_task = new SpawnIsolateTask(state); |
398 | 401 |
399 isolate->IncrementSpawnCount(); | 402 isolate->IncrementSpawnCount(); |
400 if (FLAG_i_like_slow_isolate_spawn) { | 403 if (FLAG_i_like_slow_isolate_spawn) { |
401 // We block the parent isolate while the child isolate loads. | 404 // We block the parent isolate while the child isolate loads. |
402 Isolate* saved = Isolate::Current(); | 405 Isolate* saved = Isolate::Current(); |
403 Thread::ExitIsolate(); | 406 Thread::ExitIsolate(); |
404 spawn_task->Run(); | 407 spawn_task->Run(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 MessageWriter writer(&data, &allocator, false); | 449 MessageWriter writer(&data, &allocator, false); |
447 writer.WriteMessage(msg); | 450 writer.WriteMessage(msg); |
448 | 451 |
449 PortMap::PostMessage(new Message(port.Id(), | 452 PortMap::PostMessage(new Message(port.Id(), |
450 data, writer.BytesWritten(), | 453 data, writer.BytesWritten(), |
451 Message::kOOBPriority)); | 454 Message::kOOBPriority)); |
452 return Object::null(); | 455 return Object::null(); |
453 } | 456 } |
454 | 457 |
455 } // namespace dart | 458 } // namespace dart |
OLD | NEW |