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

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

Issue 8851008: Add support for interrupting an isolate in the vm. Interrupts are (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/code_index_table.h" 7 #include "vm/code_index_table.h"
8 #include "vm/freelist.h" 8 #include "vm/freelist.h"
9 #include "vm/flags.h" 9 #include "vm/flags.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
11 #include "vm/heap.h" 11 #include "vm/heap.h"
12 #include "vm/isolate.h" 12 #include "vm/isolate.h"
13 #include "vm/longjump.h" 13 #include "vm/longjump.h"
14 #include "vm/object.h" 14 #include "vm/object.h"
15 #include "vm/object_store.h" 15 #include "vm/object_store.h"
16 #include "vm/port.h" 16 #include "vm/port.h"
17 #include "vm/snapshot.h" 17 #include "vm/snapshot.h"
18 #include "vm/stub_code.h" 18 #include "vm/stub_code.h"
19 #include "vm/virtual_memory.h" 19 #include "vm/virtual_memory.h"
20 #include "vm/zone.h" 20 #include "vm/zone.h"
21 21
22 namespace dart { 22 namespace dart {
23 23
24 Isolate* Dart::vm_isolate_ = NULL; 24 Isolate* Dart::vm_isolate_ = NULL;
25 DebugInfo* Dart::pprof_symbol_generator_ = NULL; 25 DebugInfo* Dart::pprof_symbol_generator_ = NULL;
26 26
27 bool Dart::InitOnce(Dart_IsolateCreateCallback callback) { 27 bool Dart::InitOnce(Dart_IsolateCreateCallback create,
28 Dart_IsolateInterruptCallback interrupt) {
28 // TODO(iposva): Fix race condition here. 29 // TODO(iposva): Fix race condition here.
29 if (vm_isolate_ != NULL || !Flags::Initialized()) { 30 if (vm_isolate_ != NULL || !Flags::Initialized()) {
30 return false; 31 return false;
31 } 32 }
32 OS::InitOnce(); 33 OS::InitOnce();
33 VirtualMemory::InitOnce(); 34 VirtualMemory::InitOnce();
34 Isolate::InitOnce(); 35 Isolate::InitOnce();
35 PortMap::InitOnce(); 36 PortMap::InitOnce();
36 FreeListElement::InitOnce(); 37 FreeListElement::InitOnce();
37 // Create the VM isolate and finish the VM initialization. 38 // Create the VM isolate and finish the VM initialization.
38 { 39 {
39 ASSERT(vm_isolate_ == NULL); 40 ASSERT(vm_isolate_ == NULL);
40 ASSERT(Flags::Initialized()); 41 ASSERT(Flags::Initialized());
41 vm_isolate_ = Isolate::Init(); 42 vm_isolate_ = Isolate::Init();
42 Zone zone(vm_isolate_); 43 Zone zone(vm_isolate_);
43 HandleScope handle_scope(vm_isolate_); 44 HandleScope handle_scope(vm_isolate_);
44 Heap::Init(vm_isolate_); 45 Heap::Init(vm_isolate_);
45 ObjectStore::Init(vm_isolate_); 46 ObjectStore::Init(vm_isolate_);
46 Object::InitOnce(); 47 Object::InitOnce();
47 StubCode::InitOnce(); 48 StubCode::InitOnce();
48 Scanner::InitOnce(); 49 Scanner::InitOnce();
49 } 50 }
50 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread. 51 Isolate::SetCurrent(NULL); // Unregister the VM isolate from this thread.
51 Isolate::SetCreateCallback(callback); 52 Isolate::SetCreateCallback(create);
53 Isolate::SetInterruptCallback(interrupt);
52 return true; 54 return true;
53 } 55 }
54 56
55 57
56 Isolate* Dart::CreateIsolate() { 58 Isolate* Dart::CreateIsolate() {
57 // Create a new isolate. 59 // Create a new isolate.
58 Isolate* isolate = Isolate::Init(); 60 Isolate* isolate = Isolate::Init();
59 ASSERT(isolate != NULL); 61 ASSERT(isolate != NULL);
60 return isolate; 62 return isolate;
61 } 63 }
(...skipping 27 matching lines...) Expand all
89 } 91 }
90 92
91 93
92 void Dart::ShutdownIsolate() { 94 void Dart::ShutdownIsolate() {
93 Isolate* isolate = Isolate::Current(); 95 Isolate* isolate = Isolate::Current();
94 isolate->Shutdown(); 96 isolate->Shutdown();
95 delete isolate; 97 delete isolate;
96 } 98 }
97 99
98 } // namespace dart 100 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698