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

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
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, "Log only named isolate.");
koda 2015/02/09 17:57:29 This is actually a substring filter, so say that.
Cutch 2015/02/09 18:19:39 Done.
50 51
51 // Quick access to the locally defined isolate() method. 52 // Quick access to the locally defined isolate() method.
52 #define I (isolate()) 53 #define I (isolate())
53 54
54 55
55 #if defined(DEBUG) 56 #if defined(DEBUG)
56 // Helper class to ensure that a live origin_id is never reused 57 // Helper class to ensure that a live origin_id is never reused
57 // and assigned to an isolate. 58 // and assigned to an isolate.
58 class VerifyOriginId : public IsolateVisitor { 59 class VerifyOriginId : public IsolateVisitor {
59 public: 60 public:
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 stack_base_(0), 469 stack_base_(0),
469 stack_overflow_flags_(0), 470 stack_overflow_flags_(0),
470 stack_overflow_count_(0), 471 stack_overflow_count_(0),
471 message_handler_(NULL), 472 message_handler_(NULL),
472 spawn_state_(NULL), 473 spawn_state_(NULL),
473 is_runnable_(false), 474 is_runnable_(false),
474 gc_prologue_callback_(NULL), 475 gc_prologue_callback_(NULL),
475 gc_epilogue_callback_(NULL), 476 gc_epilogue_callback_(NULL),
476 defer_finalization_count_(0), 477 defer_finalization_count_(0),
477 deopt_context_(NULL), 478 deopt_context_(NULL),
479 service_isolate_(false),
480 log_(new class Log()),
478 stacktrace_(NULL), 481 stacktrace_(NULL),
479 stack_frame_index_(-1), 482 stack_frame_index_(-1),
480 last_allocationprofile_accumulator_reset_timestamp_(0), 483 last_allocationprofile_accumulator_reset_timestamp_(0),
481 last_allocationprofile_gc_timestamp_(0), 484 last_allocationprofile_gc_timestamp_(0),
482 cha_(NULL), 485 cha_(NULL),
483 object_id_ring_(NULL), 486 object_id_ring_(NULL),
484 trace_buffer_(NULL), 487 trace_buffer_(NULL),
485 profiler_data_(NULL), 488 profiler_data_(NULL),
486 thread_state_(NULL), 489 thread_state_(NULL),
487 tag_table_(GrowableObjectArray::null()), 490 tag_table_(GrowableObjectArray::null()),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 saved_stack_limit_(0), 530 saved_stack_limit_(0),
528 stack_overflow_flags_(0), 531 stack_overflow_flags_(0),
529 stack_overflow_count_(0), 532 stack_overflow_count_(0),
530 message_handler_(NULL), 533 message_handler_(NULL),
531 spawn_state_(NULL), 534 spawn_state_(NULL),
532 is_runnable_(false), 535 is_runnable_(false),
533 gc_prologue_callback_(NULL), 536 gc_prologue_callback_(NULL),
534 gc_epilogue_callback_(NULL), 537 gc_epilogue_callback_(NULL),
535 defer_finalization_count_(0), 538 defer_finalization_count_(0),
536 deopt_context_(NULL), 539 deopt_context_(NULL),
540 service_isolate_(false),
541 log_(new class Log()),
537 stacktrace_(NULL), 542 stacktrace_(NULL),
538 stack_frame_index_(-1), 543 stack_frame_index_(-1),
539 last_allocationprofile_accumulator_reset_timestamp_(0), 544 last_allocationprofile_accumulator_reset_timestamp_(0),
540 last_allocationprofile_gc_timestamp_(0), 545 last_allocationprofile_gc_timestamp_(0),
541 cha_(NULL), 546 cha_(NULL),
542 object_id_ring_(NULL), 547 object_id_ring_(NULL),
543 trace_buffer_(NULL), 548 trace_buffer_(NULL),
544 profiler_data_(NULL), 549 profiler_data_(NULL),
545 thread_state_(NULL), 550 thread_state_(NULL),
546 tag_table_(GrowableObjectArray::null()), 551 tag_table_(GrowableObjectArray::null()),
(...skipping 17 matching lines...) Expand all
564 delete debugger_; 569 delete debugger_;
565 #if defined(USING_SIMULATOR) 570 #if defined(USING_SIMULATOR)
566 delete simulator_; 571 delete simulator_;
567 #endif 572 #endif
568 delete mutex_; 573 delete mutex_;
569 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. 574 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate.
570 delete message_handler_; 575 delete message_handler_;
571 message_handler_ = NULL; // Fail fast if we send messages to a dead isolate. 576 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. 577 ASSERT(deopt_context_ == NULL); // No deopt in progress when isolate deleted.
573 delete spawn_state_; 578 delete spawn_state_;
579 delete log_;
580 log_ = NULL;
574 } 581 }
575 582
576 583
577 void Isolate::SetCurrent(Isolate* current) { 584 void Isolate::SetCurrent(Isolate* current) {
578 Isolate* old_current = Current(); 585 Isolate* old_current = Current();
579 if (old_current != NULL) { 586 if (old_current != NULL) {
580 old_current->set_vm_tag(VMTag::kIdleTagId); 587 old_current->set_vm_tag(VMTag::kIdleTagId);
581 old_current->set_thread_state(NULL); 588 old_current->set_thread_state(NULL);
582 Profiler::EndExecution(old_current); 589 Profiler::EndExecution(old_current);
583 } 590 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 name_ = strdup(name_prefix); 695 name_ = strdup(name_prefix);
689 return; 696 return;
690 } 697 }
691 const char* kFormat = "%s-%lld"; 698 const char* kFormat = "%s-%lld";
692 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; 699 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1;
693 name_ = reinterpret_cast<char*>(malloc(len)); 700 name_ = reinterpret_cast<char*>(malloc(len));
694 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); 701 OS::SNPrint(name_, len, kFormat, name_prefix, main_port());
695 } 702 }
696 703
697 704
705 Log* Isolate::Log() const {
706 if (FLAG_isolate_log_filter == NULL) {
707 if (service_isolate_) {
708 // By default, do not log for the service isolate.
709 return Log::NoOpLog();
710 }
711 return log_;
712 }
713 ASSERT(name_ != NULL);
714 if (strstr(name_, FLAG_isolate_log_filter) == NULL) {
715 // Filter does not match, do not log for this isolate.
716 return Log::NoOpLog();
717 }
718 return log_;
719 }
720
721
698 // TODO(5411455): Use flag to override default value and Validate the 722 // TODO(5411455): Use flag to override default value and Validate the
699 // stack size by querying OS. 723 // stack size by querying OS.
700 uword Isolate::GetSpecifiedStackSize() { 724 uword Isolate::GetSpecifiedStackSize() {
701 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); 725 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize());
702 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; 726 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer;
703 return stack_size; 727 return stack_size;
704 } 728 }
705 729
706 730
707 void Isolate::SetStackLimitFromStackBase(uword stack_base) { 731 void Isolate::SetStackLimitFromStackBase(uword stack_base) {
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 serialized_message_, serialized_message_len_); 1672 serialized_message_, serialized_message_len_);
1649 } 1673 }
1650 1674
1651 1675
1652 void IsolateSpawnState::Cleanup() { 1676 void IsolateSpawnState::Cleanup() {
1653 SwitchIsolateScope switch_scope(I); 1677 SwitchIsolateScope switch_scope(I);
1654 Dart::ShutdownIsolate(); 1678 Dart::ShutdownIsolate();
1655 } 1679 }
1656 1680
1657 } // namespace dart 1681 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698