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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 #undef ISOLATE_METRIC_INIT | 764 #undef ISOLATE_METRIC_INIT |
757 | 765 |
758 const bool force_streams = FLAG_timeline_trace_dir != NULL; | 766 const bool force_streams = FLAG_timeline_trace_dir != NULL; |
759 | 767 |
760 // Initialize Timeline streams. | 768 // Initialize Timeline streams. |
761 #define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default) \ | 769 #define ISOLATE_TIMELINE_STREAM_INIT(name, enabled_by_default) \ |
762 result->stream_##name##_.Init(#name, force_streams || enabled_by_default); | 770 result->stream_##name##_.Init(#name, force_streams || enabled_by_default); |
763 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_INIT); | 771 ISOLATE_TIMELINE_STREAM_LIST(ISOLATE_TIMELINE_STREAM_INIT); |
764 #undef ISOLATE_TIMELINE_STREAM_INIT | 772 #undef ISOLATE_TIMELINE_STREAM_INIT |
765 | 773 |
| 774 Heap::Init(result, |
| 775 is_vm_isolate |
| 776 ? 0 // New gen size 0; VM isolate should only allocate in old. |
| 777 : FLAG_new_gen_semi_max_size * MBInWords, |
| 778 FLAG_old_gen_heap_size * MBInWords, |
| 779 FLAG_external_max_size * MBInWords); |
766 | 780 |
767 // TODO(5411455): For now just set the recently created isolate as | 781 // TODO(5411455): For now just set the recently created isolate as |
768 // the current isolate. | 782 // the current isolate. |
769 Thread::EnterIsolate(result); | 783 Thread::EnterIsolate(result); |
770 | 784 |
771 // Setup the isolate specific resuable handles. | 785 // Setup the isolate specific resuable handles. |
772 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 786 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
773 result->object##_handle_ = result->AllocateReusableHandle<object>(); | 787 result->object##_handle_ = result->AllocateReusableHandle<object>(); |
774 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 788 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
775 #undef REUSABLE_HANDLE_ALLOCATION | 789 #undef REUSABLE_HANDLE_ALLOCATION |
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 serialized_message_, serialized_message_len_); | 2159 serialized_message_, serialized_message_len_); |
2146 } | 2160 } |
2147 | 2161 |
2148 | 2162 |
2149 void IsolateSpawnState::Cleanup() { | 2163 void IsolateSpawnState::Cleanup() { |
2150 SwitchIsolateScope switch_scope(I); | 2164 SwitchIsolateScope switch_scope(I); |
2151 Dart::ShutdownIsolate(); | 2165 Dart::ShutdownIsolate(); |
2152 } | 2166 } |
2153 | 2167 |
2154 } // namespace dart | 2168 } // namespace dart |
OLD | NEW |