OLD | NEW |
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 #ifndef VM_ISOLATE_H_ | 5 #ifndef VM_ISOLATE_H_ |
6 #define VM_ISOLATE_H_ | 6 #define VM_ISOLATE_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "vm/atomic.h" | 10 #include "vm/atomic.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 V(Instance) \ | 106 V(Instance) \ |
107 V(Library) \ | 107 V(Library) \ |
108 V(Object) \ | 108 V(Object) \ |
109 V(PcDescriptors) \ | 109 V(PcDescriptors) \ |
110 V(String) \ | 110 V(String) \ |
111 V(TypeArguments) \ | 111 V(TypeArguments) \ |
112 V(TypeParameter) \ | 112 V(TypeParameter) \ |
113 | 113 |
114 class Isolate : public BaseIsolate { | 114 class Isolate : public BaseIsolate { |
115 public: | 115 public: |
| 116 // Keep both these enums in sync with isolate_patch.dart. |
| 117 // The different Isolate API message types. |
| 118 enum LibMsgId { |
| 119 kPauseMsg = 1, |
| 120 kResumeMsg = 2, |
| 121 kPingMsg = 3, |
| 122 kKillMsg = 4, |
| 123 kAddExitMsg = 5, |
| 124 kDelExitMsg = 6, |
| 125 kAddErrorMsg = 7, |
| 126 kDelErrorMsg = 8, |
| 127 kErrorFatalMsg = 9, |
| 128 kInterruptMsg = 10, |
| 129 }; |
| 130 // The different Isolate API message priorities for ping and kill messages. |
| 131 enum LibMsgPriority { |
| 132 kImmediateAction = 0, |
| 133 kBeforeNextEventAction = 1, |
| 134 kAsEventAction = 2 |
| 135 }; |
| 136 |
116 ~Isolate(); | 137 ~Isolate(); |
117 | 138 |
118 static inline Isolate* Current() { | 139 static inline Isolate* Current() { |
119 Thread* thread = Thread::Current(); | 140 Thread* thread = Thread::Current(); |
120 return thread == NULL ? NULL : thread->isolate(); | 141 return thread == NULL ? NULL : thread->isolate(); |
121 } | 142 } |
122 | 143 |
123 // Register a newly introduced class. | 144 // Register a newly introduced class. |
124 void RegisterClass(const Class& cls); | 145 void RegisterClass(const Class& cls); |
125 void RegisterClassAt(intptr_t index, const Class& cls); | 146 void RegisterClassAt(intptr_t index, const Class& cls); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 (origin_id_ == main_port_)); | 199 (origin_id_ == main_port_)); |
179 origin_id_ = id; | 200 origin_id_ = id; |
180 } | 201 } |
181 void set_pause_capability(uint64_t value) { pause_capability_ = value; } | 202 void set_pause_capability(uint64_t value) { pause_capability_ = value; } |
182 uint64_t pause_capability() const { return pause_capability_; } | 203 uint64_t pause_capability() const { return pause_capability_; } |
183 void set_terminate_capability(uint64_t value) { | 204 void set_terminate_capability(uint64_t value) { |
184 terminate_capability_ = value; | 205 terminate_capability_ = value; |
185 } | 206 } |
186 uint64_t terminate_capability() const { return terminate_capability_; } | 207 uint64_t terminate_capability() const { return terminate_capability_; } |
187 | 208 |
| 209 void SendInternalLibMessage(LibMsgId msg_id, uint64_t capability); |
| 210 |
188 Heap* heap() const { return heap_; } | 211 Heap* heap() const { return heap_; } |
189 void set_heap(Heap* value) { heap_ = value; } | 212 void set_heap(Heap* value) { heap_ = value; } |
190 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } | 213 static intptr_t heap_offset() { return OFFSET_OF(Isolate, heap_); } |
191 | 214 |
192 ObjectStore* object_store() const { return object_store_; } | 215 ObjectStore* object_store() const { return object_store_; } |
193 void set_object_store(ObjectStore* value) { object_store_ = value; } | 216 void set_object_store(ObjectStore* value) { object_store_ = value; } |
194 static intptr_t object_store_offset() { | 217 static intptr_t object_store_offset() { |
195 return OFFSET_OF(Isolate, object_store_); | 218 return OFFSET_OF(Isolate, object_store_); |
196 } | 219 } |
197 | 220 |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 335 |
313 // Retrieve the stack address bounds for profiler. | 336 // Retrieve the stack address bounds for profiler. |
314 bool GetProfilerStackBounds(uword* lower, uword* upper) const; | 337 bool GetProfilerStackBounds(uword* lower, uword* upper) const; |
315 | 338 |
316 static uword GetSpecifiedStackSize(); | 339 static uword GetSpecifiedStackSize(); |
317 | 340 |
318 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize); | 341 static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize); |
319 | 342 |
320 // Interrupt bits. | 343 // Interrupt bits. |
321 enum { | 344 enum { |
322 kApiInterrupt = 0x1, // An interrupt from Dart_InterruptIsolate. | 345 kVMInterrupt = 0x1, // Internal VM checks: safepoints, store buffers, etc. |
323 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. | 346 kMessageInterrupt = 0x2, // An interrupt to process an out of band message. |
324 kVMInterrupt = 0x4, // Internal VM checks: safepoints, store buffers, etc. | |
325 | 347 |
326 kInterruptsMask = | 348 kInterruptsMask = (kVMInterrupt | kMessageInterrupt), |
327 kApiInterrupt | | |
328 kMessageInterrupt | | |
329 kVMInterrupt, | |
330 }; | 349 }; |
331 | 350 |
332 void ScheduleInterrupts(uword interrupt_bits); | 351 void ScheduleInterrupts(uword interrupt_bits); |
| 352 RawError* HandleInterrupts(); |
333 uword GetAndClearInterrupts(); | 353 uword GetAndClearInterrupts(); |
334 | 354 |
335 // Marks all libraries as loaded. | 355 // Marks all libraries as loaded. |
336 void DoneLoading(); | 356 void DoneLoading(); |
337 | 357 |
338 bool MakeRunnable(); | 358 bool MakeRunnable(); |
339 void Run(); | 359 void Run(); |
340 | 360 |
341 MessageHandler* message_handler() const { return message_handler_; } | 361 MessageHandler* message_handler() const { return message_handler_; } |
342 void set_message_handler(MessageHandler* value) { message_handler_ = value; } | 362 void set_message_handler(MessageHandler* value) { message_handler_ = value; } |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 uint8_t* serialized_message_; | 1147 uint8_t* serialized_message_; |
1128 intptr_t serialized_message_len_; | 1148 intptr_t serialized_message_len_; |
1129 Isolate::Flags isolate_flags_; | 1149 Isolate::Flags isolate_flags_; |
1130 bool paused_; | 1150 bool paused_; |
1131 bool errors_are_fatal_; | 1151 bool errors_are_fatal_; |
1132 }; | 1152 }; |
1133 | 1153 |
1134 } // namespace dart | 1154 } // namespace dart |
1135 | 1155 |
1136 #endif // VM_ISOLATE_H_ | 1156 #endif // VM_ISOLATE_H_ |
OLD | NEW |