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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 DEFINE_FLAG(bool, break_at_isolate_spawn, false, | 53 DEFINE_FLAG(bool, break_at_isolate_spawn, false, |
54 "Insert a one-time breakpoint at the entrypoint for all spawned " | 54 "Insert a one-time breakpoint at the entrypoint for all spawned " |
55 "isolates"); | 55 "isolates"); |
56 DEFINE_FLAG(charp, isolate_log_filter, NULL, | 56 DEFINE_FLAG(charp, isolate_log_filter, NULL, |
57 "Log isolates whose name include the filter. " | 57 "Log isolates whose name include the filter. " |
58 "Default: service isolate log messages are suppressed."); | 58 "Default: service isolate log messages are suppressed."); |
59 | 59 |
60 DEFINE_FLAG(charp, timeline_trace_dir, NULL, | 60 DEFINE_FLAG(charp, timeline_trace_dir, NULL, |
61 "Enable all timeline trace streams and output traces " | 61 "Enable all timeline trace streams and output traces " |
62 "into specified directory."); | 62 "into specified directory."); |
| 63 DEFINE_FLAG(int, new_gen_semi_max_size, (kWordSize <= 4) ? 16 : 32, |
| 64 "Max size of new gen semi space in MB"); |
| 65 DEFINE_FLAG(int, old_gen_heap_size, 0, |
| 66 "Max size of old gen heap size in MB, or 0 for unlimited," |
| 67 "e.g: --old_gen_heap_size=1024 allows up to 1024MB old gen heap"); |
| 68 DEFINE_FLAG(int, external_max_size, (kWordSize <= 4) ? 512 : 1024, |
| 69 "Max total size of external allocations in MB, or 0 for unlimited," |
| 70 "e.g: --external_max_size=1024 allows up to 1024MB of externals"); |
63 | 71 |
64 // TODO(iposva): Make these isolate specific flags inaccessible using the | 72 // TODO(iposva): Make these isolate specific flags inaccessible using the |
65 // regular FLAG_xyz pattern. | 73 // regular FLAG_xyz pattern. |
66 // These flags are per-isolate and only influence the defaults. | 74 // These flags are per-isolate and only influence the defaults. |
67 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); | 75 DEFINE_FLAG(bool, enable_asserts, false, "Enable assert statements."); |
68 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); | 76 DEFINE_FLAG(bool, enable_type_checks, false, "Enable type checks."); |
69 DEFINE_FLAG(bool, error_on_bad_override, false, | 77 DEFINE_FLAG(bool, error_on_bad_override, false, |
70 "Report error for bad overrides."); | 78 "Report error for bad overrides."); |
71 DEFINE_FLAG(bool, error_on_bad_type, false, | 79 DEFINE_FLAG(bool, error_on_bad_type, false, |
72 "Report error for malformed types."); | 80 "Report error for malformed types."); |
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 #undef ISOLATE_METRIC_INIT | 766 #undef ISOLATE_METRIC_INIT |
759 | 767 |
760 const bool force_streams = FLAG_timeline_trace_dir != NULL; | 768 const bool force_streams = FLAG_timeline_trace_dir != NULL; |
761 | 769 |
762 // Initialize Timeline streams. | 770 // Initialize Timeline streams. |
763 #define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default) \ | 771 #define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default) \ |
764 result->stream_##name##_.Init(#name, force_streams || enabled_by_default); | 772 result->stream_##name##_.Init(#name, force_streams || enabled_by_default); |
765 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_INIT); | 773 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_INIT); |
766 #undef ISOLATE_TIMELINE_STREAM_INIT | 774 #undef ISOLATE_TIMELINE_STREAM_INIT |
767 | 775 |
| 776 Heap::Init(result, |
| 777 is_vm_isolate |
| 778 ? 0 // New gen size 0; VM isolate should only allocate in old. |
| 779 : FLAG_new_gen_semi_max_size * MBInWords, |
| 780 FLAG_old_gen_heap_size * MBInWords, |
| 781 FLAG_external_max_size * MBInWords); |
768 | 782 |
769 // TODO(5411455): For now just set the recently created isolate as | 783 // TODO(5411455): For now just set the recently created isolate as |
770 // the current isolate. | 784 // the current isolate. |
771 Thread::EnterIsolate(result); | 785 Thread::EnterIsolate(result); |
772 | 786 |
773 // Setup the isolate specific resuable handles. | 787 // Setup the isolate specific resuable handles. |
774 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 788 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
775 result->object##_handle_ = result->AllocateReusableHandle<object>(); | 789 result->object##_handle_ = result->AllocateReusableHandle<object>(); |
776 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 790 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
777 #undef REUSABLE_HANDLE_ALLOCATION | 791 #undef REUSABLE_HANDLE_ALLOCATION |
(...skipping 1377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2155 serialized_message_, serialized_message_len_); | 2169 serialized_message_, serialized_message_len_); |
2156 } | 2170 } |
2157 | 2171 |
2158 | 2172 |
2159 void IsolateSpawnState::Cleanup() { | 2173 void IsolateSpawnState::Cleanup() { |
2160 SwitchIsolateScope switch_scope(I); | 2174 SwitchIsolateScope switch_scope(I); |
2161 Dart::ShutdownIsolate(); | 2175 Dart::ShutdownIsolate(); |
2162 } | 2176 } |
2163 | 2177 |
2164 } // namespace dart | 2178 } // namespace dart |
OLD | NEW |