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

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
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 449
447 result->debugger_ = new Debugger(); 450 result->debugger_ = new Debugger();
448 result->debugger_->Initialize(result); 451 result->debugger_->Initialize(result);
449 if (FLAG_trace_isolates) { 452 if (FLAG_trace_isolates) {
450 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) { 453 if (name_prefix == NULL || strcmp(name_prefix, "vm-isolate") != 0) {
451 OS::Print("[+] Starting isolate:\n" 454 OS::Print("[+] Starting isolate:\n"
452 "\tisolate: %s\n", result->name()); 455 "\tisolate: %s\n", result->name());
453 } 456 }
454 } 457 }
455 458
456
457 return result; 459 return result;
458 } 460 }
459 461
460 462
461 void Isolate::BuildName(const char* name_prefix) { 463 void Isolate::BuildName(const char* name_prefix) {
462 ASSERT(name_ == NULL); 464 ASSERT(name_ == NULL);
463 if (name_prefix == NULL) { 465 if (name_prefix == NULL) {
464 name_prefix = "isolate"; 466 name_prefix = "isolate";
465 } 467 }
466 const char* kFormat = "%s-%lld"; 468 const char* kFormat = "%s-%lld";
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 } 847 }
846 848
847 // Visit the dart api state for all local and persistent handles. 849 // Visit the dart api state for all local and persistent handles.
848 if (api_state() != NULL) { 850 if (api_state() != NULL) {
849 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles); 851 api_state()->VisitObjectPointers(visitor, visit_prologue_weak_handles);
850 } 852 }
851 853
852 // Visit the top context which is stored in the isolate. 854 // Visit the top context which is stored in the isolate.
853 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_)); 855 visitor->VisitPointer(reinterpret_cast<RawObject**>(&top_context_));
854 856
857 // Visit the current tag which is stored in the isolate.
858 visitor->VisitPointer(reinterpret_cast<RawObject**>(&current_tag_));
859
860 // Visit the tag table which is stored in the isolate.
861 visitor->VisitPointer(reinterpret_cast<RawObject**>(&tag_table_));
862
855 // Visit objects in the debugger. 863 // Visit objects in the debugger.
856 debugger()->VisitObjectPointers(visitor); 864 debugger()->VisitObjectPointers(visitor);
857 865
858 // Visit objects that are being used for deoptimization. 866 // Visit objects that are being used for deoptimization.
859 if (deopt_context() != NULL) { 867 if (deopt_context() != NULL) {
860 deopt_context()->VisitObjectPointers(visitor); 868 deopt_context()->VisitObjectPointers(visitor);
861 } 869 }
862 } 870 }
863 871
864 872
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 ASSERT(state->id != Thread::kInvalidThreadId); 972 ASSERT(state->id != Thread::kInvalidThreadId);
965 ThreadInterrupter::InterruptThread(state); 973 ThreadInterrupter::InterruptThread(state);
966 } 974 }
967 975
968 976
969 void Isolate::ProfileIdle() { 977 void Isolate::ProfileIdle() {
970 vm_tag_counters_.Increment(vm_tag()); 978 vm_tag_counters_.Increment(vm_tag());
971 } 979 }
972 980
973 981
982 void Isolate::set_tag_table(const GrowableObjectArray& value) {
983 tag_table_ = value.raw();
984 }
985
986
987 void Isolate::set_current_tag(const UserTag& tag) {
988 intptr_t user_tag = tag.tag();
989 set_user_tag(static_cast<uword>(user_tag));
990 current_tag_ = tag.raw();
991 }
992
993
994 void Isolate::clear_current_tag() {
995 set_user_tag(UserTags::kNoUserTag);
996 current_tag_ = UserTag::null();
997 }
998
999
974 void Isolate::VisitIsolates(IsolateVisitor* visitor) { 1000 void Isolate::VisitIsolates(IsolateVisitor* visitor) {
975 if (visitor == NULL) { 1001 if (visitor == NULL) {
976 return; 1002 return;
977 } 1003 }
978 MonitorLocker ml(isolates_list_monitor_); 1004 MonitorLocker ml(isolates_list_monitor_);
979 Isolate* current = isolates_list_head_; 1005 Isolate* current = isolates_list_head_;
980 while (current) { 1006 while (current) {
981 visitor->VisitIsolate(current); 1007 visitor->VisitIsolate(current);
982 current = current->next_; 1008 current = current->next_;
983 } 1009 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 return func.raw(); 1159 return func.raw();
1134 } 1160 }
1135 1161
1136 1162
1137 void IsolateSpawnState::Cleanup() { 1163 void IsolateSpawnState::Cleanup() {
1138 SwitchIsolateScope switch_scope(isolate()); 1164 SwitchIsolateScope switch_scope(isolate());
1139 Dart::ShutdownIsolate(); 1165 Dart::ShutdownIsolate();
1140 } 1166 }
1141 1167
1142 } // namespace dart 1168 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/object.h » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698