| 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 v8::HandleScope scope; | 308 v8::HandleScope scope; |
| 309 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); | 309 CreateTraceCallerFunction("JSFuncDoTrace", "js_trace"); |
| 310 CompileRun( | 310 CompileRun( |
| 311 "function JSTrace() {" | 311 "function JSTrace() {" |
| 312 " JSFuncDoTrace();" | 312 " JSFuncDoTrace();" |
| 313 "};\n" | 313 "};\n" |
| 314 "function OuterJSTrace() {" | 314 "function OuterJSTrace() {" |
| 315 " JSTrace();" | 315 " JSTrace();" |
| 316 "};\n" | 316 "};\n" |
| 317 "OuterJSTrace();"); | 317 "OuterJSTrace();"); |
| 318 // The last JS function called. |
| 319 CHECK_EQ(GetGlobalJSFunction("JSFuncDoTrace")->address(), |
| 320 sample.function); |
| 318 CHECK_GT(sample.frames_count, 1); | 321 CHECK_GT(sample.frames_count, 1); |
| 319 // Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace" | 322 // Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace" |
| 320 CheckRetAddrIsInJSFunction("JSTrace", | 323 CheckRetAddrIsInJSFunction("JSTrace", |
| 321 sample.stack[0]); | 324 sample.stack[0]); |
| 322 CheckRetAddrIsInJSFunction("OuterJSTrace", | 325 CheckRetAddrIsInJSFunction("OuterJSTrace", |
| 323 sample.stack[1]); | 326 sample.stack[1]); |
| 324 } | 327 } |
| 325 | 328 |
| 326 | 329 |
| 327 static void CFuncDoTrace(byte dummy_parameter) { | 330 static void CFuncDoTrace(byte dummy_parameter) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 CHECK_EQ(0, GetJsEntrySp()); | 366 CHECK_EQ(0, GetJsEntrySp()); |
| 364 CompileRun("a = 1; b = a + 1;"); | 367 CompileRun("a = 1; b = a + 1;"); |
| 365 CHECK_EQ(0, GetJsEntrySp()); | 368 CHECK_EQ(0, GetJsEntrySp()); |
| 366 CompileRun("js_entry_sp();"); | 369 CompileRun("js_entry_sp();"); |
| 367 CHECK_EQ(0, GetJsEntrySp()); | 370 CHECK_EQ(0, GetJsEntrySp()); |
| 368 CompileRun("js_entry_sp_level2();"); | 371 CompileRun("js_entry_sp_level2();"); |
| 369 CHECK_EQ(0, GetJsEntrySp()); | 372 CHECK_EQ(0, GetJsEntrySp()); |
| 370 } | 373 } |
| 371 | 374 |
| 372 #endif // ENABLE_LOGGING_AND_PROFILING | 375 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |