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

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

Issue 1390153004: Move deopt_id and related helpers/definitions from Isolate to Thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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_THREAD_H_ 5 #ifndef VM_THREAD_H_
6 #define VM_THREAD_H_ 6 #define VM_THREAD_H_
7 7
8 #include "vm/globals.h" 8 #include "vm/globals.h"
9 #include "vm/handles.h" 9 #include "vm/handles.h"
10 #include "vm/os_thread.h" 10 #include "vm/os_thread.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 return state_.timeline_block; 305 return state_.timeline_block;
306 } 306 }
307 307
308 // Only safe to access when holding |timeline_block_lock_|. 308 // Only safe to access when holding |timeline_block_lock_|.
309 void set_timeline_block(TimelineEventBlock* block) { 309 void set_timeline_block(TimelineEventBlock* block) {
310 state_.timeline_block = block; 310 state_.timeline_block = block;
311 } 311 }
312 312
313 class Log* log() const; 313 class Log* log() const;
314 314
315 static const intptr_t kNoDeoptId = -1;
316 static const intptr_t kDeoptIdStep = 2;
317 static const intptr_t kDeoptIdBeforeOffset = 0;
318 static const intptr_t kDeoptIdAfterOffset = 1;
319 intptr_t deopt_id() const { return deopt_id_; }
320 void set_deopt_id(int value) {
321 ASSERT(value >= 0);
322 deopt_id_ = value;
323 }
324 intptr_t GetNextDeoptId() {
325 ASSERT(deopt_id_ != kNoDeoptId);
326 const intptr_t id = deopt_id_;
327 deopt_id_ += kDeoptIdStep;
328 return id;
329 }
330
331 static intptr_t ToDeoptAfter(intptr_t deopt_id) {
332 ASSERT(IsDeoptBefore(deopt_id));
333 return deopt_id + kDeoptIdAfterOffset;
334 }
335
336 static bool IsDeoptBefore(intptr_t deopt_id) {
337 return (deopt_id % kDeoptIdStep) == kDeoptIdBeforeOffset;
338 }
339
340 static bool IsDeoptAfter(intptr_t deopt_id) {
341 return (deopt_id % kDeoptIdStep) == kDeoptIdAfterOffset;
342 }
343
315 LongJumpScope* long_jump_base() const { return state_.long_jump_base; } 344 LongJumpScope* long_jump_base() const { return state_.long_jump_base; }
316 void set_long_jump_base(LongJumpScope* value) { 345 void set_long_jump_base(LongJumpScope* value) {
317 state_.long_jump_base = value; 346 state_.long_jump_base = value;
318 } 347 }
319 348
320 uword vm_tag() const { 349 uword vm_tag() const {
321 return vm_tag_; 350 return vm_tag_;
322 } 351 }
323 void set_vm_tag(uword tag) { 352 void set_vm_tag(uword tag) {
324 vm_tag_ = tag; 353 vm_tag_ = tag;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 404
376 const ThreadId id_; 405 const ThreadId id_;
377 ThreadInterruptCallback thread_interrupt_callback_; 406 ThreadInterruptCallback thread_interrupt_callback_;
378 void* thread_interrupt_data_; 407 void* thread_interrupt_data_;
379 Isolate* isolate_; 408 Isolate* isolate_;
380 Heap* heap_; 409 Heap* heap_;
381 State state_; 410 State state_;
382 Mutex timeline_block_lock_; 411 Mutex timeline_block_lock_;
383 StoreBufferBlock* store_buffer_block_; 412 StoreBufferBlock* store_buffer_block_;
384 class Log* log_; 413 class Log* log_;
414 intptr_t deopt_id_; // Compilation specific counter.
385 uword vm_tag_; 415 uword vm_tag_;
386 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \ 416 #define DECLARE_MEMBERS(type_name, member_name, expr, default_init_value) \
387 type_name member_name; 417 type_name member_name;
388 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS) 418 CACHED_CONSTANTS_LIST(DECLARE_MEMBERS)
389 #undef DECLARE_MEMBERS 419 #undef DECLARE_MEMBERS
390 420
391 #define DECLARE_MEMBERS(name) \ 421 #define DECLARE_MEMBERS(name) \
392 uword name##_entry_point_; 422 uword name##_entry_point_;
393 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS) 423 RUNTIME_ENTRY_LIST(DECLARE_MEMBERS)
394 #undef DECLARE_MEMBERS 424 #undef DECLARE_MEMBERS
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 friend class ApiZone; 476 friend class ApiZone;
447 friend class Isolate; 477 friend class Isolate;
448 friend class StackZone; 478 friend class StackZone;
449 friend class ThreadRegistry; 479 friend class ThreadRegistry;
450 DISALLOW_COPY_AND_ASSIGN(Thread); 480 DISALLOW_COPY_AND_ASSIGN(Thread);
451 }; 481 };
452 482
453 } // namespace dart 483 } // namespace dart
454 484
455 #endif // VM_THREAD_H_ 485 #endif // VM_THREAD_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698