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

Unified Diff: dart/runtime/vm/profiler.cc

Issue 298153002: Version 1.4.1 (Closed) Base URL: http://dart.googlecode.com/svn/branches/1.4/
Patch Set: Created 6 years, 7 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 | « dart/runtime/vm/parser.cc ('k') | dart/runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/runtime/vm/profiler.cc
===================================================================
--- dart/runtime/vm/profiler.cc (revision 36615)
+++ dart/runtime/vm/profiler.cc (working copy)
@@ -21,8 +21,7 @@
namespace dart {
-#if defined(USING_SIMULATOR) || defined(TARGET_OS_WINDOWS) || \
- defined(TARGET_OS_ANDROID)
+#if defined(USING_SIMULATOR) || defined(TARGET_OS_ANDROID)
DEFINE_FLAG(bool, profile, false, "Enable Sampling Profiler");
#else
DEFINE_FLAG(bool, profile, true, "Enable Sampling Profiler");
@@ -1688,7 +1687,7 @@
// Stack pointer should not be above frame pointer.
return 1;
}
- intptr_t gap = original_fp_ - original_sp_;
+ const intptr_t gap = original_fp_ - original_sp_;
if (gap >= kMaxStep) {
// Gap between frame pointer and stack pointer is
// too large.
@@ -1699,8 +1698,19 @@
// the isolates stack limit.
lower_bound_ = original_sp_;
}
- // Store the PC marker for the top frame.
- sample_->set_pc_marker(GetCurrentFramePcMarker(fp));
+#if defined(TARGET_OS_WINDOWS)
+ // If the original_fp_ is at the beginning of a page, it may be unsafe
+ // to access the pc marker, because we are reading it from a different
+ // thread on Windows. The next page may be a guard page.
+ const intptr_t kPageMask = kMaxStep - 1;
+ bool safe_to_read_pc_marker = (original_fp_ & kPageMask) != 0;
+#else
+ bool safe_to_read_pc_marker = true;
+#endif
+ if (safe_to_read_pc_marker && (gap > 0)) {
+ // Store the PC marker for the top frame.
+ sample_->set_pc_marker(GetCurrentFramePcMarker(fp));
+ }
int i = 0;
for (; i < FLAG_profile_depth; i++) {
if (FLAG_profile_verify_stack_walk) {
« no previous file with comments | « dart/runtime/vm/parser.cc ('k') | dart/runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698