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

Unified Diff: runtime/vm/isolate.cc

Issue 322203005: Mitigate race condition in profiler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/isolate.cc
===================================================================
--- runtime/vm/isolate.cc (revision 37202)
+++ runtime/vm/isolate.cc (working copy)
@@ -1023,21 +1023,26 @@
intptr_t Isolate::ProfileInterrupt() {
- if (profiler_data() == NULL) {
+ // Other threads might be modifying these fields. Save them in locals so that
+ // we can at least trust the NULL check.
+ IsolateProfilerData* prof_data = profiler_data();
+ if (prof_data == NULL) {
// Profiler not setup for isolate.
return 0;
}
- if (profiler_data()->blocked()) {
+ if (prof_data->blocked()) {
// Profiler blocked for this isolate.
return 0;
}
- if ((debugger() != NULL) && debugger()->IsPaused()) {
+ Debugger* debug = debugger();
+ if ((debug != NULL) && debug->IsPaused()) {
// Paused at breakpoint. Don't tick.
return 0;
}
- if ((message_handler() != NULL) &&
- (message_handler()->paused_on_start() ||
- message_handler()->paused_on_exit())) {
+ MessageHandler* msg_handler = message_handler();
+ if ((msg_handler != NULL) &&
+ (msg_handler->paused_on_start() ||
+ msg_handler->paused_on_exit())) {
// Paused at start / exit . Don't tick.
return 0;
}
« 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