Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: runtime/vm/isolate.cc

Issue 230863005: Initial UserTag and dart:profiler library (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "lib/mirrors.h" 10 #include "lib/mirrors.h"
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 gc_prologue_callback_(NULL), 329 gc_prologue_callback_(NULL),
330 gc_epilogue_callback_(NULL), 330 gc_epilogue_callback_(NULL),
331 defer_finalization_count_(0), 331 defer_finalization_count_(0),
332 deopt_context_(NULL), 332 deopt_context_(NULL),
333 stacktrace_(NULL), 333 stacktrace_(NULL),
334 stack_frame_index_(-1), 334 stack_frame_index_(-1),
335 cha_used_(false), 335 cha_used_(false),
336 object_id_ring_(NULL), 336 object_id_ring_(NULL),
337 profiler_data_(NULL), 337 profiler_data_(NULL),
338 thread_state_(NULL), 338 thread_state_(NULL),
339 tag_table_(GrowableObjectArray::null()),
340 current_tag_(UserTag::null()),
339 next_(NULL), 341 next_(NULL),
340 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) 342 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
341 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) 343 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
342 reusable_handles_() { 344 reusable_handles_() {
343 set_vm_tag(VMTag::kIdleTagId); 345 set_vm_tag(VMTag::kIdleTagId);
346 set_user_tag(UserTags::kNoUserTag);
344 } 347 }
345 #undef REUSABLE_HANDLE_SCOPE_INIT 348 #undef REUSABLE_HANDLE_SCOPE_INIT
346 #undef REUSABLE_HANDLE_INITIALIZERS 349 #undef REUSABLE_HANDLE_INITIALIZERS
347 350
348 351
349 Isolate::~Isolate() { 352 Isolate::~Isolate() {
350 delete [] name_; 353 delete [] name_;
351 delete heap_; 354 delete heap_;
352 delete object_store_; 355 delete object_store_;
353 delete api_state_; 356 delete api_state_;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 446
444 result->debugger_ = new Debugger(); 447 result->debugger_ = new Debugger();
445 result->debugger_->Initialize(result); 448 result->debugger_->Initialize(result);
446 if (FLAG_trace_isolates) { 449 if (FLAG_trace_isolates) {
447 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { 450 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) {
448 OS::Print("[+] Starting isolate:\n" 451 OS::Print("[+] Starting isolate:\n"
449 "\tisolate: %s\n", result->name()); 452 "\tisolate: %s\n", result->name());
450 } 453 }
451 } 454 }
452 455
453
454 return result; 456 return result;
455 } 457 }
456 458
457 459
458 void Isolate::BuildName(const char* name_prefix) { 460 void Isolate::BuildName(const char* name_prefix) {
459 ASSERT(name_ == NULL); 461 ASSERT(name_ == NULL);
460 if (name_prefix == NULL) { 462 if (name_prefix == NULL) {
461 name_prefix = "isolate"; 463 name_prefix = "isolate";
462 } 464 }
463 const char* kFormat = "%s-%lld"; 465 const char* kFormat = "%s-%lld";
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 } 844 }
843 845
844 // Visit the dart api state for all local and persistent handles. 846 // Visit the dart api state for all local and persistent handles.
845 if (api_state() != NULL) { 847 if (api_state() != NULL) {
846 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); 848 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles);
847 } 849 }
848 850
849 // Visit the top context which is stored in the isolate. 851 // Visit the top context which is stored in the isolate.
850 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); 852 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_));
851 853
854 // Visit the current tag which is stored in the isolate.
855 visitor->VisitPointer(reinterpret_cast<RawObject**>(&current_tag_));
856
857 // Visit the tag table which is stored in the isolate.
858 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_));
859
852 // Visit objects in the debugger. 860 // Visit objects in the debugger.
853 debugger()->VisitObjectPointers(visitor); 861 debugger()->VisitObjectPointers(visitor);
854 862
855 // Visit objects that are being used for deoptimization. 863 // Visit objects that are being used for deoptimization.
856 if (deopt_context() != NULL) { 864 if (deopt_context() != NULL) {
857 deopt_context()->VisitObjectPointers(visitor); 865 deopt_context()->VisitObjectPointers(visitor);
858 } 866 }
859 } 867 }
860 868
861 869
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
961 ASSERT(state->id != Thread::kInvalidThreadId); 969 ASSERT(state->id != Thread::kInvalidThreadId);
962 ThreadInterrupter::InterruptThread(state); 970 ThreadInterrupter::InterruptThread(state);
963 } 971 }
964 972
965 973
966 void Isolate::ProfileIdle() { 974 void Isolate::ProfileIdle() {
967 vm_tag_counters_.Increment(vm_tag()); 975 vm_tag_counters_.Increment(vm_tag());
968 } 976 }
969 977
970 978
979 void Isolate::set_tag_table(const GrowableObjectArray& value) {
980 tag_table_ = value.raw();
981 }
982
983
984 void Isolate::set_current_tag(const UserTag& tag) {
985 intptr_t user_tag = tag.tag();
986 set_user_tag(static_cast<uword>(user_tag));
987 current_tag_ = tag.raw();
988 }
989
990
991 void Isolate::clear_current_tag() {
992 set_user_tag(UserTags::kNoUserTag);
993 current_tag_ = UserTag::null();
994 }
995
996
971 void Isolate::VisitIsolates(IsolateVisitor* visitor) { 997 void Isolate::VisitIsolates(IsolateVisitor* visitor) {
972 if (visitor == NULL) { 998 if (visitor == NULL) {
973 return; 999 return;
974 } 1000 }
975 MonitorLocker ml(isolates_list_monitor_); 1001 MonitorLocker ml(isolates_list_monitor_);
976 Isolate* current = isolates_list_head_; 1002 Isolate* current = isolates_list_head_;
977 while (current) { 1003 while (current) {
978 visitor->VisitIsolate(current); 1004 visitor->VisitIsolate(current);
979 current = current->next_; 1005 current = current->next_;
980 } 1006 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return func.raw(); 1156 return func.raw();
1131 } 1157 }
1132 1158
1133 1159
1134 void IsolateSpawnState::Cleanup() { 1160 void IsolateSpawnState::Cleanup() {
1135 SwitchIsolateScope switch_scope(isolate()); 1161 SwitchIsolateScope switch_scope(isolate());
1136 Dart::ShutdownIsolate(); 1162 Dart::ShutdownIsolate();
1137 } 1163 }
1138 1164
1139 } // namespace dart 1165 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698