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

Side by Side Diff: runtime/vm/isolate.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) 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 "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 319
320 MessageHandler* message_handler() const { return message_handler_; } 320 MessageHandler* message_handler() const { return message_handler_; }
321 void set_message_handler(MessageHandler* value) { message_handler_ = value; } 321 void set_message_handler(MessageHandler* value) { message_handler_ = value; }
322 322
323 bool is_runnable() const { return is_runnable_; } 323 bool is_runnable() const { return is_runnable_; }
324 void set_is_runnable(bool value) { is_runnable_ = value; } 324 void set_is_runnable(bool value) { is_runnable_ = value; }
325 325
326 IsolateSpawnState* spawn_state() const { return spawn_state_; } 326 IsolateSpawnState* spawn_state() const { return spawn_state_; }
327 void set_spawn_state(IsolateSpawnState* value) { spawn_state_ = value; } 327 void set_spawn_state(IsolateSpawnState* value) { spawn_state_ = value; }
328 328
329 static const intptr_t kNoDeoptId = -1;
330 static const intptr_t kDeoptIdStep = 2;
331 static const intptr_t kDeoptIdBeforeOffset = 0;
332 static const intptr_t kDeoptIdAfterOffset = 1;
333 intptr_t deopt_id() const { return deopt_id_; }
334 void set_deopt_id(int value) {
335 ASSERT(value >= 0);
336 deopt_id_ = value;
337 }
338 intptr_t GetNextDeoptId() {
339 ASSERT(deopt_id_ != kNoDeoptId);
340 const intptr_t id = deopt_id_;
341 deopt_id_ += kDeoptIdStep;
342 return id;
343 }
344
345 static intptr_t ToDeoptAfter(intptr_t deopt_id) {
346 ASSERT(IsDeoptBefore(deopt_id));
347 return deopt_id + kDeoptIdAfterOffset;
348 }
349
350 static bool IsDeoptBefore(intptr_t deopt_id) {
351 return (deopt_id % kDeoptIdStep) == kDeoptIdBeforeOffset;
352 }
353
354 static bool IsDeoptAfter(intptr_t deopt_id) {
355 return (deopt_id % kDeoptIdStep) == kDeoptIdAfterOffset;
356 }
357
358 Mutex* mutex() const { return mutex_; } 329 Mutex* mutex() const { return mutex_; }
359 330
360 Debugger* debugger() const { 331 Debugger* debugger() const {
361 ASSERT(debugger_ != NULL); 332 ASSERT(debugger_ != NULL);
362 return debugger_; 333 return debugger_;
363 } 334 }
364 335
365 void set_single_step(bool value) { single_step_ = value; } 336 void set_single_step(bool value) { single_step_ = value; }
366 bool single_step() const { return single_step_; } 337 bool single_step() const { return single_step_; }
367 static intptr_t single_step_offset() { 338 static intptr_t single_step_offset() {
368 return OFFSET_OF(Isolate, single_step_); 339 return OFFSET_OF(Isolate, single_step_);
369 } 340 }
370 341
371 void set_has_compiled(bool value) { has_compiled_ = value; } 342 void set_has_compiled_code(bool value) { has_compiled_code_ = value; }
372 bool has_compiled() const { return has_compiled_; } 343 bool has_compiled_code() const { return has_compiled_code_; }
373 344
374 // TODO(iposva): Evaluate whether two different isolate flag structures are 345 // TODO(iposva): Evaluate whether two different isolate flag structures are
375 // needed. Currently it serves as a separation between publicly visible flags 346 // needed. Currently it serves as a separation between publicly visible flags
376 // and VM internal flags. 347 // and VM internal flags.
377 class Flags : public ValueObject { 348 class Flags : public ValueObject {
378 public: 349 public:
379 // Construct default flags as specified by the options. 350 // Construct default flags as specified by the options.
380 Flags(); 351 Flags();
381 352
382 bool type_checks() const { return type_checks_; } 353 bool type_checks() const { return type_checks_; }
(...skipping 21 matching lines...) Expand all
404 DISALLOW_ALLOCATION(); 375 DISALLOW_ALLOCATION();
405 DISALLOW_COPY_AND_ASSIGN(Flags); 376 DISALLOW_COPY_AND_ASSIGN(Flags);
406 }; 377 };
407 378
408 const Flags& flags() const { return flags_; } 379 const Flags& flags() const { return flags_; }
409 380
410 // Set the checks in the compiler to the highest level. Statically and when 381 // Set the checks in the compiler to the highest level. Statically and when
411 // executing generated code. Needs to be called before any code has been 382 // executing generated code. Needs to be called before any code has been
412 // compiled. 383 // compiled.
413 void set_strict_compilation() { 384 void set_strict_compilation() {
414 ASSERT(!has_compiled()); 385 ASSERT(!has_compiled_code());
415 flags_.type_checks_ = true; 386 flags_.type_checks_ = true;
416 flags_.asserts_ = true; 387 flags_.asserts_ = true;
417 flags_.error_on_bad_type_ = true; 388 flags_.error_on_bad_type_ = true;
418 flags_.error_on_bad_override_ = true; 389 flags_.error_on_bad_override_ = true;
419 } 390 }
420 391
421 // Requests that the debugger resume execution. 392 // Requests that the debugger resume execution.
422 void Resume() { 393 void Resume() {
423 resume_request_ = true; 394 resume_request_ = true;
424 set_last_resume_timestamp(); 395 set_last_resume_timestamp();
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
802 bool errors_fatal_; 773 bool errors_fatal_;
803 ObjectStore* object_store_; 774 ObjectStore* object_store_;
804 uword top_exit_frame_info_; 775 uword top_exit_frame_info_;
805 void* init_callback_data_; 776 void* init_callback_data_;
806 Dart_EnvironmentCallback environment_callback_; 777 Dart_EnvironmentCallback environment_callback_;
807 Dart_LibraryTagHandler library_tag_handler_; 778 Dart_LibraryTagHandler library_tag_handler_;
808 ApiState* api_state_; 779 ApiState* api_state_;
809 Debugger* debugger_; 780 Debugger* debugger_;
810 bool resume_request_; 781 bool resume_request_;
811 int64_t last_resume_timestamp_; 782 int64_t last_resume_timestamp_;
812 bool has_compiled_; 783 bool has_compiled_code_; // Can check that no compilation occured.
813 Flags flags_; 784 Flags flags_;
814 Random random_; 785 Random random_;
815 Simulator* simulator_; 786 Simulator* simulator_;
816 intptr_t deopt_id_;
817 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_. 787 Mutex* mutex_; // protects stack_limit_ and saved_stack_limit_.
818 uword saved_stack_limit_; 788 uword saved_stack_limit_;
819 uword stack_base_; 789 uword stack_base_;
820 uword stack_overflow_flags_; 790 uword stack_overflow_flags_;
821 int32_t stack_overflow_count_; 791 int32_t stack_overflow_count_;
822 MessageHandler* message_handler_; 792 MessageHandler* message_handler_;
823 IsolateSpawnState* spawn_state_; 793 IsolateSpawnState* spawn_state_;
824 bool is_runnable_; 794 bool is_runnable_;
825 Dart_GcPrologueCallback gc_prologue_callback_; 795 Dart_GcPrologueCallback gc_prologue_callback_;
826 Dart_GcEpilogueCallback gc_epilogue_callback_; 796 Dart_GcEpilogueCallback gc_epilogue_callback_;
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 uint8_t* serialized_message_; 1049 uint8_t* serialized_message_;
1080 intptr_t serialized_message_len_; 1050 intptr_t serialized_message_len_;
1081 Isolate::Flags isolate_flags_; 1051 Isolate::Flags isolate_flags_;
1082 bool paused_; 1052 bool paused_;
1083 bool errors_are_fatal_; 1053 bool errors_are_fatal_;
1084 }; 1054 };
1085 1055
1086 } // namespace dart 1056 } // namespace dart
1087 1057
1088 #endif // VM_ISOLATE_H_ 1058 #endif // VM_ISOLATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698