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

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

Issue 11413101: Added support for isolate unhandled exceptions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated code review feedback Created 8 years 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.h ('k') | runtime/vm/dart_api_impl.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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/dart.h" 5 #include "vm/dart.h"
6 6
7 #include "vm/dart_api_state.h" 7 #include "vm/dart_api_state.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/freelist.h" 9 #include "vm/freelist.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // RawInstruction objects are premarked on allocation. 42 // RawInstruction objects are premarked on allocation.
43 if (!obj->IsMarked()) { 43 if (!obj->IsMarked()) {
44 obj->SetMarkBit(); 44 obj->SetMarkBit();
45 } 45 }
46 } 46 }
47 }; 47 };
48 48
49 49
50 // TODO(turnidge): We should add a corresponding Dart::Cleanup. 50 // TODO(turnidge): We should add a corresponding Dart::Cleanup.
51 const char* Dart::InitOnce(Dart_IsolateCreateCallback create, 51 const char* Dart::InitOnce(Dart_IsolateCreateCallback create,
52 Dart_IsolateInterruptCallback interrupt, 52 Dart_IsolateInterruptCallback interrupt,
53 Dart_IsolateShutdownCallback shutdown) { 53 Dart_IsolateUnhandledExceptionCallback unhandled,
54 Dart_IsolateShutdownCallback shutdown) {
54 // TODO(iposva): Fix race condition here. 55 // TODO(iposva): Fix race condition here.
55 if (vm_isolate_ != NULL || !Flags::Initialized()) { 56 if (vm_isolate_ != NULL || !Flags::Initialized()) {
56 return "VM already initialized."; 57 return "VM already initialized.";
57 } 58 }
58 OS::InitOnce(); 59 OS::InitOnce();
59 VirtualMemory::InitOnce(); 60 VirtualMemory::InitOnce();
60 Isolate::InitOnce(); 61 Isolate::InitOnce();
61 PortMap::InitOnce(); 62 PortMap::InitOnce();
62 FreeListElement::InitOnce(); 63 FreeListElement::InitOnce();
63 Api::InitOnce(); 64 Api::InitOnce();
(...skipping 19 matching lines...) Expand all
83 return "SSE2 is required."; 84 return "SSE2 is required.";
84 } 85 }
85 #endif 86 #endif
86 PremarkingVisitor premarker(vm_isolate_); 87 PremarkingVisitor premarker(vm_isolate_);
87 vm_isolate_->heap()->IterateOldObjects(&premarker); 88 vm_isolate_->heap()->IterateOldObjects(&premarker);
88 vm_isolate_->heap()->WriteProtect(true); 89 vm_isolate_->heap()->WriteProtect(true);
89 } 90 }
90 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 91 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
91 Isolate::SetCreateCallback(create); 92 Isolate::SetCreateCallback(create);
92 Isolate::SetInterruptCallback(interrupt); 93 Isolate::SetInterruptCallback(interrupt);
94 Isolate::SetUnhandledExceptionCallback(unhandled);
93 Isolate::SetShutdownCallback(shutdown); 95 Isolate::SetShutdownCallback(shutdown);
94 return NULL; 96 return NULL;
95 } 97 }
96 98
97 99
98 Isolate* Dart::CreateIsolate(const char* name_prefix) { 100 Isolate* Dart::CreateIsolate(const char* name_prefix) {
99 // Create a new isolate. 101 // Create a new isolate.
100 Isolate* isolate = Isolate::Init(name_prefix); 102 Isolate* isolate = Isolate::Init(name_prefix);
101 ASSERT(isolate != NULL); 103 ASSERT(isolate != NULL);
102 return isolate; 104 return isolate;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 isolate->Shutdown(); 187 isolate->Shutdown();
186 delete isolate; 188 delete isolate;
187 189
188 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback(); 190 Dart_IsolateShutdownCallback callback = Isolate::ShutdownCallback();
189 if (callback != NULL) { 191 if (callback != NULL) {
190 (callback)(callback_data); 192 (callback)(callback_data);
191 } 193 }
192 } 194 }
193 195
194 } // namespace dart 196 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/dart.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698