Chromium Code Reviews| 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 "platform/thread.h" | 10 #include "platform/thread.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 class RawArray; | 33 class RawArray; |
| 34 class RawContext; | 34 class RawContext; |
| 35 class RawDouble; | 35 class RawDouble; |
| 36 class RawMint; | 36 class RawMint; |
| 37 class RawInteger; | 37 class RawInteger; |
| 38 class RawError; | 38 class RawError; |
| 39 class Simulator; | 39 class Simulator; |
| 40 class StackResource; | 40 class StackResource; |
| 41 class StackZone; | 41 class StackZone; |
| 42 class StubCode; | 42 class StubCode; |
| 43 class RawFloat32x4; | |
| 44 class RawUint32x4; | |
| 43 | 45 |
| 44 | 46 |
| 45 // Used by the deoptimization infrastructure to defer allocation of Double | 47 // Used by the deoptimization infrastructure to defer allocation of Double |
| 46 // objects until frame is fully rewritten and GC is safe. | 48 // objects until frame is fully rewritten and GC is safe. |
| 47 // See callers of Isolate::DeferDoubleMaterialization. | 49 // See callers of Isolate::DeferDoubleMaterialization. |
| 48 class DeferredDouble { | 50 class DeferredDouble { |
| 49 public: | 51 public: |
| 50 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) | 52 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) |
| 51 : value_(value), slot_(slot), next_(next) { } | 53 : value_(value), slot_(slot), next_(next) { } |
| 52 | 54 |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 74 | 76 |
| 75 private: | 77 private: |
| 76 const int64_t value_; | 78 const int64_t value_; |
| 77 RawMint** const slot_; | 79 RawMint** const slot_; |
| 78 DeferredMint* const next_; | 80 DeferredMint* const next_; |
| 79 | 81 |
| 80 DISALLOW_COPY_AND_ASSIGN(DeferredMint); | 82 DISALLOW_COPY_AND_ASSIGN(DeferredMint); |
| 81 }; | 83 }; |
| 82 | 84 |
| 83 | 85 |
| 86 class DeferredFloat32x4 { | |
|
Vyacheslav Egorov (Google)
2013/03/17 18:17:10
This is a lot of code duplication.
Suggestion: m
Cutch
2013/03/17 21:52:37
Done.
| |
| 87 public: | |
| 88 DeferredFloat32x4(simd128_value_t value, RawFloat32x4** slot, | |
| 89 DeferredFloat32x4* next) | |
| 90 : value_(value), slot_(slot), next_(next) { } | |
| 91 | |
| 92 simd128_value_t value() const { return value_; } | |
| 93 RawFloat32x4** slot() const { return slot_; } | |
| 94 DeferredFloat32x4* next() const { return next_; } | |
| 95 | |
| 96 private: | |
| 97 const simd128_value_t value_; | |
| 98 RawFloat32x4** const slot_; | |
| 99 DeferredFloat32x4* const next_; | |
| 100 | |
| 101 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4); | |
| 102 }; | |
| 103 | |
| 104 | |
| 105 class DeferredUint32x4 { | |
| 106 public: | |
| 107 DeferredUint32x4(simd128_value_t value, RawUint32x4** slot, | |
| 108 DeferredUint32x4* next) | |
| 109 : value_(value), slot_(slot), next_(next) { } | |
| 110 | |
| 111 simd128_value_t value() const { return value_; } | |
| 112 RawUint32x4** slot() const { return slot_; } | |
| 113 DeferredUint32x4* next() const { return next_; } | |
| 114 | |
| 115 private: | |
| 116 const simd128_value_t value_; | |
| 117 RawUint32x4** const slot_; | |
| 118 DeferredUint32x4* const next_; | |
| 119 | |
| 120 DISALLOW_COPY_AND_ASSIGN(DeferredUint32x4); | |
| 121 }; | |
| 122 | |
| 123 | |
| 84 class Isolate : public BaseIsolate { | 124 class Isolate : public BaseIsolate { |
| 85 public: | 125 public: |
| 86 ~Isolate(); | 126 ~Isolate(); |
| 87 | 127 |
| 88 static inline Isolate* Current() { | 128 static inline Isolate* Current() { |
| 89 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); | 129 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); |
| 90 } | 130 } |
| 91 | 131 |
| 92 static void SetCurrent(Isolate* isolate); | 132 static void SetCurrent(Isolate* isolate); |
| 93 | 133 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 return file_close_callback_; | 341 return file_close_callback_; |
| 302 } | 342 } |
| 303 | 343 |
| 304 intptr_t* deopt_cpu_registers_copy() const { | 344 intptr_t* deopt_cpu_registers_copy() const { |
| 305 return deopt_cpu_registers_copy_; | 345 return deopt_cpu_registers_copy_; |
| 306 } | 346 } |
| 307 void set_deopt_cpu_registers_copy(intptr_t* value) { | 347 void set_deopt_cpu_registers_copy(intptr_t* value) { |
| 308 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); | 348 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); |
| 309 deopt_cpu_registers_copy_ = value; | 349 deopt_cpu_registers_copy_ = value; |
| 310 } | 350 } |
| 311 double* deopt_fpu_registers_copy() const { | 351 fpu_register_t* deopt_fpu_registers_copy() const { |
| 312 return deopt_fpu_registers_copy_; | 352 return deopt_fpu_registers_copy_; |
| 313 } | 353 } |
| 314 void set_deopt_fpu_registers_copy(double* value) { | 354 void set_deopt_fpu_registers_copy(fpu_register_t* value) { |
| 315 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL)); | 355 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL)); |
| 316 deopt_fpu_registers_copy_ = value; | 356 deopt_fpu_registers_copy_ = value; |
| 317 } | 357 } |
| 318 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } | 358 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } |
| 319 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { | 359 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { |
| 320 ASSERT((value == NULL) || (size > 0)); | 360 ASSERT((value == NULL) || (size > 0)); |
| 321 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); | 361 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); |
| 322 deopt_frame_copy_ = value; | 362 deopt_frame_copy_ = value; |
| 323 deopt_frame_copy_size_ = size; | 363 deopt_frame_copy_size_ = size; |
| 324 } | 364 } |
| 325 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } | 365 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } |
| 326 | 366 |
| 327 void DeferDoubleMaterialization(double value, RawDouble** slot) { | 367 void DeferDoubleMaterialization(double value, RawDouble** slot) { |
| 328 deferred_doubles_ = new DeferredDouble(value, slot, deferred_doubles_); | 368 deferred_doubles_ = new DeferredDouble(value, slot, deferred_doubles_); |
| 329 } | 369 } |
| 330 | 370 |
| 331 void DeferMintMaterialization(int64_t value, RawMint** slot) { | 371 void DeferMintMaterialization(int64_t value, RawMint** slot) { |
| 332 deferred_mints_ = new DeferredMint(value, slot, deferred_mints_); | 372 deferred_mints_ = new DeferredMint(value, slot, deferred_mints_); |
| 333 } | 373 } |
| 334 | 374 |
| 375 void DeferFloat32x4Materialization(simd128_value_t value, | |
| 376 RawFloat32x4** slot) { | |
| 377 deferred_float32x4s_ = new DeferredFloat32x4(value, slot, | |
| 378 deferred_float32x4s_); | |
| 379 } | |
| 380 | |
| 381 void DeferUint32x4Materialization(simd128_value_t value, | |
| 382 RawUint32x4** slot) { | |
| 383 deferred_uint32x4s_ = new DeferredUint32x4(value, slot, | |
| 384 deferred_uint32x4s_); | |
| 385 } | |
| 386 | |
| 335 DeferredDouble* DetachDeferredDoubles() { | 387 DeferredDouble* DetachDeferredDoubles() { |
| 336 DeferredDouble* list = deferred_doubles_; | 388 DeferredDouble* list = deferred_doubles_; |
| 337 deferred_doubles_ = NULL; | 389 deferred_doubles_ = NULL; |
| 338 return list; | 390 return list; |
| 339 } | 391 } |
| 340 | 392 |
| 341 DeferredMint* DetachDeferredMints() { | 393 DeferredMint* DetachDeferredMints() { |
| 342 DeferredMint* list = deferred_mints_; | 394 DeferredMint* list = deferred_mints_; |
| 343 deferred_mints_ = NULL; | 395 deferred_mints_ = NULL; |
| 344 return list; | 396 return list; |
| 345 } | 397 } |
| 346 | 398 |
| 399 DeferredFloat32x4* DetachDeferredFloat32x4s() { | |
| 400 DeferredFloat32x4* list = deferred_float32x4s_; | |
| 401 deferred_float32x4s_ = NULL; | |
| 402 return list; | |
| 403 } | |
| 404 | |
| 405 DeferredUint32x4* DetachDeferredUint32x4s() { | |
| 406 DeferredUint32x4* list = deferred_uint32x4s_; | |
| 407 deferred_uint32x4s_ = NULL; | |
| 408 return list; | |
| 409 } | |
| 410 | |
| 347 static char* GetStatus(const char* request); | 411 static char* GetStatus(const char* request); |
| 348 | 412 |
| 349 private: | 413 private: |
| 350 Isolate(); | 414 Isolate(); |
| 351 | 415 |
| 352 void BuildName(const char* name_prefix); | 416 void BuildName(const char* name_prefix); |
| 353 void PrintInvokedFunctions(); | 417 void PrintInvokedFunctions(); |
| 354 | 418 |
| 355 static ThreadLocalKey isolate_key; | 419 static ThreadLocalKey isolate_key; |
| 356 StoreBufferBlock store_buffer_block_; | 420 StoreBufferBlock store_buffer_block_; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 378 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. | 442 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. |
| 379 uword stack_limit_; | 443 uword stack_limit_; |
| 380 uword saved_stack_limit_; | 444 uword saved_stack_limit_; |
| 381 MessageHandler* message_handler_; | 445 MessageHandler* message_handler_; |
| 382 uword spawn_data_; | 446 uword spawn_data_; |
| 383 GcPrologueCallbacks gc_prologue_callbacks_; | 447 GcPrologueCallbacks gc_prologue_callbacks_; |
| 384 GcEpilogueCallbacks gc_epilogue_callbacks_; | 448 GcEpilogueCallbacks gc_epilogue_callbacks_; |
| 385 | 449 |
| 386 // Deoptimization support. | 450 // Deoptimization support. |
| 387 intptr_t* deopt_cpu_registers_copy_; | 451 intptr_t* deopt_cpu_registers_copy_; |
| 388 double* deopt_fpu_registers_copy_; | 452 fpu_register_t* deopt_fpu_registers_copy_; |
| 389 intptr_t* deopt_frame_copy_; | 453 intptr_t* deopt_frame_copy_; |
| 390 intptr_t deopt_frame_copy_size_; | 454 intptr_t deopt_frame_copy_size_; |
| 391 DeferredDouble* deferred_doubles_; | 455 DeferredDouble* deferred_doubles_; |
| 392 DeferredMint* deferred_mints_; | 456 DeferredMint* deferred_mints_; |
| 457 DeferredFloat32x4* deferred_float32x4s_; | |
| 458 DeferredUint32x4* deferred_uint32x4s_; | |
| 393 | 459 |
| 394 static Dart_IsolateCreateCallback create_callback_; | 460 static Dart_IsolateCreateCallback create_callback_; |
| 395 static Dart_IsolateInterruptCallback interrupt_callback_; | 461 static Dart_IsolateInterruptCallback interrupt_callback_; |
| 396 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; | 462 static Dart_IsolateUnhandledExceptionCallback unhandled_exception_callback_; |
| 397 static Dart_IsolateShutdownCallback shutdown_callback_; | 463 static Dart_IsolateShutdownCallback shutdown_callback_; |
| 398 static Dart_FileOpenCallback file_open_callback_; | 464 static Dart_FileOpenCallback file_open_callback_; |
| 399 static Dart_FileWriteCallback file_write_callback_; | 465 static Dart_FileWriteCallback file_write_callback_; |
| 400 static Dart_FileCloseCallback file_close_callback_; | 466 static Dart_FileCloseCallback file_close_callback_; |
| 401 | 467 |
| 402 DISALLOW_COPY_AND_ASSIGN(Isolate); | 468 DISALLOW_COPY_AND_ASSIGN(Isolate); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 462 Isolate* new_isolate_; | 528 Isolate* new_isolate_; |
| 463 Isolate* saved_isolate_; | 529 Isolate* saved_isolate_; |
| 464 uword saved_stack_limit_; | 530 uword saved_stack_limit_; |
| 465 | 531 |
| 466 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); | 532 DISALLOW_COPY_AND_ASSIGN(SwitchIsolateScope); |
| 467 }; | 533 }; |
| 468 | 534 |
| 469 } // namespace dart | 535 } // namespace dart |
| 470 | 536 |
| 471 #endif // VM_ISOLATE_H_ | 537 #endif // VM_ISOLATE_H_ |
| OLD | NEW |