OLD | NEW |
---|---|
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 #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/class_table.h" | 10 #include "vm/class_table.h" |
(...skipping 13 matching lines...) Expand all Loading... | |
24 class HandleVisitor; | 24 class HandleVisitor; |
25 class Heap; | 25 class Heap; |
26 class ICData; | 26 class ICData; |
27 class LongJump; | 27 class LongJump; |
28 class MessageHandler; | 28 class MessageHandler; |
29 class Mutex; | 29 class Mutex; |
30 class ObjectPointerVisitor; | 30 class ObjectPointerVisitor; |
31 class ObjectStore; | 31 class ObjectStore; |
32 class RawArray; | 32 class RawArray; |
33 class RawContext; | 33 class RawContext; |
34 class RawDouble; | |
34 class RawError; | 35 class RawError; |
35 class StackResource; | 36 class StackResource; |
36 class StubCode; | 37 class StubCode; |
37 class Zone; | 38 class Zone; |
38 | 39 |
40 | |
41 class DeferredDouble { | |
srdjan
2012/08/30 17:59:24
Add very brief comment what this class is for.
Vyacheslav Egorov (Google)
2012/09/21 12:51:52
Done.
| |
42 public: | |
43 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) | |
44 : value_(value), slot_(slot), next_(next) { } | |
45 | |
46 double value() const { return value_; } | |
47 RawDouble** slot() const { return slot_; } | |
48 DeferredDouble* next() { return next_; } | |
srdjan
2012/08/30 17:59:24
const
Vyacheslav Egorov (Google)
2012/09/21 12:51:52
Done.
| |
49 | |
50 private: | |
51 const double value_; | |
52 RawDouble** const slot_; | |
53 DeferredDouble* const next_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); | |
56 }; | |
57 | |
58 | |
39 class Isolate : public BaseIsolate { | 59 class Isolate : public BaseIsolate { |
40 public: | 60 public: |
41 ~Isolate(); | 61 ~Isolate(); |
42 | 62 |
43 static inline Isolate* Current() { | 63 static inline Isolate* Current() { |
44 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 64 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
45 } | 65 } |
46 | 66 |
47 static void SetCurrent(Isolate* isolate); | 67 static void SetCurrent(Isolate* isolate); |
48 | 68 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
213 return interrupt_callback_; | 233 return interrupt_callback_; |
214 } | 234 } |
215 | 235 |
216 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { | 236 static void SetShutdownCallback(Dart_IsolateShutdownCallback cb) { |
217 shutdown_callback_ = cb; | 237 shutdown_callback_ = cb; |
218 } | 238 } |
219 static Dart_IsolateShutdownCallback ShutdownCallback() { | 239 static Dart_IsolateShutdownCallback ShutdownCallback() { |
220 return shutdown_callback_; | 240 return shutdown_callback_; |
221 } | 241 } |
222 | 242 |
223 intptr_t* deopt_registers_copy() const { return deopt_registers_copy_; } | 243 intptr_t* deopt_cpu_registers_copy() const { |
224 void set_deopt_registers_copy(intptr_t* value) { | 244 return deopt_cpu_registers_copy_; |
225 ASSERT((value == NULL) || (deopt_registers_copy_ == NULL)); | 245 } |
226 deopt_registers_copy_ = value; | 246 void set_deopt_cpu_registers_copy(intptr_t* value) { |
247 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); | |
248 deopt_cpu_registers_copy_ = value; | |
249 } | |
250 double* deopt_xmm_registers_copy() const { | |
251 return deopt_xmm_registers_copy_; | |
252 } | |
253 void set_deopt_xmm_registers_copy(double* value) { | |
254 ASSERT((value == NULL) || (deopt_xmm_registers_copy_ == NULL)); | |
255 deopt_xmm_registers_copy_ = value; | |
227 } | 256 } |
228 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } | 257 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } |
229 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { | 258 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { |
230 ASSERT((value == NULL) || (size > 0)); | 259 ASSERT((value == NULL) || (size > 0)); |
231 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); | 260 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); |
232 deopt_frame_copy_ = value; | 261 deopt_frame_copy_ = value; |
233 deopt_frame_copy_size_ = size; | 262 deopt_frame_copy_size_ = size; |
234 } | 263 } |
235 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } | 264 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } |
236 | 265 |
266 void DeferDoubleMaterialization(double value, RawDouble** slot) { | |
267 deferred_doubles_ = new DeferredDouble( | |
268 value, slot, deferred_doubles_); | |
269 } | |
270 | |
271 DeferredDouble* DetachDeferredDoubles() { | |
272 DeferredDouble* list = deferred_doubles_; | |
273 deferred_doubles_ = NULL; | |
274 return list; | |
275 } | |
276 | |
237 private: | 277 private: |
238 Isolate(); | 278 Isolate(); |
239 | 279 |
240 void BuildName(const char* name_prefix); | 280 void BuildName(const char* name_prefix); |
241 void PrintInvokedFunctions(); | 281 void PrintInvokedFunctions(); |
242 | 282 |
243 static uword GetSpecifiedStackSize(); | 283 static uword GetSpecifiedStackSize(); |
244 | 284 |
245 static const intptr_t kStackSizeBuffer = (16 * KB); | 285 static const intptr_t kStackSizeBuffer = (16 * KB); |
246 | 286 |
(...skipping 19 matching lines...) Expand all Loading... | |
266 intptr_t deopt_id_; | 306 intptr_t deopt_id_; |
267 RawArray* ic_data_array_; | 307 RawArray* ic_data_array_; |
268 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 308 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
269 uword stack_limit_; | 309 uword stack_limit_; |
270 uword saved_stack_limit_; | 310 uword saved_stack_limit_; |
271 MessageHandler* message_handler_; | 311 MessageHandler* message_handler_; |
272 uword spawn_data_; | 312 uword spawn_data_; |
273 GcPrologueCallbacks gc_prologue_callbacks_; | 313 GcPrologueCallbacks gc_prologue_callbacks_; |
274 GcEpilogueCallbacks gc_epilogue_callbacks_; | 314 GcEpilogueCallbacks gc_epilogue_callbacks_; |
275 // Deoptimization support. | 315 // Deoptimization support. |
276 intptr_t* deopt_registers_copy_; | 316 intptr_t* deopt_cpu_registers_copy_; |
317 double* deopt_xmm_registers_copy_; | |
277 intptr_t* deopt_frame_copy_; | 318 intptr_t* deopt_frame_copy_; |
278 intptr_t deopt_frame_copy_size_; | 319 intptr_t deopt_frame_copy_size_; |
320 DeferredDouble* deferred_doubles_; | |
279 | 321 |
280 static Dart_IsolateCreateCallback create_callback_; | 322 static Dart_IsolateCreateCallback create_callback_; |
281 static Dart_IsolateInterruptCallback interrupt_callback_; | 323 static Dart_IsolateInterruptCallback interrupt_callback_; |
282 static Dart_IsolateShutdownCallback shutdown_callback_; | 324 static Dart_IsolateShutdownCallback shutdown_callback_; |
283 | 325 |
284 DISALLOW_COPY_AND_ASSIGN(Isolate); | 326 DISALLOW_COPY_AND_ASSIGN(Isolate); |
285 }; | 327 }; |
286 | 328 |
287 // When we need to execute code in an isolate, we use the | 329 // When we need to execute code in an isolate, we use the |
288 // StartIsolateScope. | 330 // StartIsolateScope. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
344 Isolate* new_isolate_; | 386 Isolate* new_isolate_; |
345 Isolate* saved_isolate_; | 387 Isolate* saved_isolate_; |
346 uword saved_stack_limit_; | 388 uword saved_stack_limit_; |
347 | 389 |
348 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 390 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
349 }; | 391 }; |
350 | 392 |
351 } // namespace dart | 393 } // namespace dart |
352 | 394 |
353 #endif // VM_ISOLATE_H_ | 395 #endif // VM_ISOLATE_H_ |
OLD | NEW |