Index: src/platform-win32.cc |
diff --git a/src/platform-win32.cc b/src/platform-win32.cc |
index f16b5e74fda8705cd36db689eab1d2e94d0f0f17..8af41a0039a49990875ea634ece2b7ac6c963b2e 100644 |
--- a/src/platform-win32.cc |
+++ b/src/platform-win32.cc |
@@ -124,6 +124,19 @@ int random() { |
namespace v8 { |
namespace internal { |
+typedef Address* (*ReturnAddressResolutionFunction)(Address*); |
+static ReturnAddressResolutionFunction |
+ LookupProfilerReturnAddressResolutionFunction() { |
+ // DO NOT SUBMIT |
+ // TODO(siggi): Check for the presence of the Syzygy instrumentation by |
Roger McFarlane (Chromium)
2012/02/15 21:19:03
Another way to do this would be to introduce and r
Sigurður Ásgeirsson
2012/02/15 21:45:56
To expand on my email reply, the issue is that bin
|
+ // testing for the presence of the .thunks segment. This is quick as |
+ // we're only looking at the image headers. |
+ // If instrumentation is present, look for the export we want on one of |
+ // the modules we import. |
+ return NULL; |
+} |
+ |
+ |
intptr_t OS::MaxVirtualMemory() { |
return 0; |
} |
@@ -1241,6 +1254,31 @@ void OS::SignalCodeMovingGC() { |
} |
+Address* OS::ResolveReturnAddressLocation(Address* pc_address) { |
+ // Make the normal case where there is no profiling in effect very fast. |
+ static bool no_profiling = false; |
+ if (no_profiling) |
+ return pc_address; |
+ |
+ // Either profiling is in effect, or we haven't checked for the presence |
+ // of the profiler yet. |
+ static bool profiler_check_finished = false; |
+ ReturnAddressResolutionFunction resolve_return_address = NULL; |
+ if (!profiler_check_finished) { |
+ resolve_return_address = LookupProfilerReturnAddressResolutionFunction(); |
+ profiler_check_finished = true; |
+ } |
+ ASSERT(profiler_check_finished); |
+ |
+ if (resolve_return_address == NULL) { |
+ no_profiling = true; |
+ return pc_address; |
+ } |
+ |
+ return resolve_return_address(pc_address); |
+} |
+ |
+ |
// Walk the stack using the facilities in dbghelp.dll and tlhelp32.dll |
// Switch off warning 4748 (/GS can not protect parameters and local variables |