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

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

Issue 1869933002: Do not block for safepoint when transitioning from generated code to VM, otherwise the result may n… (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: sync Created 4 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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) 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
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_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698