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

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
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 virtual ~IsolateVisitor() {}
83
84 virtual void VisitIsolate(Isolate* isolate) = 0;
85
86 private:
siva 2014/02/06 00:37:24 DISALLOW stuff here?
Cutch 2014/02/06 17:51:51 Done.
87 };
88
89
78 class Isolate : public BaseIsolate { 90 class Isolate : public BaseIsolate {
79 public: 91 public:
80 ~Isolate(); 92 ~Isolate();
81 93
82 static inline Isolate* Current() { 94 static inline Isolate* Current() {
83 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); 95 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key));
84 } 96 }
85 97
86 static void SetCurrent(Isolate* isolate); 98 static void SetCurrent(Isolate* isolate);
87 99
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 } 410 }
399 411
400 Mutex* profiler_data_mutex() { 412 Mutex* profiler_data_mutex() {
401 return &profiler_data_mutex_; 413 return &profiler_data_mutex_;
402 } 414 }
403 415
404 void set_profiler_data(IsolateProfilerData* profiler_data) { 416 void set_profiler_data(IsolateProfilerData* profiler_data) {
405 profiler_data_ = profiler_data; 417 profiler_data_ = profiler_data;
406 } 418 }
407 419
408 IsolateProfilerData* profiler_data() { 420 IsolateProfilerData* profiler_data() const {
409 return profiler_data_; 421 return profiler_data_;
410 } 422 }
411 423
412 void PrintToJSONStream(JSONStream* stream); 424 void PrintToJSONStream(JSONStream* stream);
413 425
426 void set_thread_state(InterruptableThreadState* state) {
427 ASSERT((thread_state_ == NULL) || (state == NULL));
428 thread_state_ = state;
429 }
430
431 InterruptableThreadState* thread_state() const {
432 return thread_state_;
433 }
434
435 static void VisitIsolates(IsolateVisitor* visitor);
436
414 private: 437 private:
415 Isolate(); 438 Isolate();
416 439
417 void BuildName(const char* name_prefix); 440 void BuildName(const char* name_prefix);
418 void PrintInvokedFunctions(); 441 void PrintInvokedFunctions();
419 442
420 template<class T> T* AllocateReusableHandle(); 443 template<class T> T* AllocateReusableHandle();
421 444
422 static ThreadLocalKey isolate_key; 445 static ThreadLocalKey isolate_key;
423 446
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 intptr_t stack_frame_index_; 483 intptr_t stack_frame_index_;
461 ObjectHistogram* object_histogram_; 484 ObjectHistogram* object_histogram_;
462 485
463 bool cha_used_; 486 bool cha_used_;
464 487
465 // Ring buffer of objects assigned an id. 488 // Ring buffer of objects assigned an id.
466 ObjectIdRing* object_id_ring_; 489 ObjectIdRing* object_id_ring_;
467 490
468 IsolateProfilerData* profiler_data_; 491 IsolateProfilerData* profiler_data_;
469 Mutex profiler_data_mutex_; 492 Mutex profiler_data_mutex_;
493 InterruptableThreadState* thread_state_;
470 494
471 // Reusable handles support. 495 // Reusable handles support.
472 #define REUSABLE_HANDLE_FIELDS(object) \ 496 #define REUSABLE_HANDLE_FIELDS(object) \
473 object* object##_handle_; \ 497 object* object##_handle_; \
474 498
475 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS) 499 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_FIELDS)
476 #undef REUSABLE_HANDLE_FIELDS 500 #undef REUSABLE_HANDLE_FIELDS
477 VMHandles reusable_handles_; 501 VMHandles reusable_handles_;
478 502
479 static Dart_IsolateCreateCallback create_callback_; 503 static Dart_IsolateCreateCallback create_callback_;
480 static Dart_IsolateInterruptCallback interrupt_callback_; 504 static Dart_IsolateInterruptCallback interrupt_callback_;
481 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; 505 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_;
482 static Dart_IsolateShutdownCallback shutdown_callback_; 506 static Dart_IsolateShutdownCallback shutdown_callback_;
483 static Dart_FileOpenCallback file_open_callback_; 507 static Dart_FileOpenCallback file_open_callback_;
484 static Dart_FileReadCallback file_read_callback_; 508 static Dart_FileReadCallback file_read_callback_;
485 static Dart_FileWriteCallback file_write_callback_; 509 static Dart_FileWriteCallback file_write_callback_;
486 static Dart_FileCloseCallback file_close_callback_; 510 static Dart_FileCloseCallback file_close_callback_;
487 static Dart_EntropySource entropy_source_callback_; 511 static Dart_EntropySource entropy_source_callback_;
488 static Dart_IsolateInterruptCallback vmstats_callback_; 512 static Dart_IsolateInterruptCallback vmstats_callback_;
489 static Dart_ServiceIsolateCreateCalback service_create_callback_; 513 static Dart_ServiceIsolateCreateCalback service_create_callback_;
490 514
515 // Manage list of existing isolates.
516 static void IsolateCreated(Isolate* isolate);
517 static void IsolateShutdown(Isolate* isolate);
siva 2014/02/06 00:37:24 Why not call these functions AddIsolateToList and
Cutch 2014/02/06 17:51:51 Done.
518 static void CheckForDuplicateThreadState(InterruptableThreadState* state);
519 static Monitor* isolates_monitor_;
520 static Isolate* isolates_head_;
siva 2014/02/06 00:37:24 should we call these isolates_list_monitor_ and is
Cutch 2014/02/06 17:51:51 Done.
521 Isolate* next_;
siva 2014/02/06 00:37:24 style guide states this instance field should be g
Cutch 2014/02/06 17:51:51 Done.
522
491 friend class ReusableHandleScope; 523 friend class ReusableHandleScope;
492 friend class ReusableObjectHandleScope; 524 friend class ReusableObjectHandleScope;
525 friend class ThreadInterrupter;
526 friend class ThreadInterrupterAndroid;
527 friend class ThreadInterrupterMacOS;
528 friend class ThreadInterrupterLinux;
529 friend class ThreadInterrupterWin;
siva 2014/02/06 00:37:24 Are these friends still needed?
Cutch 2014/02/06 17:51:51 Nope. Removed.
530
493 DISALLOW_COPY_AND_ASSIGN(Isolate); 531 DISALLOW_COPY_AND_ASSIGN(Isolate);
494 }; 532 };
495 533
496 534
497 // When we need to execute code in an isolate, we use the 535 // When we need to execute code in an isolate, we use the
498 // StartIsolateScope. 536 // StartIsolateScope.
499 class StartIsolateScope { 537 class StartIsolateScope {
500 public: 538 public:
501 explicit StartIsolateScope(Isolate* new_isolate) 539 explicit StartIsolateScope(Isolate* new_isolate)
502 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { 540 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 char* script_url_; 620 char* script_url_;
583 char* library_url_; 621 char* library_url_;
584 char* class_name_; 622 char* class_name_;
585 char* function_name_; 623 char* function_name_;
586 char* exception_callback_name_; 624 char* exception_callback_name_;
587 }; 625 };
588 626
589 } // namespace dart 627 } // namespace dart
590 628
591 #endif // VM_ISOLATE_H_ 629 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698