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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/json.h" | 9 #include "platform/json.h" |
10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 void Isolate::BuildName(const char* name_prefix) { | 889 void Isolate::BuildName(const char* name_prefix) { |
890 ASSERT(name_ == NULL); | 890 ASSERT(name_ == NULL); |
891 if (name_prefix == NULL) { | 891 if (name_prefix == NULL) { |
892 name_prefix = "isolate"; | 892 name_prefix = "isolate"; |
893 } | 893 } |
894 set_debugger_name(name_prefix); | 894 set_debugger_name(name_prefix); |
895 if (ServiceIsolate::NameEquals(name_prefix)) { | 895 if (ServiceIsolate::NameEquals(name_prefix)) { |
896 name_ = strdup(name_prefix); | 896 name_ = strdup(name_prefix); |
897 return; | 897 return; |
898 } | 898 } |
899 const char* kFormat = "%s-%lld"; | 899 name_ = OS::SCreate(NULL, "%s-%" Pd64 "", name_prefix, main_port()); |
900 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; | |
901 name_ = reinterpret_cast<char*>(malloc(len)); | |
902 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); | |
903 } | 900 } |
904 | 901 |
905 | 902 |
906 // TODO(5411455): Use flag to override default value and Validate the | 903 // TODO(5411455): Use flag to override default value and Validate the |
907 // stack size by querying OS. | 904 // stack size by querying OS. |
908 uword Isolate::GetSpecifiedStackSize() { | 905 uword Isolate::GetSpecifiedStackSize() { |
909 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); | 906 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); |
910 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; | 907 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; |
911 return stack_size; | 908 return stack_size; |
912 } | 909 } |
(...skipping 1439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 serialized_message_, serialized_message_len_); | 2349 serialized_message_, serialized_message_len_); |
2353 } | 2350 } |
2354 | 2351 |
2355 | 2352 |
2356 void IsolateSpawnState::Cleanup() { | 2353 void IsolateSpawnState::Cleanup() { |
2357 SwitchIsolateScope switch_scope(I); | 2354 SwitchIsolateScope switch_scope(I); |
2358 Dart::ShutdownIsolate(); | 2355 Dart::ShutdownIsolate(); |
2359 } | 2356 } |
2360 | 2357 |
2361 } // namespace dart | 2358 } // namespace dart |
OLD | NEW |