OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Tests of profiler-related functions from log.h | 3 // Tests of profiler-related functions from log.h |
4 | 4 |
5 #ifdef ENABLE_LOGGING_AND_PROFILING | 5 #ifdef ENABLE_LOGGING_AND_PROFILING |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "v8.h" | 9 #include "v8.h" |
10 | 10 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 SetGlobalProperty(func_name, v8::ToApi<Value>(func)); | 266 SetGlobalProperty(func_name, v8::ToApi<Value>(func)); |
267 CHECK_EQ(*func, *GetGlobalJSFunction(func_name)); | 267 CHECK_EQ(*func, *GetGlobalJSFunction(func_name)); |
268 } | 268 } |
269 | 269 |
270 | 270 |
271 // This test verifies that stack tracing works when called during | 271 // This test verifies that stack tracing works when called during |
272 // execution of a native function called from JS code. In this case, | 272 // execution of a native function called from JS code. In this case, |
273 // StackTracer uses Top::c_entry_fp as a starting point for stack | 273 // StackTracer uses Top::c_entry_fp as a starting point for stack |
274 // walking. | 274 // walking. |
275 TEST(CFromJSStackTrace) { | 275 TEST(CFromJSStackTrace) { |
| 276 #ifdef V8_HOST_ARCH_IA32 |
| 277 // TODO(711) The hack of replacing the inline runtime function |
| 278 // RandomHeapNumber with GetFrameNumber does not work with the way the full |
| 279 // compiler generates inline runtime calls. |
| 280 i::FLAG_force_full_compiler = false; |
| 281 #endif |
| 282 |
276 TickSample sample; | 283 TickSample sample; |
277 InitTraceEnv(&sample); | 284 InitTraceEnv(&sample); |
278 | 285 |
279 InitializeVM(); | 286 InitializeVM(); |
280 v8::HandleScope scope; | 287 v8::HandleScope scope; |
281 // Create global function JSFuncDoTrace which calls | 288 // Create global function JSFuncDoTrace which calls |
282 // extension function trace() with the current frame pointer value. | 289 // extension function trace() with the current frame pointer value. |
283 CreateTraceCallerFunction("JSFuncDoTrace", "trace"); | 290 CreateTraceCallerFunction("JSFuncDoTrace", "trace"); |
284 Local<Value> result = CompileRun( | 291 Local<Value> result = CompileRun( |
285 "function JSTrace() {" | 292 "function JSTrace() {" |
(...skipping 15 matching lines...) Expand all Loading... |
301 CheckObjectIsJSFunction("JSTrace", sample.stack[1]); | 308 CheckObjectIsJSFunction("JSTrace", sample.stack[1]); |
302 } | 309 } |
303 | 310 |
304 | 311 |
305 // This test verifies that stack tracing works when called during | 312 // This test verifies that stack tracing works when called during |
306 // execution of JS code. However, as calling StackTracer requires | 313 // execution of JS code. However, as calling StackTracer requires |
307 // entering native code, we can only emulate pure JS by erasing | 314 // entering native code, we can only emulate pure JS by erasing |
308 // Top::c_entry_fp value. In this case, StackTracer uses passed frame | 315 // Top::c_entry_fp value. In this case, StackTracer uses passed frame |
309 // pointer value as a starting point for stack walking. | 316 // pointer value as a starting point for stack walking. |
310 TEST(PureJSStackTrace) { | 317 TEST(PureJSStackTrace) { |
| 318 #ifdef V8_HOST_ARCH_IA32 |
| 319 // TODO(711) The hack of replacing the inline runtime function |
| 320 // RandomHeapNumber with GetFrameNumber does not work with the way the full |
| 321 // compiler generates inline runtime calls. |
| 322 i::FLAG_force_full_compiler = false; |
| 323 #endif |
| 324 |
311 TickSample sample; | 325 TickSample sample; |
312 InitTraceEnv(&sample); | 326 InitTraceEnv(&sample); |
313 | 327 |
314 InitializeVM(); | 328 InitializeVM(); |
315 v8::HandleScope scope; | 329 v8::HandleScope scope; |
316 // Create global function JSFuncDoTrace which calls | 330 // Create global function JSFuncDoTrace which calls |
317 // extension function js_trace() with the current frame pointer value. | 331 // extension function js_trace() with the current frame pointer value. |
318 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); | 332 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); |
319 Local<Value> result = CompileRun( | 333 Local<Value> result = CompileRun( |
320 "function JSTrace() {" | 334 "function JSTrace() {" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 CHECK_EQ(0, GetJsEntrySp()); | 402 CHECK_EQ(0, GetJsEntrySp()); |
389 CompileRun("a = 1; b = a + 1;"); | 403 CompileRun("a = 1; b = a + 1;"); |
390 CHECK_EQ(0, GetJsEntrySp()); | 404 CHECK_EQ(0, GetJsEntrySp()); |
391 CompileRun("js_entry_sp();"); | 405 CompileRun("js_entry_sp();"); |
392 CHECK_EQ(0, GetJsEntrySp()); | 406 CHECK_EQ(0, GetJsEntrySp()); |
393 CompileRun("js_entry_sp_level2();"); | 407 CompileRun("js_entry_sp_level2();"); |
394 CHECK_EQ(0, GetJsEntrySp()); | 408 CHECK_EQ(0, GetJsEntrySp()); |
395 } | 409 } |
396 | 410 |
397 #endif // ENABLE_LOGGING_AND_PROFILING | 411 #endif // ENABLE_LOGGING_AND_PROFILING |
OLD | NEW |