Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 // Generate a pseudo-random number in the range 0-2^31-1. Usually | 117 // Generate a pseudo-random number in the range 0-2^31-1. Usually |
| 118 // defined in stdlib.h. Missing in both Microsoft Visual Studio C++ and MinGW. | 118 // defined in stdlib.h. Missing in both Microsoft Visual Studio C++ and MinGW. |
| 119 int random() { | 119 int random() { |
| 120 return rand(); | 120 return rand(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 namespace v8 { | 124 namespace v8 { |
| 125 namespace internal { | 125 namespace internal { |
| 126 | 126 |
| 127 typedef Address* (*ReturnAddressResolutionFunction)(Address*); | |
| 128 static ReturnAddressResolutionFunction | |
| 129 LookupProfilerReturnAddressResolutionFunction() { | |
| 130 // DO NOT SUBMIT | |
| 131 // 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
| |
| 132 // testing for the presence of the .thunks segment. This is quick as | |
| 133 // we're only looking at the image headers. | |
| 134 // If instrumentation is present, look for the export we want on one of | |
| 135 // the modules we import. | |
| 136 return NULL; | |
| 137 } | |
| 138 | |
| 139 | |
| 127 intptr_t OS::MaxVirtualMemory() { | 140 intptr_t OS::MaxVirtualMemory() { |
| 128 return 0; | 141 return 0; |
| 129 } | 142 } |
| 130 | 143 |
| 131 | 144 |
| 132 double ceiling(double x) { | 145 double ceiling(double x) { |
| 133 return ceil(x); | 146 return ceil(x); |
| 134 } | 147 } |
| 135 | 148 |
| 136 | 149 |
| (...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1234 if (!LoadDbgHelpAndTlHelp32()) return; | 1247 if (!LoadDbgHelpAndTlHelp32()) return; |
| 1235 HANDLE process_handle = GetCurrentProcess(); | 1248 HANDLE process_handle = GetCurrentProcess(); |
| 1236 LoadSymbols(process_handle); | 1249 LoadSymbols(process_handle); |
| 1237 } | 1250 } |
| 1238 | 1251 |
| 1239 | 1252 |
| 1240 void OS::SignalCodeMovingGC() { | 1253 void OS::SignalCodeMovingGC() { |
| 1241 } | 1254 } |
| 1242 | 1255 |
| 1243 | 1256 |
| 1257 Address* OS::ResolveReturnAddressLocation(Address* pc_address) { | |
| 1258 // Make the normal case where there is no profiling in effect very fast. | |
| 1259 static bool no_profiling = false; | |
| 1260 if (no_profiling) | |
| 1261 return pc_address; | |
| 1262 | |
| 1263 // Either profiling is in effect, or we haven't checked for the presence | |
| 1264 // of the profiler yet. | |
| 1265 static bool profiler_check_finished = false; | |
| 1266 ReturnAddressResolutionFunction resolve_return_address = NULL; | |
| 1267 if (!profiler_check_finished) { | |
| 1268 resolve_return_address = LookupProfilerReturnAddressResolutionFunction(); | |
| 1269 profiler_check_finished = true; | |
| 1270 } | |
| 1271 ASSERT(profiler_check_finished); | |
| 1272 | |
| 1273 if (resolve_return_address == NULL) { | |
| 1274 no_profiling = true; | |
| 1275 return pc_address; | |
| 1276 } | |
| 1277 | |
| 1278 return resolve_return_address(pc_address); | |
| 1279 } | |
| 1280 | |
| 1281 | |
| 1244 // Walk the stack using the facilities in dbghelp.dll and tlhelp32.dll | 1282 // Walk the stack using the facilities in dbghelp.dll and tlhelp32.dll |
| 1245 | 1283 |
| 1246 // Switch off warning 4748 (/GS can not protect parameters and local variables | 1284 // Switch off warning 4748 (/GS can not protect parameters and local variables |
| 1247 // from local buffer overrun because optimizations are disabled in function) as | 1285 // from local buffer overrun because optimizations are disabled in function) as |
| 1248 // it is triggered by the use of inline assembler. | 1286 // it is triggered by the use of inline assembler. |
| 1249 #pragma warning(push) | 1287 #pragma warning(push) |
| 1250 #pragma warning(disable : 4748) | 1288 #pragma warning(disable : 4748) |
| 1251 int OS::StackWalk(Vector<OS::StackFrame> frames) { | 1289 int OS::StackWalk(Vector<OS::StackFrame> frames) { |
| 1252 BOOL ok; | 1290 BOOL ok; |
| 1253 | 1291 |
| (...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2034 | 2072 |
| 2035 | 2073 |
| 2036 void Sampler::Stop() { | 2074 void Sampler::Stop() { |
| 2037 ASSERT(IsActive()); | 2075 ASSERT(IsActive()); |
| 2038 SamplerThread::RemoveActiveSampler(this); | 2076 SamplerThread::RemoveActiveSampler(this); |
| 2039 SetActive(false); | 2077 SetActive(false); |
| 2040 } | 2078 } |
| 2041 | 2079 |
| 2042 | 2080 |
| 2043 } } // namespace v8::internal | 2081 } } // namespace v8::internal |
| OLD | NEW |