| 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/isolate.h" | 5 #include "vm/isolate.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "include/dart_native_api.h" | 8 #include "include/dart_native_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/text_buffer.h" | 10 #include "platform/text_buffer.h" |
| (...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 | 869 |
| 870 Heap::Init(result, | 870 Heap::Init(result, |
| 871 is_vm_isolate | 871 is_vm_isolate |
| 872 ? 0 // New gen size 0; VM isolate should only allocate in old. | 872 ? 0 // New gen size 0; VM isolate should only allocate in old. |
| 873 : FLAG_new_gen_semi_max_size * MBInWords, | 873 : FLAG_new_gen_semi_max_size * MBInWords, |
| 874 FLAG_old_gen_heap_size * MBInWords, | 874 FLAG_old_gen_heap_size * MBInWords, |
| 875 FLAG_external_max_size * MBInWords); | 875 FLAG_external_max_size * MBInWords); |
| 876 | 876 |
| 877 // TODO(5411455): For now just set the recently created isolate as | 877 // TODO(5411455): For now just set the recently created isolate as |
| 878 // the current isolate. | 878 // the current isolate. |
| 879 Thread::EnterIsolate(result); | 879 if (!Thread::EnterIsolate(result)) { |
| 880 // We failed to enter the isolate, it is possible the VM is shutting down, |
| 881 // return back a NULL so that CreateIsolate reports back an error. |
| 882 delete result; |
| 883 return NULL; |
| 884 } |
| 880 | 885 |
| 881 // Setup the isolate message handler. | 886 // Setup the isolate message handler. |
| 882 MessageHandler* handler = new IsolateMessageHandler(result); | 887 MessageHandler* handler = new IsolateMessageHandler(result); |
| 883 ASSERT(handler != NULL); | 888 ASSERT(handler != NULL); |
| 884 result->set_message_handler(handler); | 889 result->set_message_handler(handler); |
| 885 | 890 |
| 886 // Setup the Dart API state. | 891 // Setup the Dart API state. |
| 887 ApiState* state = new ApiState(); | 892 ApiState* state = new ApiState(); |
| 888 ASSERT(state != NULL); | 893 ASSERT(state != NULL); |
| 889 result->set_api_state(state); | 894 result->set_api_state(state); |
| (...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2491 } | 2496 } |
| 2492 | 2497 |
| 2493 | 2498 |
| 2494 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { | 2499 RawInstance* IsolateSpawnState::BuildMessage(Thread* thread) { |
| 2495 return DeserializeObject(thread, | 2500 return DeserializeObject(thread, |
| 2496 serialized_message_, serialized_message_len_); | 2501 serialized_message_, serialized_message_len_); |
| 2497 } | 2502 } |
| 2498 | 2503 |
| 2499 | 2504 |
| 2500 } // namespace dart | 2505 } // namespace dart |
| OLD | NEW |