| 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 #if defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_X64) | |
| 277 // TODO(711) The hack of replacing the inline runtime function | 276 // TODO(711) The hack of replacing the inline runtime function |
| 278 // RandomHeapNumber with GetFrameNumber does not work with the way the full | 277 // RandomHeapNumber with GetFrameNumber does not work with the way the full |
| 279 // compiler generates inline runtime calls. | 278 // compiler generates inline runtime calls. |
| 280 i::FLAG_force_full_compiler = false; | 279 i::FLAG_always_full_compiler = false; |
| 281 #endif | |
| 282 | 280 |
| 283 TickSample sample; | 281 TickSample sample; |
| 284 InitTraceEnv(&sample); | 282 InitTraceEnv(&sample); |
| 285 | 283 |
| 286 InitializeVM(); | 284 InitializeVM(); |
| 287 v8::HandleScope scope; | 285 v8::HandleScope scope; |
| 288 // Create global function JSFuncDoTrace which calls | 286 // Create global function JSFuncDoTrace which calls |
| 289 // extension function trace() with the current frame pointer value. | 287 // extension function trace() with the current frame pointer value. |
| 290 CreateTraceCallerFunction("JSFuncDoTrace", "trace"); | 288 CreateTraceCallerFunction("JSFuncDoTrace", "trace"); |
| 291 Local<Value> result = CompileRun( | 289 Local<Value> result = CompileRun( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 308 CheckObjectIsJSFunction("JSTrace", sample.stack[1]); | 306 CheckObjectIsJSFunction("JSTrace", sample.stack[1]); |
| 309 } | 307 } |
| 310 | 308 |
| 311 | 309 |
| 312 // This test verifies that stack tracing works when called during | 310 // This test verifies that stack tracing works when called during |
| 313 // execution of JS code. However, as calling StackTracer requires | 311 // execution of JS code. However, as calling StackTracer requires |
| 314 // entering native code, we can only emulate pure JS by erasing | 312 // entering native code, we can only emulate pure JS by erasing |
| 315 // Top::c_entry_fp value. In this case, StackTracer uses passed frame | 313 // Top::c_entry_fp value. In this case, StackTracer uses passed frame |
| 316 // pointer value as a starting point for stack walking. | 314 // pointer value as a starting point for stack walking. |
| 317 TEST(PureJSStackTrace) { | 315 TEST(PureJSStackTrace) { |
| 318 #if defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_X64) | |
| 319 // TODO(711) The hack of replacing the inline runtime function | 316 // TODO(711) The hack of replacing the inline runtime function |
| 320 // RandomHeapNumber with GetFrameNumber does not work with the way the full | 317 // RandomHeapNumber with GetFrameNumber does not work with the way the full |
| 321 // compiler generates inline runtime calls. | 318 // compiler generates inline runtime calls. |
| 322 i::FLAG_force_full_compiler = false; | 319 i::FLAG_always_full_compiler = false; |
| 323 #endif | |
| 324 | 320 |
| 325 TickSample sample; | 321 TickSample sample; |
| 326 InitTraceEnv(&sample); | 322 InitTraceEnv(&sample); |
| 327 | 323 |
| 328 InitializeVM(); | 324 InitializeVM(); |
| 329 v8::HandleScope scope; | 325 v8::HandleScope scope; |
| 330 // Create global function JSFuncDoTrace which calls | 326 // Create global function JSFuncDoTrace which calls |
| 331 // extension function js_trace() with the current frame pointer value. | 327 // extension function js_trace() with the current frame pointer value. |
| 332 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); | 328 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); |
| 333 Local<Value> result = CompileRun( | 329 Local<Value> result = CompileRun( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 CHECK_EQ(0, GetJsEntrySp()); | 398 CHECK_EQ(0, GetJsEntrySp()); |
| 403 CompileRun("a = 1; b = a + 1;"); | 399 CompileRun("a = 1; b = a + 1;"); |
| 404 CHECK_EQ(0, GetJsEntrySp()); | 400 CHECK_EQ(0, GetJsEntrySp()); |
| 405 CompileRun("js_entry_sp();"); | 401 CompileRun("js_entry_sp();"); |
| 406 CHECK_EQ(0, GetJsEntrySp()); | 402 CHECK_EQ(0, GetJsEntrySp()); |
| 407 CompileRun("js_entry_sp_level2();"); | 403 CompileRun("js_entry_sp_level2();"); |
| 408 CHECK_EQ(0, GetJsEntrySp()); | 404 CHECK_EQ(0, GetJsEntrySp()); |
| 409 } | 405 } |
| 410 | 406 |
| 411 #endif // ENABLE_LOGGING_AND_PROFILING | 407 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |