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

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

Issue 584023004: Service isolate rework (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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"
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 metrics_list_head_(NULL), 548 metrics_list_head_(NULL),
549 next_(NULL), 549 next_(NULL),
550 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS) 550 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_INITIALIZERS)
551 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT) 551 REUSABLE_HANDLE_LIST(REUSABLE_HANDLE_SCOPE_INIT)
552 reusable_handles_() { 552 reusable_handles_() {
553 } 553 }
554 #undef REUSABLE_HANDLE_SCOPE_INIT 554 #undef REUSABLE_HANDLE_SCOPE_INIT
555 #undef REUSABLE_HANDLE_INITIALIZERS 555 #undef REUSABLE_HANDLE_INITIALIZERS
556 556
557 Isolate::~Isolate() { 557 Isolate::~Isolate() {
558 delete [] name_; 558 free(name_);
559 delete heap_; 559 delete heap_;
560 delete object_store_; 560 delete object_store_;
561 delete api_state_; 561 delete api_state_;
562 delete stub_code_; 562 delete stub_code_;
563 delete debugger_; 563 delete debugger_;
564 #if defined(USING_SIMULATOR) 564 #if defined(USING_SIMULATOR)
565 delete simulator_; 565 delete simulator_;
566 #endif 566 #endif
567 delete mutex_; 567 delete mutex_;
568 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate. 568 mutex_ = NULL; // Fail fast if interrupts are scheduled on a dead isolate.
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 676
677 return result; 677 return result;
678 } 678 }
679 679
680 680
681 void Isolate::BuildName(const char* name_prefix) { 681 void Isolate::BuildName(const char* name_prefix) {
682 ASSERT(name_ == NULL); 682 ASSERT(name_ == NULL);
683 if (name_prefix == NULL) { 683 if (name_prefix == NULL) {
684 name_prefix = "isolate"; 684 name_prefix = "isolate";
685 } 685 }
686 if (Service::IsServiceIsolateName(name_prefix)) {
687 name_ = strdup(name_prefix);
688 return;
689 }
686 const char* kFormat = "%s-%lld"; 690 const char* kFormat = "%s-%lld";
687 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1; 691 intptr_t len = OS::SNPrint(NULL, 0, kFormat, name_prefix, main_port()) + 1;
688 name_ = new char[len]; 692 name_ = reinterpret_cast<char*>(malloc(len));
689 OS::SNPrint(name_, len, kFormat, name_prefix, main_port()); 693 OS::SNPrint(name_, len, kFormat, name_prefix, main_port());
690 } 694 }
691 695
692 696
693 // TODO(5411455): Use flag to override default value and Validate the 697 // TODO(5411455): Use flag to override default value and Validate the
694 // stack size by querying OS. 698 // stack size by querying OS.
695 uword Isolate::GetSpecifiedStackSize() { 699 uword Isolate::GetSpecifiedStackSize() {
696 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize()); 700 ASSERT(Isolate::kStackSizeBuffer < OSThread::GetMaxStackSize());
697 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer; 701 uword stack_size = OSThread::GetMaxStackSize() - Isolate::kStackSizeBuffer;
698 return stack_size; 702 return stack_size;
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL; 1143 Dart_IsolateInterruptCallback Isolate::interrupt_callback_ = NULL;
1140 Dart_IsolateUnhandledExceptionCallback 1144 Dart_IsolateUnhandledExceptionCallback
1141 Isolate::unhandled_exception_callback_ = NULL; 1145 Isolate::unhandled_exception_callback_ = NULL;
1142 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL; 1146 Dart_IsolateShutdownCallback Isolate::shutdown_callback_ = NULL;
1143 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL; 1147 Dart_FileOpenCallback Isolate::file_open_callback_ = NULL;
1144 Dart_FileReadCallback Isolate::file_read_callback_ = NULL; 1148 Dart_FileReadCallback Isolate::file_read_callback_ = NULL;
1145 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL; 1149 Dart_FileWriteCallback Isolate::file_write_callback_ = NULL;
1146 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL; 1150 Dart_FileCloseCallback Isolate::file_close_callback_ = NULL;
1147 Dart_EntropySource Isolate::entropy_source_callback_ = NULL; 1151 Dart_EntropySource Isolate::entropy_source_callback_ = NULL;
1148 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL; 1152 Dart_IsolateInterruptCallback Isolate::vmstats_callback_ = NULL;
1149 Dart_ServiceIsolateCreateCalback Isolate::service_create_callback_ = NULL;
1150 1153
1151 Monitor* Isolate::isolates_list_monitor_ = NULL; 1154 Monitor* Isolate::isolates_list_monitor_ = NULL;
1152 Isolate* Isolate::isolates_list_head_ = NULL; 1155 Isolate* Isolate::isolates_list_head_ = NULL;
1153 1156
1154 1157
1155 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor, 1158 void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
1156 bool visit_prologue_weak_handles, 1159 bool visit_prologue_weak_handles,
1157 bool validate_frames) { 1160 bool validate_frames) {
1158 ASSERT(visitor != NULL); 1161 ASSERT(visitor != NULL);
1159 1162
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
1631 serialized_message_, serialized_message_len_); 1634 serialized_message_, serialized_message_len_);
1632 } 1635 }
1633 1636
1634 1637
1635 void IsolateSpawnState::Cleanup() { 1638 void IsolateSpawnState::Cleanup() {
1636 SwitchIsolateScope switch_scope(I); 1639 SwitchIsolateScope switch_scope(I);
1637 Dart::ShutdownIsolate(); 1640 Dart::ShutdownIsolate();
1638 } 1641 }
1639 1642
1640 } // namespace dart 1643 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698