OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_SAFEPOINT_H_ | 5 #ifndef VM_SAFEPOINT_H_ |
6 #define VM_SAFEPOINT_H_ | 6 #define VM_SAFEPOINT_H_ |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #include "vm/lockers.h" | 9 #include "vm/lockers.h" |
10 #include "vm/thread.h" | 10 #include "vm/thread.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 302 } |
303 | 303 |
304 ~TransitionToGenerated() { | 304 ~TransitionToGenerated() { |
305 ASSERT(thread()->execution_state() == Thread::kThreadInGenerated); | 305 ASSERT(thread()->execution_state() == Thread::kThreadInGenerated); |
306 if (execution_state_ == Thread::kThreadInNative) { | 306 if (execution_state_ == Thread::kThreadInNative) { |
307 thread()->set_execution_state(Thread::kThreadInNative); | 307 thread()->set_execution_state(Thread::kThreadInNative); |
308 thread()->EnterSafepoint(); | 308 thread()->EnterSafepoint(); |
309 } else { | 309 } else { |
310 ASSERT(execution_state_ == Thread::kThreadInVM); | 310 ASSERT(execution_state_ == Thread::kThreadInVM); |
311 thread()->set_execution_state(Thread::kThreadInVM); | 311 thread()->set_execution_state(Thread::kThreadInVM); |
312 // Fast check to see if a safepoint is requested or not. | |
313 // We do the more expensive operation of blocking the thread | |
314 // only if a safepoint is requested. | |
315 if (thread()->IsSafepointRequested()) { | |
316 handler()->BlockForSafepoint(thread()); | |
317 } | |
318 } | 312 } |
319 } | 313 } |
320 | 314 |
321 private: | 315 private: |
322 int16_t execution_state_; | 316 int16_t execution_state_; |
323 DISALLOW_COPY_AND_ASSIGN(TransitionToGenerated); | 317 DISALLOW_COPY_AND_ASSIGN(TransitionToGenerated); |
324 }; | 318 }; |
325 | 319 |
326 } // namespace dart | 320 } // namespace dart |
327 | 321 |
328 #endif // VM_SAFEPOINT_H_ | 322 #endif // VM_SAFEPOINT_H_ |
OLD | NEW |