| Index: test/cctest/test-log-stack-tracer.cc
|
| diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc
|
| index 07416be145bbae3e2486dd2c63274b1bacc2be65..9ce913202048edac6241103f9ec360b00e9f3ac8 100644
|
| --- a/test/cctest/test-log-stack-tracer.cc
|
| +++ b/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;
|
| @@ -76,7 +77,7 @@ static void DoTrace(Address fp) {
|
| // sp is only used to define stack high bound
|
| trace_env.sample->sp =
|
| reinterpret_cast<Address>(trace_env.sample) - 10240;
|
| - StackTracer::Trace(trace_env.sample);
|
| + StackTracer::Trace(Isolate::Current(), trace_env.sample);
|
| }
|
|
|
|
|
| @@ -201,6 +202,7 @@ static void InitializeVM() {
|
|
|
|
|
| static void CheckJSFunctionAtAddress(const char* func_name, Address addr) {
|
| + CHECK(HEAP->Contains(addr));
|
| i::Object* obj = i::HeapObject::FromAddress(addr);
|
| CHECK(obj->IsJSFunction());
|
| CHECK(JSFunction::cast(obj)->shared()->name()->IsString());
|
| @@ -299,10 +301,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]);
|
| }
|
|
|
|
|
| @@ -312,6 +321,10 @@ TEST(CFromJSStackTrace) {
|
| // Isolate::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);
|
|
|
| @@ -342,10 +355,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]);
|
| }
|
|
|
|
|
|
|