| 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 14 matching lines...) Expand all Loading... |
| 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 RawDouble; |
| 35 class RawMint; |
| 36 class RawInteger; |
| 35 class RawError; | 37 class RawError; |
| 36 class StackResource; | 38 class StackResource; |
| 37 class StubCode; | 39 class StubCode; |
| 38 class Zone; | 40 class Zone; |
| 39 | 41 |
| 40 | 42 |
| 41 // Used by the deoptimization infrastructure to defer allocation of Double | 43 // Used by the deoptimization infrastructure to defer allocation of Double |
| 42 // objects until frame is fully rewritten and GC is safe. | 44 // objects until frame is fully rewritten and GC is safe. |
| 43 // See callers of Isolate::DeferDoubleMaterialization. | 45 // See callers of Isolate::DeferDoubleMaterialization. |
| 44 class DeferredDouble { | 46 class DeferredDouble { |
| 45 public: | 47 public: |
| 46 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) | 48 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) |
| 47 : value_(value), slot_(slot), next_(next) { } | 49 : value_(value), slot_(slot), next_(next) { } |
| 48 | 50 |
| 49 double value() const { return value_; } | 51 double value() const { return value_; } |
| 50 RawDouble** slot() const { return slot_; } | 52 RawDouble** slot() const { return slot_; } |
| 51 DeferredDouble* next() const { return next_; } | 53 DeferredDouble* next() const { return next_; } |
| 52 | 54 |
| 53 private: | 55 private: |
| 54 const double value_; | 56 const double value_; |
| 55 RawDouble** const slot_; | 57 RawDouble** const slot_; |
| 56 DeferredDouble* const next_; | 58 DeferredDouble* const next_; |
| 57 | 59 |
| 58 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); | 60 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); |
| 59 }; | 61 }; |
| 60 | 62 |
| 61 | 63 |
| 64 class DeferredMint { |
| 65 public: |
| 66 DeferredMint(int64_t value, RawMint** slot, DeferredMint* next) |
| 67 : value_(value), slot_(slot), next_(next) { } |
| 68 |
| 69 int64_t value() const { return value_; } |
| 70 RawMint** slot() const { return slot_; } |
| 71 DeferredMint* next() const { return next_; } |
| 72 |
| 73 private: |
| 74 const int64_t value_; |
| 75 RawMint** const slot_; |
| 76 DeferredMint* const next_; |
| 77 |
| 78 DISALLOW_COPY_AND_ASSIGN(DeferredMint); |
| 79 }; |
| 80 |
| 81 |
| 62 class Isolate : public BaseIsolate { | 82 class Isolate : public BaseIsolate { |
| 63 public: | 83 public: |
| 64 ~Isolate(); | 84 ~Isolate(); |
| 65 | 85 |
| 66 static inline Isolate* Current() { | 86 static inline Isolate* Current() { |
| 67 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 87 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
| 68 } | 88 } |
| 69 | 89 |
| 70 static void SetCurrent(Isolate* isolate); | 90 static void SetCurrent(Isolate* isolate); |
| 71 | 91 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } | 280 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } |
| 261 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { | 281 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { |
| 262 ASSERT((value == NULL) || (size > 0)); | 282 ASSERT((value == NULL) || (size > 0)); |
| 263 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); | 283 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); |
| 264 deopt_frame_copy_ = value; | 284 deopt_frame_copy_ = value; |
| 265 deopt_frame_copy_size_ = size; | 285 deopt_frame_copy_size_ = size; |
| 266 } | 286 } |
| 267 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } | 287 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } |
| 268 | 288 |
| 269 void DeferDoubleMaterialization(double value, RawDouble** slot) { | 289 void DeferDoubleMaterialization(double value, RawDouble** slot) { |
| 270 deferred_doubles_ = new DeferredDouble( | 290 deferred_doubles_ = new DeferredDouble(value, slot, deferred_doubles_); |
| 271 value, slot, deferred_doubles_); | 291 } |
| 292 |
| 293 void DeferMintMaterialization(int64_t value, RawMint** slot) { |
| 294 deferred_mints_ = new DeferredMint(value, slot, deferred_mints_); |
| 272 } | 295 } |
| 273 | 296 |
| 274 DeferredDouble* DetachDeferredDoubles() { | 297 DeferredDouble* DetachDeferredDoubles() { |
| 275 DeferredDouble* list = deferred_doubles_; | 298 DeferredDouble* list = deferred_doubles_; |
| 276 deferred_doubles_ = NULL; | 299 deferred_doubles_ = NULL; |
| 277 return list; | 300 return list; |
| 278 } | 301 } |
| 279 | 302 |
| 303 DeferredMint* DetachDeferredMints() { |
| 304 DeferredMint* list = deferred_mints_; |
| 305 deferred_mints_ = NULL; |
| 306 return list; |
| 307 } |
| 308 |
| 280 private: | 309 private: |
| 281 Isolate(); | 310 Isolate(); |
| 282 | 311 |
| 283 void BuildName(const char* name_prefix); | 312 void BuildName(const char* name_prefix); |
| 284 void PrintInvokedFunctions(); | 313 void PrintInvokedFunctions(); |
| 285 | 314 |
| 286 static uword GetSpecifiedStackSize(); | 315 static uword GetSpecifiedStackSize(); |
| 287 | 316 |
| 288 static const intptr_t kStackSizeBuffer = (16 * KB); | 317 static const intptr_t kStackSizeBuffer = (16 * KB); |
| 289 | 318 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 314 MessageHandler* message_handler_; | 343 MessageHandler* message_handler_; |
| 315 uword spawn_data_; | 344 uword spawn_data_; |
| 316 GcPrologueCallbacks gc_prologue_callbacks_; | 345 GcPrologueCallbacks gc_prologue_callbacks_; |
| 317 GcEpilogueCallbacks gc_epilogue_callbacks_; | 346 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 318 // Deoptimization support. | 347 // Deoptimization support. |
| 319 intptr_t* deopt_cpu_registers_copy_; | 348 intptr_t* deopt_cpu_registers_copy_; |
| 320 double* deopt_xmm_registers_copy_; | 349 double* deopt_xmm_registers_copy_; |
| 321 intptr_t* deopt_frame_copy_; | 350 intptr_t* deopt_frame_copy_; |
| 322 intptr_t deopt_frame_copy_size_; | 351 intptr_t deopt_frame_copy_size_; |
| 323 DeferredDouble* deferred_doubles_; | 352 DeferredDouble* deferred_doubles_; |
| 353 DeferredMint* deferred_mints_; |
| 324 | 354 |
| 325 static Dart_IsolateCreateCallback create_callback_; | 355 static Dart_IsolateCreateCallback create_callback_; |
| 326 static Dart_IsolateInterruptCallback interrupt_callback_; | 356 static Dart_IsolateInterruptCallback interrupt_callback_; |
| 327 static Dart_IsolateShutdownCallback shutdown_callback_; | 357 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 328 | 358 |
| 329 DISALLOW_COPY_AND_ASSIGN(Isolate); | 359 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| 330 }; | 360 }; |
| 331 | 361 |
| 332 // When we need to execute code in an isolate, we use the | 362 // When we need to execute code in an isolate, we use the |
| 333 // StartIsolateScope. | 363 // StartIsolateScope. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 Isolate* new_isolate_; | 419 Isolate* new_isolate_; |
| 390 Isolate* saved_isolate_; | 420 Isolate* saved_isolate_; |
| 391 uword saved_stack_limit_; | 421 uword saved_stack_limit_; |
| 392 | 422 |
| 393 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 423 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
| 394 }; | 424 }; |
| 395 | 425 |
| 396 } // namespace dart | 426 } // namespace dart |
| 397 | 427 |
| 398 #endif // VM_ISOLATE_H_ | 428 #endif // VM_ISOLATE_H_ |
| OLD | NEW |