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 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 Isolate* Isolate::Init(const char* name_prefix) { | 626 Isolate* Isolate::Init(const char* name_prefix) { |
627 Isolate* result = new Isolate(); | 627 Isolate* result = new Isolate(); |
628 ASSERT(result != NULL); | 628 ASSERT(result != NULL); |
629 | 629 |
630 // Initialize metrics. | 630 // Initialize metrics. |
631 #define ISOLATE_METRIC_INIT(type, variable, name, unit) \ | 631 #define ISOLATE_METRIC_INIT(type, variable, name, unit) \ |
632 result->metric_##variable##_.Init(result, name, NULL, Metric::unit); | 632 result->metric_##variable##_.Init(result, name, NULL, Metric::unit); |
633 ISOLATE_METRIC_LIST(ISOLATE_METRIC_INIT); | 633 ISOLATE_METRIC_LIST(ISOLATE_METRIC_INIT); |
634 #undef ISOLATE_METRIC_INIT | 634 #undef ISOLATE_METRIC_INIT |
635 | 635 |
636 | |
637 // Add to isolate list. | |
638 AddIsolateTolist(result); | |
639 | |
640 | |
641 // TODO(5411455): For now just set the recently created isolate as | 636 // TODO(5411455): For now just set the recently created isolate as |
642 // the current isolate. | 637 // the current isolate. |
643 SetCurrent(result); | 638 SetCurrent(result); |
644 | 639 |
645 // Setup the isolate specific resuable handles. | 640 // Setup the isolate specific resuable handles. |
646 #define REUSABLE_HANDLE_ALLOCATION(object) \ | 641 #define REUSABLE_HANDLE_ALLOCATION(object) \ |
647 result->object##_handle_ = result->AllocateReusableHandle<object>(); | 642 result->object##_handle_ = result->AllocateReusableHandle<object>(); |
648 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) | 643 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_ALLOCATION) |
649 #undef REUSABLE_HANDLE_ALLOCATION | 644 #undef REUSABLE_HANDLE_ALLOCATION |
650 | 645 |
(...skipping 26 matching lines...) Expand all Loading... |
677 | 672 |
678 result->debugger_ = new Debugger(); | 673 result->debugger_ = new Debugger(); |
679 result->debugger_->Initialize(result); | 674 result->debugger_->Initialize(result); |
680 if (FLAG_trace_isolates) { | 675 if (FLAG_trace_isolates) { |
681 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { | 676 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { |
682 OS::Print("[+] Starting isolate:\n" | 677 OS::Print("[+] Starting isolate:\n" |
683 "\tisolate: %s\n", result->name()); | 678 "\tisolate: %s\n", result->name()); |
684 } | 679 } |
685 } | 680 } |
686 | 681 |
| 682 // Add to isolate list. |
| 683 AddIsolateTolist(result); |
| 684 |
687 return result; | 685 return result; |
688 } | 686 } |
689 | 687 |
690 | 688 |
691 void Isolate::BuildName(const char* name_prefix) { | 689 void Isolate::BuildName(const char* name_prefix) { |
692 ASSERT(name_ == NULL); | 690 ASSERT(name_ == NULL); |
693 if (name_prefix == NULL) { | 691 if (name_prefix == NULL) { |
694 name_prefix = "isolate"; | 692 name_prefix = "isolate"; |
695 } | 693 } |
696 if (Service::IsServiceIsolateName(name_prefix)) { | 694 if (Service::IsServiceIsolateName(name_prefix)) { |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 serialized_message_, serialized_message_len_); | 1672 serialized_message_, serialized_message_len_); |
1675 } | 1673 } |
1676 | 1674 |
1677 | 1675 |
1678 void IsolateSpawnState::Cleanup() { | 1676 void IsolateSpawnState::Cleanup() { |
1679 SwitchIsolateScope switch_scope(I); | 1677 SwitchIsolateScope switch_scope(I); |
1680 Dart::ShutdownIsolate(); | 1678 Dart::ShutdownIsolate(); |
1681 } | 1679 } |
1682 | 1680 |
1683 } // namespace dart | 1681 } // namespace dart |
OLD | NEW |