| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 stack_frame_index_(-1), | 433 stack_frame_index_(-1), |
| 434 last_allocationprofile_accumulator_reset_timestamp_(0), | 434 last_allocationprofile_accumulator_reset_timestamp_(0), |
| 435 last_allocationprofile_gc_timestamp_(0), | 435 last_allocationprofile_gc_timestamp_(0), |
| 436 cha_(NULL), | 436 cha_(NULL), |
| 437 object_id_ring_(NULL), | 437 object_id_ring_(NULL), |
| 438 trace_buffer_(NULL), | 438 trace_buffer_(NULL), |
| 439 profiler_data_(NULL), | 439 profiler_data_(NULL), |
| 440 thread_state_(NULL), | 440 thread_state_(NULL), |
| 441 tag_table_(GrowableObjectArray::null()), | 441 tag_table_(GrowableObjectArray::null()), |
| 442 current_tag_(UserTag::null()), | 442 current_tag_(UserTag::null()), |
| 443 default_tag_(UserTag::null()), |
| 443 metrics_list_head_(NULL), | 444 metrics_list_head_(NULL), |
| 444 next_(NULL), | 445 next_(NULL), |
| 445 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 446 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
| 446 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 447 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
| 447 reusable_handles_() { | 448 reusable_handles_() { |
| 448 set_vm_tag(VMTag::kIdleTagId); | 449 set_vm_tag(VMTag::kIdleTagId); |
| 449 set_user_tag(UserTags::kDefaultUserTag); | 450 set_user_tag(UserTags::kDefaultUserTag); |
| 450 } | 451 } |
| 451 | 452 |
| 452 Isolate::Isolate(Isolate* original) | 453 Isolate::Isolate(Isolate* original) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 stack_frame_index_(-1), | 492 stack_frame_index_(-1), |
| 492 last_allocationprofile_accumulator_reset_timestamp_(0), | 493 last_allocationprofile_accumulator_reset_timestamp_(0), |
| 493 last_allocationprofile_gc_timestamp_(0), | 494 last_allocationprofile_gc_timestamp_(0), |
| 494 cha_(NULL), | 495 cha_(NULL), |
| 495 object_id_ring_(NULL), | 496 object_id_ring_(NULL), |
| 496 trace_buffer_(NULL), | 497 trace_buffer_(NULL), |
| 497 profiler_data_(NULL), | 498 profiler_data_(NULL), |
| 498 thread_state_(NULL), | 499 thread_state_(NULL), |
| 499 tag_table_(GrowableObjectArray::null()), | 500 tag_table_(GrowableObjectArray::null()), |
| 500 current_tag_(UserTag::null()), | 501 current_tag_(UserTag::null()), |
| 502 default_tag_(UserTag::null()), |
| 501 metrics_list_head_(NULL), | 503 metrics_list_head_(NULL), |
| 502 next_(NULL), | 504 next_(NULL), |
| 503 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) | 505 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) |
| 504 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) | 506 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) |
| 505 reusable_handles_() { | 507 reusable_handles_() { |
| 506 } | 508 } |
| 507 #undef REUSABLE_HANDLE_SCOPE_INIT | 509 #undef REUSABLE_HANDLE_SCOPE_INIT |
| 508 #undef REUSABLE_HANDLE_INITIALIZERS | 510 #undef REUSABLE_HANDLE_INITIALIZERS |
| 509 | 511 |
| 510 Isolate::~Isolate() { | 512 Isolate::~Isolate() { |
| (...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 if (api_state() != NULL) { | 1119 if (api_state() != NULL) { |
| 1118 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); | 1120 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); |
| 1119 } | 1121 } |
| 1120 | 1122 |
| 1121 // Visit the top context which is stored in the isolate. | 1123 // Visit the top context which is stored in the isolate. |
| 1122 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); | 1124 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); |
| 1123 | 1125 |
| 1124 // Visit the current tag which is stored in the isolate. | 1126 // Visit the current tag which is stored in the isolate. |
| 1125 visitor->VisitPointer(reinterpret_cast<RawObject**>(¤t_tag_)); | 1127 visitor->VisitPointer(reinterpret_cast<RawObject**>(¤t_tag_)); |
| 1126 | 1128 |
| 1129 // Visit the default tag which is stored in the isolate. |
| 1130 visitor->VisitPointer(reinterpret_cast<RawObject**>(&default_tag_)); |
| 1131 |
| 1127 // Visit the tag table which is stored in the isolate. | 1132 // Visit the tag table which is stored in the isolate. |
| 1128 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); | 1133 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_)); |
| 1129 | 1134 |
| 1130 // Visit objects in the debugger. | 1135 // Visit objects in the debugger. |
| 1131 debugger()->VisitObjectPointers(visitor); | 1136 debugger()->VisitObjectPointers(visitor); |
| 1132 | 1137 |
| 1133 // Visit objects that are being used for deoptimization. | 1138 // Visit objects that are being used for deoptimization. |
| 1134 if (deopt_context() != NULL) { | 1139 if (deopt_context() != NULL) { |
| 1135 deopt_context()->VisitObjectPointers(visitor); | 1140 deopt_context()->VisitObjectPointers(visitor); |
| 1136 } | 1141 } |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1305 vm_tag_counters_.Increment(vm_tag()); | 1310 vm_tag_counters_.Increment(vm_tag()); |
| 1306 } | 1311 } |
| 1307 | 1312 |
| 1308 | 1313 |
| 1309 void Isolate::set_tag_table(const GrowableObjectArray& value) { | 1314 void Isolate::set_tag_table(const GrowableObjectArray& value) { |
| 1310 tag_table_ = value.raw(); | 1315 tag_table_ = value.raw(); |
| 1311 } | 1316 } |
| 1312 | 1317 |
| 1313 | 1318 |
| 1314 void Isolate::set_current_tag(const UserTag& tag) { | 1319 void Isolate::set_current_tag(const UserTag& tag) { |
| 1315 intptr_t user_tag = tag.tag(); | 1320 uword user_tag = tag.tag(); |
| 1316 set_user_tag(static_cast<uword>(user_tag)); | 1321 ASSERT(user_tag < kUwordMax); |
| 1322 set_user_tag(user_tag); |
| 1317 current_tag_ = tag.raw(); | 1323 current_tag_ = tag.raw(); |
| 1318 } | 1324 } |
| 1319 | 1325 |
| 1320 | 1326 |
| 1327 void Isolate::set_default_tag(const UserTag& tag) { |
| 1328 default_tag_ = tag.raw(); |
| 1329 } |
| 1330 |
| 1331 |
| 1321 void Isolate::VisitIsolates(IsolateVisitor* visitor) { | 1332 void Isolate::VisitIsolates(IsolateVisitor* visitor) { |
| 1322 if (visitor == NULL) { | 1333 if (visitor == NULL) { |
| 1323 return; | 1334 return; |
| 1324 } | 1335 } |
| 1325 MonitorLocker ml(isolates_list_monitor_); | 1336 MonitorLocker ml(isolates_list_monitor_); |
| 1326 Isolate* current = isolates_list_head_; | 1337 Isolate* current = isolates_list_head_; |
| 1327 while (current) { | 1338 while (current) { |
| 1328 visitor->VisitIsolate(current); | 1339 visitor->VisitIsolate(current); |
| 1329 current = current->next_; | 1340 current = current->next_; |
| 1330 } | 1341 } |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 serialized_message_, serialized_message_len_); | 1564 serialized_message_, serialized_message_len_); |
| 1554 } | 1565 } |
| 1555 | 1566 |
| 1556 | 1567 |
| 1557 void IsolateSpawnState::Cleanup() { | 1568 void IsolateSpawnState::Cleanup() { |
| 1558 SwitchIsolateScope switch_scope(I); | 1569 SwitchIsolateScope switch_scope(I); |
| 1559 Dart::ShutdownIsolate(); | 1570 Dart::ShutdownIsolate(); |
| 1560 } | 1571 } |
| 1561 | 1572 |
| 1562 } // namespace dart | 1573 } // namespace dart |
| OLD | NEW |