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

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

Issue 128653004: Use list of isolates in profiler (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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/dart.cc ('k') | runtime/vm/isolate.cc » ('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 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/thread.h" 10 #include "platform/thread.h"
(...skipping 18 matching lines...) Expand all
29 class DeoptContext; 29 class DeoptContext;
30 class Field; 30 class Field;
31 class Function; 31 class Function;
32 class HandleScope; 32 class HandleScope;
33 class HandleVisitor; 33 class HandleVisitor;
34 class Heap; 34 class Heap;
35 class ICData; 35 class ICData;
36 class Instance; 36 class Instance;
37 class IsolateProfilerData; 37 class IsolateProfilerData;
38 class IsolateSpawnState; 38 class IsolateSpawnState;
39 class InterruptableThreadState;
39 class LongJumpScope; 40 class LongJumpScope;
40 class MessageHandler; 41 class MessageHandler;
41 class Mutex; 42 class Mutex;
42 class Object; 43 class Object;
43 class ObjectPointerVisitor; 44 class ObjectPointerVisitor;
44 class ObjectStore; 45 class ObjectStore;
45 class RawInstance; 46 class RawInstance;
46 class RawArray; 47 class RawArray;
47 class RawContext; 48 class RawContext;
48 class RawDouble; 49 class RawDouble;
(...skipping 19 matching lines...) Expand all
68 V(Array) \ 69 V(Array) \
69 V(String) \ 70 V(String) \
70 V(Instance) \ 71 V(Instance) \
71 V(Function) \ 72 V(Function) \
72 V(Field) \ 73 V(Field) \
73 V(Class) \ 74 V(Class) \
74 V(AbstractType) \ 75 V(AbstractType) \
75 V(TypeParameter) \ 76 V(TypeParameter) \
76 V(TypeArguments) \ 77 V(TypeArguments) \
77 78
79
80 class IsolateVisitor {
81 public:
82 IsolateVisitor() {}
83 virtual ~IsolateVisitor() {}
84
85 virtual void VisitIsolate(Isolate* isolate) = 0;
86
87 private:
88 DISALLOW_COPY_AND_ASSIGN(IsolateVisitor);
89 };
90
91
78 class Isolate : public BaseIsolate { 92 class Isolate : public BaseIsolate {
79 public: 93 public:
80 ~Isolate(); 94 ~Isolate();
81 95
82 static inline Isolate* Current() { 96 static inline Isolate* Current() {
83 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); 97 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key));
84 } 98 }
85 99
86 static void SetCurrent(Isolate* isolate); 100 static void SetCurrent(Isolate* isolate);
87 101
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 412 }
399 413
400 Mutex* profiler_data_mutex() { 414 Mutex* profiler_data_mutex() {
401 return &profiler_data_mutex_; 415 return &profiler_data_mutex_;
402 } 416 }
403 417
404 void set_profiler_data(IsolateProfilerData* profiler_data) { 418 void set_profiler_data(IsolateProfilerData* profiler_data) {
405 profiler_data_ = profiler_data; 419 profiler_data_ = profiler_data;
406 } 420 }
407 421
408 IsolateProfilerData* profiler_data() { 422 IsolateProfilerData* profiler_data() const {
409 return profiler_data_; 423 return profiler_data_;
410 } 424 }
411 425
412 void PrintToJSONStream(JSONStream* stream); 426 void PrintToJSONStream(JSONStream* stream);
413 427
428 void set_thread_state(InterruptableThreadState* state) {
429 ASSERT((thread_state_ == NULL) || (state == NULL));
430 thread_state_ = state;
431 }
432
433 InterruptableThreadState* thread_state() const {
434 return thread_state_;
435 }
436
437 static void VisitIsolates(IsolateVisitor* visitor);
438
414 private: 439 private:
415 Isolate(); 440 Isolate();
416 441
417 void BuildName(const char* name_prefix); 442 void BuildName(const char* name_prefix);
418 void PrintInvokedFunctions(); 443 void PrintInvokedFunctions();
419 444
420 template<class T> T* AllocateReusableHandle(); 445 template<class T> T* AllocateReusableHandle();
421 446
422 static ThreadLocalKey isolate_key; 447 static ThreadLocalKey isolate_key;
423 448
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 intptr_t stack_frame_index_; 485 intptr_t stack_frame_index_;
461 ObjectHistogram* object_histogram_; 486 ObjectHistogram* object_histogram_;
462 487
463 bool cha_used_; 488 bool cha_used_;
464 489
465 // Ring buffer of objects assigned an id. 490 // Ring buffer of objects assigned an id.
466 ObjectIdRing* object_id_ring_; 491 ObjectIdRing* object_id_ring_;
467 492
468 IsolateProfilerData* profiler_data_; 493 IsolateProfilerData* profiler_data_;
469 Mutex profiler_data_mutex_; 494 Mutex profiler_data_mutex_;
495 InterruptableThreadState* thread_state_;
496
497 // Isolate list next pointer.
498 Isolate* next_;
470 499
471 // Reusable handles support. 500 // Reusable handles support.
472 #define REUSABLE_HANDLE_FIELDS(object) \ 501 #define REUSABLE_HANDLE_FIELDS(object) \
473 object* object##_handle_; \ 502 object* object##_handle_; \
474 503
475 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) 504 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS)
476 #undef REUSABLE_HANDLE_FIELDS 505 #undef REUSABLE_HANDLE_FIELDS
477 VMHandles reusable_handles_; 506 VMHandles reusable_handles_;
478 507
479 static Dart_IsolateCreateCallback create_callback_; 508 static Dart_IsolateCreateCallback create_callback_;
480 static Dart_IsolateInterruptCallback interrupt_callback_; 509 static Dart_IsolateInterruptCallback interrupt_callback_;
481 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; 510 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_;
482 static Dart_IsolateShutdownCallback shutdown_callback_; 511 static Dart_IsolateShutdownCallback shutdown_callback_;
483 static Dart_FileOpenCallback file_open_callback_; 512 static Dart_FileOpenCallback file_open_callback_;
484 static Dart_FileReadCallback file_read_callback_; 513 static Dart_FileReadCallback file_read_callback_;
485 static Dart_FileWriteCallback file_write_callback_; 514 static Dart_FileWriteCallback file_write_callback_;
486 static Dart_FileCloseCallback file_close_callback_; 515 static Dart_FileCloseCallback file_close_callback_;
487 static Dart_EntropySource entropy_source_callback_; 516 static Dart_EntropySource entropy_source_callback_;
488 static Dart_IsolateInterruptCallback vmstats_callback_; 517 static Dart_IsolateInterruptCallback vmstats_callback_;
489 static Dart_ServiceIsolateCreateCalback service_create_callback_; 518 static Dart_ServiceIsolateCreateCalback service_create_callback_;
490 519
520 // Manage list of existing isolates.
521 static void AddIsolateTolist(Isolate* isolate);
522 static void RemoveIsolateFromList(Isolate* isolate);
523 static void CheckForDuplicateThreadState(InterruptableThreadState* state);
524 static Monitor* isolates_list_monitor_;
525 static Isolate* isolates_list_head_;
526
491 friend class ReusableHandleScope; 527 friend class ReusableHandleScope;
492 friend class ReusableObjectHandleScope; 528 friend class ReusableObjectHandleScope;
529
493 DISALLOW_COPY_AND_ASSIGN(Isolate); 530 DISALLOW_COPY_AND_ASSIGN(Isolate);
494 }; 531 };
495 532
496 533
497 // When we need to execute code in an isolate, we use the 534 // When we need to execute code in an isolate, we use the
498 // StartIsolateScope. 535 // StartIsolateScope.
499 class StartIsolateScope { 536 class StartIsolateScope {
500 public: 537 public:
501 explicit StartIsolateScope(Isolate* new_isolate) 538 explicit StartIsolateScope(Isolate* new_isolate)
502 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { 539 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 char* script_url_; 619 char* script_url_;
583 char* library_url_; 620 char* library_url_;
584 char* class_name_; 621 char* class_name_;
585 char* function_name_; 622 char* function_name_;
586 char* exception_callback_name_; 623 char* exception_callback_name_;
587 }; 624 };
588 625
589 } // namespace dart 626 } // namespace dart
590 627
591 #endif // VM_ISOLATE_H_ 628 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698