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

Side by Side Diff: runtime/vm/isolate.h

Issue 12871015: SIMD plumbing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: s/materialize/Materialize Created 7 years, 9 months 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 class Debugger; 23 class Debugger;
24 class HandleScope; 24 class HandleScope;
25 class HandleVisitor; 25 class HandleVisitor;
26 class Heap; 26 class Heap;
27 class ICData; 27 class ICData;
28 class LongJump; 28 class LongJump;
29 class MessageHandler; 29 class MessageHandler;
30 class Mutex; 30 class Mutex;
31 class ObjectPointerVisitor; 31 class ObjectPointerVisitor;
32 class ObjectStore; 32 class ObjectStore;
33 class RawInstance;
33 class RawArray; 34 class RawArray;
34 class RawContext; 35 class RawContext;
35 class RawDouble; 36 class RawDouble;
36 class RawMint; 37 class RawMint;
37 class RawInteger; 38 class RawInteger;
38 class RawError; 39 class RawError;
39 class Simulator; 40 class Simulator;
40 class StackResource; 41 class StackResource;
41 class StackZone; 42 class StackZone;
42 class StubCode; 43 class StubCode;
44 class RawFloat32x4;
45 class RawUint32x4;
43 46
44 47
45 // Used by the deoptimization infrastructure to defer allocation of Double 48 // Used by the deoptimization infrastructure to defer allocation of unboxed
46 // objects until frame is fully rewritten and GC is safe. 49 // objects until frame is fully rewritten and GC is safe.
47 // See callers of Isolate::DeferDoubleMaterialization. 50 // See callers of Isolate::DeferObjectMaterialization.
48 class DeferredDouble { 51 class DeferredObject {
49 public: 52 public:
50 DeferredDouble(double value, RawDouble** slot, DeferredDouble* next) 53 DeferredObject(RawInstance** slot, DeferredObject* next)
51 : value_(value), slot_(slot), next_(next) { } 54 : slot_(slot), next_(next) { }
55 virtual ~DeferredObject() { }
56
57 RawInstance** slot() const { return slot_; }
58 DeferredObject* next() const { return next_; }
59
60 virtual void Materialize() = 0;
61
62 private:
63 RawInstance** const slot_;
64 DeferredObject* const next_;
65
66 DISALLOW_COPY_AND_ASSIGN(DeferredObject);
67 };
68
69
70 class DeferredDouble : public DeferredObject {
71 public:
72 DeferredDouble(double value, RawInstance** slot, DeferredObject* next)
73 : DeferredObject(slot, next), value_(value) { }
74
75 virtual void Materialize();
52 76
53 double value() const { return value_; } 77 double value() const { return value_; }
54 RawDouble** slot() const { return slot_; }
55 DeferredDouble* next() const { return next_; }
56 78
57 private: 79 private:
58 const double value_; 80 const double value_;
59 RawDouble** const slot_;
60 DeferredDouble* const next_;
61 81
62 DISALLOW_COPY_AND_ASSIGN(DeferredDouble); 82 DISALLOW_COPY_AND_ASSIGN(DeferredDouble);
63 }; 83 };
64 84
65 85
66 class DeferredMint { 86 class DeferredMint : public DeferredObject {
67 public: 87 public:
68 DeferredMint(int64_t value, RawMint** slot, DeferredMint* next) 88 DeferredMint(int64_t value, RawInstance** slot, DeferredObject* next)
69 : value_(value), slot_(slot), next_(next) { } 89 : DeferredObject(slot, next), value_(value) { }
90
91 virtual void Materialize();
70 92
71 int64_t value() const { return value_; } 93 int64_t value() const { return value_; }
72 RawMint** slot() const { return slot_; }
73 DeferredMint* next() const { return next_; }
74 94
75 private: 95 private:
76 const int64_t value_; 96 const int64_t value_;
77 RawMint** const slot_;
78 DeferredMint* const next_;
79 97
80 DISALLOW_COPY_AND_ASSIGN(DeferredMint); 98 DISALLOW_COPY_AND_ASSIGN(DeferredMint);
81 }; 99 };
82 100
83 101
102 class DeferredFloat32x4 : public DeferredObject {
103 public:
104 DeferredFloat32x4(simd128_value_t value, RawInstance** slot,
105 DeferredObject* next)
106 : DeferredObject(slot, next), value_(value) { }
107
108 virtual void Materialize();
109
110 simd128_value_t value() const { return value_; }
111
112 private:
113 const simd128_value_t value_;
114
115 DISALLOW_COPY_AND_ASSIGN(DeferredFloat32x4);
116 };
117
118
119 class DeferredUint32x4 : public DeferredObject {
120 public:
121 DeferredUint32x4(simd128_value_t value, RawInstance** slot,
122 DeferredObject* next)
123 : DeferredObject(slot, next), value_(value) { }
124
125 virtual void Materialize();
126
127 simd128_value_t value() const { return value_; }
128
129 private:
130 const simd128_value_t value_;
131
132 DISALLOW_COPY_AND_ASSIGN(DeferredUint32x4);
133 };
134
135
84 class Isolate : public BaseIsolate { 136 class Isolate : public BaseIsolate {
85 public: 137 public:
86 ~Isolate(); 138 ~Isolate();
87 139
88 static inline Isolate* Current() { 140 static inline Isolate* Current() {
89 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key)); 141 return reinterpret_cast<Isolate*>(Thread::GetThreadLocal(isolate_key));
90 } 142 }
91 143
92 static void SetCurrent(Isolate* isolate); 144 static void SetCurrent(Isolate* isolate);
93 145
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 return file_close_callback_; 353 return file_close_callback_;
302 } 354 }
303 355
304 intptr_t* deopt_cpu_registers_copy() const { 356 intptr_t* deopt_cpu_registers_copy() const {
305 return deopt_cpu_registers_copy_; 357 return deopt_cpu_registers_copy_;
306 } 358 }
307 void set_deopt_cpu_registers_copy(intptr_t* value) { 359 void set_deopt_cpu_registers_copy(intptr_t* value) {
308 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL)); 360 ASSERT((value == NULL) || (deopt_cpu_registers_copy_ == NULL));
309 deopt_cpu_registers_copy_ = value; 361 deopt_cpu_registers_copy_ = value;
310 } 362 }
311 double* deopt_fpu_registers_copy() const { 363 fpu_register_t* deopt_fpu_registers_copy() const {
312 return deopt_fpu_registers_copy_; 364 return deopt_fpu_registers_copy_;
313 } 365 }
314 void set_deopt_fpu_registers_copy(double* value) { 366 void set_deopt_fpu_registers_copy(fpu_register_t* value) {
315 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL)); 367 ASSERT((value == NULL) || (deopt_fpu_registers_copy_ == NULL));
316 deopt_fpu_registers_copy_ = value; 368 deopt_fpu_registers_copy_ = value;
317 } 369 }
318 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; } 370 intptr_t* deopt_frame_copy() const { return deopt_frame_copy_; }
319 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) { 371 void SetDeoptFrameCopy(intptr_t* value, intptr_t size) {
320 ASSERT((value == NULL) || (size > 0)); 372 ASSERT((value == NULL) || (size > 0));
321 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL)); 373 ASSERT((value == NULL) || (deopt_frame_copy_ == NULL));
322 deopt_frame_copy_ = value; 374 deopt_frame_copy_ = value;
323 deopt_frame_copy_size_ = size; 375 deopt_frame_copy_size_ = size;
324 } 376 }
325 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; } 377 intptr_t deopt_frame_copy_size() const { return deopt_frame_copy_size_; }
326 378
327 void DeferDoubleMaterialization(double value, RawDouble** slot) { 379 void DeferDoubleMaterialization(double value, RawDouble** slot) {
328 deferred_doubles_ = new DeferredDouble(value, slot, deferred_doubles_); 380 deferred_objects_ = new DeferredDouble(
381 value,
382 reinterpret_cast<RawInstance**>(slot),
383 deferred_objects_);
329 } 384 }
330 385
331 void DeferMintMaterialization(int64_t value, RawMint** slot) { 386 void DeferMintMaterialization(int64_t value, RawMint** slot) {
332 deferred_mints_ = new DeferredMint(value, slot, deferred_mints_); 387 deferred_objects_ = new DeferredMint(value,
388 reinterpret_cast<RawInstance**>(slot),
389 deferred_objects_);
333 } 390 }
334 391
335 DeferredDouble* DetachDeferredDoubles() { 392 void DeferFloat32x4Materialization(simd128_value_t value,
336 DeferredDouble* list = deferred_doubles_; 393 RawFloat32x4** slot) {
337 deferred_doubles_ = NULL; 394 deferred_objects_ = new DeferredFloat32x4(
395 value,
396 reinterpret_cast<RawInstance**>(slot),
397 deferred_objects_);
398 }
399
400 void DeferUint32x4Materialization(simd128_value_t value,
401 RawUint32x4** slot) {
402 deferred_objects_ = new DeferredUint32x4(
403 value,
404 reinterpret_cast<RawInstance**>(slot),
405 deferred_objects_);
406 }
407
408 DeferredObject* DetachDeferredObjects() {
409 DeferredObject* list = deferred_objects_;
410 deferred_objects_ = NULL;
338 return list; 411 return list;
339 } 412 }
340 413
341 DeferredMint* DetachDeferredMints() {
342 DeferredMint* list = deferred_mints_;
343 deferred_mints_ = NULL;
344 return list;
345 }
346
347 static char* GetStatus(const char* request); 414 static char* GetStatus(const char* request);
348 415
349 private: 416 private:
350 Isolate(); 417 Isolate();
351 418
352 void BuildName(const char* name_prefix); 419 void BuildName(const char* name_prefix);
353 void PrintInvokedFunctions(); 420 void PrintInvokedFunctions();
354 421
355 static ThreadLocalKey isolate_key; 422 static ThreadLocalKey isolate_key;
356 StoreBufferBlock store_buffer_block_; 423 StoreBufferBlock store_buffer_block_;
(...skipping 21 matching lines...) Expand all
378 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. 445 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_.
379 uword stack_limit_; 446 uword stack_limit_;
380 uword saved_stack_limit_; 447 uword saved_stack_limit_;
381 MessageHandler* message_handler_; 448 MessageHandler* message_handler_;
382 uword spawn_data_; 449 uword spawn_data_;
383 GcPrologueCallbacks gc_prologue_callbacks_; 450 GcPrologueCallbacks gc_prologue_callbacks_;
384 GcEpilogueCallbacks gc_epilogue_callbacks_; 451 GcEpilogueCallbacks gc_epilogue_callbacks_;
385 452
386 // Deoptimization support. 453 // Deoptimization support.
387 intptr_t* deopt_cpu_registers_copy_; 454 intptr_t* deopt_cpu_registers_copy_;
388 double* deopt_fpu_registers_copy_; 455 fpu_register_t* deopt_fpu_registers_copy_;
389 intptr_t* deopt_frame_copy_; 456 intptr_t* deopt_frame_copy_;
390 intptr_t deopt_frame_copy_size_; 457 intptr_t deopt_frame_copy_size_;
391 DeferredDouble* deferred_doubles_; 458 DeferredObject* deferred_objects_;
392 DeferredMint* deferred_mints_;
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
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_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698