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

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

Issue 913503004: Per isolate Log with block support (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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/isolate.h ('k') | runtime/vm/log.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 "vm/code_observers.h" 10 #include "vm/code_observers.h"
11 #include "vm/compiler_stats.h" 11 #include "vm/compiler_stats.h"
12 #include "vm/coverage.h" 12 #include "vm/coverage.h"
13 #include "vm/dart_api_state.h" 13 #include "vm/dart_api_state.h"
14 #include "vm/dart_entry.h" 14 #include "vm/dart_entry.h"
15 #include "vm/debugger.h" 15 #include "vm/debugger.h"
16 #include "vm/deopt_instructions.h" 16 #include "vm/deopt_instructions.h"
17 #include "vm/heap.h" 17 #include "vm/heap.h"
18 #include "vm/lockers.h" 18 #include "vm/lockers.h"
19 #include "vm/log.h"
19 #include "vm/message_handler.h" 20 #include "vm/message_handler.h"
20 #include "vm/object_id_ring.h" 21 #include "vm/object_id_ring.h"
21 #include "vm/object_store.h" 22 #include "vm/object_store.h"
22 #include "vm/parser.h" 23 #include "vm/parser.h"
23 #include "vm/port.h" 24 #include "vm/port.h"
24 #include "vm/profiler.h" 25 #include "vm/profiler.h"
25 #include "vm/reusable_handles.h" 26 #include "vm/reusable_handles.h"
26 #include "vm/service.h" 27 #include "vm/service.h"
27 #include "vm/simulator.h" 28 #include "vm/simulator.h"
28 #include "vm/stack_frame.h" 29 #include "vm/stack_frame.h"
(...skipping 10 matching lines...) Expand all
39 40
40 DEFINE_FLAG(bool, trace_isolates, false, 41 DEFINE_FLAG(bool, trace_isolates, false,
41 "Trace isolate creation and shut down."); 42 "Trace isolate creation and shut down.");
42 DEFINE_FLAG(bool, pause_isolates_on_start, false, 43 DEFINE_FLAG(bool, pause_isolates_on_start, false,
43 "Pause isolates before starting."); 44 "Pause isolates before starting.");
44 DEFINE_FLAG(bool, pause_isolates_on_exit, false, 45 DEFINE_FLAG(bool, pause_isolates_on_exit, false,
45 "Pause isolates exiting."); 46 "Pause isolates exiting.");
46 DEFINE_FLAG(bool, break_at_isolate_spawn, false, 47 DEFINE_FLAG(bool, break_at_isolate_spawn, false,
47 "Insert a one-time breakpoint at the entrypoint for all spawned " 48 "Insert a one-time breakpoint at the entrypoint for all spawned "
48 "isolates"); 49 "isolates");
49 50 DEFINE_FLAG(charp, isolate_log_filter, NULL,
51 "Log isolates whose name include the filter. "
52 "Default: service isolate log messages are suppressed.");
50 53
51 // Quick access to the locally defined isolate() method. 54 // Quick access to the locally defined isolate() method.
52 #define I (isolate()) 55 #define I (isolate())
53 56
54 57
55 #if defined(DEBUG) 58 #if defined(DEBUG)
56 // Helper class to ensure that a live origin_id is never reused 59 // Helper class to ensure that a live origin_id is never reused
57 // and assigned to an isolate. 60 // and assigned to an isolate.
58 class VerifyOriginId : public IsolateVisitor { 61 class VerifyOriginId : public IsolateVisitor {
59 public: 62 public:
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 stack_base_(0), 471 stack_base_(0),
469 stack_overflow_flags_(0), 472 stack_overflow_flags_(0),
470 stack_overflow_count_(0), 473 stack_overflow_count_(0),
471 message_handler_(NULL), 474 message_handler_(NULL),
472 spawn_state_(NULL), 475 spawn_state_(NULL),
473 is_runnable_(false), 476 is_runnable_(false),
474 gc_prologue_callback_(NULL), 477 gc_prologue_callback_(NULL),
475 gc_epilogue_callback_(NULL), 478 gc_epilogue_callback_(NULL),
476 defer_finalization_count_(0), 479 defer_finalization_count_(0),
477 deopt_context_(NULL), 480 deopt_context_(NULL),
481 is_service_isolate_(false),
482 log_(new class Log()),
478 stacktrace_(NULL), 483 stacktrace_(NULL),
479 stack_frame_index_(-1), 484 stack_frame_index_(-1),
480 last_allocationprofile_accumulator_reset_timestamp_(0), 485 last_allocationprofile_accumulator_reset_timestamp_(0),
481 last_allocationprofile_gc_timestamp_(0), 486 last_allocationprofile_gc_timestamp_(0),
482 cha_(NULL), 487 cha_(NULL),
483 object_id_ring_(NULL), 488 object_id_ring_(NULL),
484 trace_buffer_(NULL), 489 trace_buffer_(NULL),
485 profiler_data_(NULL), 490 profiler_data_(NULL),
486 thread_state_(NULL), 491 thread_state_(NULL),
487 tag_table_(GrowableObjectArray::null()), 492 tag_table_(GrowableObjectArray::null()),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 saved_stack_limit_(0), 532 saved_stack_limit_(0),
528 stack_overflow_flags_(0), 533 stack_overflow_flags_(0),
529 stack_overflow_count_(0), 534 stack_overflow_count_(0),
530 message_handler_(NULL), 535 message_handler_(NULL),
531 spawn_state_(NULL), 536 spawn_state_(NULL),
532 is_runnable_(false), 537 is_runnable_(false),
533 gc_prologue_callback_(NULL), 538 gc_prologue_callback_(NULL),
534 gc_epilogue_callback_(NULL), 539 gc_epilogue_callback_(NULL),
535 defer_finalization_count_(0), 540 defer_finalization_count_(0),
536 deopt_context_(NULL), 541 deopt_context_(NULL),
542 is_service_isolate_(false),
543 log_(new class Log()),
537 stacktrace_(NULL), 544 stacktrace_(NULL),
538 stack_frame_index_(-1), 545 stack_frame_index_(-1),
539 last_allocationprofile_accumulator_reset_timestamp_(0), 546 last_allocationprofile_accumulator_reset_timestamp_(0),
540 last_allocationprofile_gc_timestamp_(0), 547 last_allocationprofile_gc_timestamp_(0),
541 cha_(NULL), 548 cha_(NULL),
542 object_id_ring_(NULL), 549 object_id_ring_(NULL),
543 trace_buffer_(NULL), 550 trace_buffer_(NULL),
544 profiler_data_(NULL), 551 profiler_data_(NULL),
545 thread_state_(NULL), 552 thread_state_(NULL),
546 tag_table_(GrowableObjectArray::null()), 553 tag_table_(GrowableObjectArray::null()),
(...skipping 17 matching lines...) Expand all
564 delete debugger_; 571 delete debugger_;
565 #if defined(USING_SIMULATOR) 572 #if defined(USING_SIMULATOR)
566 delete simulator_; 573 delete simulator_;
567 #endif 574 #endif
568 delete mutex_; 575 delete mutex_;
569 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. 576 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate.
570 delete message_handler_; 577 delete message_handler_;
571 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. 578 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate.
572 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted. 579 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted.
573 delete spawn_state_; 580 delete spawn_state_;
581 delete log_;
582 log_ = NULL;
574 } 583 }
575 584
576 585
577 void Isolate::SetCurrent(Isolate* current) { 586 void Isolate::SetCurrent(Isolate* current) {
578 Isolate* old_current = Current(); 587 Isolate* old_current = Current();
579 if (old_current != NULL) { 588 if (old_current != NULL) {
580 old_current->set_vm_tag(VMTag::kIdleTagId); 589 old_current->set_vm_tag(VMTag::kIdleTagId);
581 old_current->set_thread_state(NULL); 590 old_current->set_thread_state(NULL);
582 Profiler::EndExecution(old_current); 591 Profiler::EndExecution(old_current);
583 } 592 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 name_ = strdup(name_prefix); 697 name_ = strdup(name_prefix);
689 return; 698 return;
690 } 699 }
691 const char* kFormat = "%s-%lld"; 700 const char* kFormat = "%s-%lld";
692 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; 701 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1;
693 name_ = reinterpret_cast<char*>(malloc(len)); 702 name_ = reinterpret_cast<char*>(malloc(len));
694 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); 703 OS::SNPrint(name_, len, kFormat, name_prefix, main_port());
695 } 704 }
696 705
697 706
707 Log* Isolate::Log() const {
708 if (FLAG_isolate_log_filter == NULL) {
709 if (is_service_isolate_) {
710 // By default, do not log for the service isolate.
711 return Log::NoOpLog();
712 }
713 return log_;
714 }
715 ASSERT(name_ != NULL);
716 if (strstr(name_, FLAG_isolate_log_filter) == NULL) {
717 // Filter does not match, do not log for this isolate.
718 return Log::NoOpLog();
719 }
720 return log_;
721 }
722
723
698 // TODO(5411455): Use flag to override default value and Validate the 724 // TODO(5411455): Use flag to override default value and Validate the
699 // stack size by querying OS. 725 // stack size by querying OS.
700 uword Isolate::GetSpecifiedStackSize() { 726 uword Isolate::GetSpecifiedStackSize() {
701 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); 727 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize());
702 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; 728 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer;
703 return stack_size; 729 return stack_size;
704 } 730 }
705 731
706 732
707 void Isolate::SetStackLimitFromStackBase(uword stack_base) { 733 void Isolate::SetStackLimitFromStackBase(uword stack_base) {
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 serialized_message_, serialized_message_len_); 1674 serialized_message_, serialized_message_len_);
1649 } 1675 }
1650 1676
1651 1677
1652 void IsolateSpawnState::Cleanup() { 1678 void IsolateSpawnState::Cleanup() {
1653 SwitchIsolateScope switch_scope(I); 1679 SwitchIsolateScope switch_scope(I);
1654 Dart::ShutdownIsolate(); 1680 Dart::ShutdownIsolate();
1655 } 1681 }
1656 1682
1657 } // namespace dart 1683 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/isolate.h ('k') | runtime/vm/log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698