diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2010-12-07 13:56:11 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2010-12-07 13:56:11 -0800 |
commit | c30f1137121315b0d3641af6dc61e3b047f940e1 (patch) | |
tree | f118eaf670505e6a63f28bc8df845520f67adc55 /deps/v8/test/cctest/test-log-stack-tracer.cc | |
parent | 5b8c62f7d12c1c5a553e765ba05bbd8a7e17ee47 (diff) | |
download | node-new-c30f1137121315b0d3641af6dc61e3b047f940e1.tar.gz |
Upgrade V8 to 3.0.0
Diffstat (limited to 'deps/v8/test/cctest/test-log-stack-tracer.cc')
-rw-r--r-- | deps/v8/test/cctest/test-log-stack-tracer.cc | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc index 65be6bd85e..c85f6c0bc3 100644 --- a/deps/v8/test/cctest/test-log-stack-tracer.cc +++ b/deps/v8/test/cctest/test-log-stack-tracer.cc @@ -39,6 +39,7 @@ #include "cctest.h" #include "disassembler.h" #include "register-allocator-inl.h" +#include "vm-state-inl.h" using v8::Function; using v8::Local; @@ -200,6 +201,7 @@ static void InitializeVM() { static void CheckJSFunctionAtAddress(const char* func_name, Address addr) { + CHECK(i::Heap::Contains(addr)); i::Object* obj = i::HeapObject::FromAddress(addr); CHECK(obj->IsJSFunction()); CHECK(JSFunction::cast(obj)->shared()->name()->IsString()); @@ -298,10 +300,17 @@ TEST(CFromJSStackTrace) { // trace(EBP) [native (extension)] // DoTrace(EBP) [native] // StackTracer::Trace - CHECK_GT(sample.frames_count, 1); + + // The VM state tracking keeps track of external callbacks and puts + // them at the top of the sample stack. + int base = 0; + CHECK(sample.stack[0] == FUNCTION_ADDR(TraceExtension::Trace)); + base++; + // Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace" - CheckJSFunctionAtAddress("JSFuncDoTrace", sample.stack[0]); - CheckJSFunctionAtAddress("JSTrace", sample.stack[1]); + CHECK_GT(sample.frames_count, base + 1); + CheckJSFunctionAtAddress("JSFuncDoTrace", sample.stack[base + 0]); + CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 1]); } @@ -311,6 +320,10 @@ TEST(CFromJSStackTrace) { // Top::c_entry_fp value. In this case, StackTracer uses passed frame // pointer value as a starting point for stack walking. TEST(PureJSStackTrace) { + // This test does not pass with inlining enabled since inlined functions + // don't appear in the stack trace. + i::FLAG_use_inlining = false; + TickSample sample; InitTraceEnv(&sample); @@ -341,10 +354,17 @@ TEST(PureJSStackTrace) { // The last JS function called. It is only visible through // sample.function, as its return address is above captured EBP value. CheckJSFunctionAtAddress("JSFuncDoTrace", sample.function); - CHECK_GT(sample.frames_count, 1); + + // The VM state tracking keeps track of external callbacks and puts + // them at the top of the sample stack. + int base = 0; + CHECK(sample.stack[0] == FUNCTION_ADDR(TraceExtension::JSTrace)); + base++; + // Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace" - CheckJSFunctionAtAddress("JSTrace", sample.stack[0]); - CheckJSFunctionAtAddress("OuterJSTrace", sample.stack[1]); + CHECK_GT(sample.frames_count, base + 1); + CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 0]); + CheckJSFunctionAtAddress("OuterJSTrace", sample.stack[base + 1]); } |