summaryrefslogtreecommitdiffstats
path: root/test/cctest/test-log-stack-tracer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'test/cctest/test-log-stack-tracer.cc')
-rw-r--r--test/cctest/test-log-stack-tracer.cc38
1 files changed, 18 insertions, 20 deletions
diff --git a/test/cctest/test-log-stack-tracer.cc b/test/cctest/test-log-stack-tracer.cc
index bf72184f..df0806f8 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -36,7 +36,7 @@
#include "api.h"
#include "codegen.h"
#include "log.h"
-#include "top.h"
+#include "isolate.h"
#include "cctest.h"
#include "disassembler.h"
#include "register-allocator-inl.h"
@@ -52,10 +52,10 @@ using v8::Value;
using v8::internal::byte;
using v8::internal::Address;
using v8::internal::Handle;
+using v8::internal::Isolate;
using v8::internal::JSFunction;
using v8::internal::StackTracer;
using v8::internal::TickSample;
-using v8::internal::Top;
namespace i = v8::internal;
@@ -78,18 +78,19 @@ 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);
}
// Hide c_entry_fp to emulate situation when sampling is done while
// pure JS code is being executed
static void DoTraceHideCEntryFPAddress(Address fp) {
- v8::internal::Address saved_c_frame_fp = *(Top::c_entry_fp_address());
+ v8::internal::Address saved_c_frame_fp =
+ *(Isolate::Current()->c_entry_fp_address());
CHECK(saved_c_frame_fp);
- *(Top::c_entry_fp_address()) = 0;
+ *(Isolate::Current()->c_entry_fp_address()) = 0;
DoTrace(fp);
- *(Top::c_entry_fp_address()) = saved_c_frame_fp;
+ *(Isolate::Current()->c_entry_fp_address()) = saved_c_frame_fp;
}
@@ -163,8 +164,8 @@ v8::Handle<v8::Value> TraceExtension::JSTrace(const v8::Arguments& args) {
static Address GetJsEntrySp() {
- CHECK_NE(NULL, Top::GetCurrentThread());
- return Top::js_entry_sp(Top::GetCurrentThread());
+ CHECK_NE(NULL, i::Isolate::Current()->thread_local_top());
+ return Isolate::js_entry_sp(i::Isolate::Current()->thread_local_top());
}
@@ -276,7 +277,7 @@ static void CreateTraceCallerFunction(const char* func_name,
// This test verifies that stack tracing works when called during
// execution of a native function called from JS code. In this case,
-// StackTracer uses Top::c_entry_fp as a starting point for stack
+// StackTracer uses Isolate::c_entry_fp as a starting point for stack
// walking.
TEST(CFromJSStackTrace) {
TickSample sample;
@@ -302,13 +303,11 @@ TEST(CFromJSStackTrace) {
// DoTrace(EBP) [native]
// StackTracer::Trace
- // 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++;
+ CHECK(sample.has_external_callback);
+ CHECK_EQ(FUNCTION_ADDR(TraceExtension::Trace), sample.external_callback);
// Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
+ int base = 0;
CHECK_GT(sample.frames_count, base + 1);
CHECK(IsAddressWithinFuncCode("JSFuncDoTrace", sample.stack[base + 0]));
CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 1]));
@@ -318,7 +317,7 @@ TEST(CFromJSStackTrace) {
// This test verifies that stack tracing works when called during
// execution of JS code. However, as calling StackTracer requires
// entering native code, we can only emulate pure JS by erasing
-// Top::c_entry_fp value. In this case, StackTracer uses passed frame
+// 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
@@ -353,13 +352,11 @@ TEST(PureJSStackTrace) {
// StackTracer::Trace
//
- // 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++;
+ CHECK(sample.has_external_callback);
+ CHECK_EQ(FUNCTION_ADDR(TraceExtension::JSTrace), sample.external_callback);
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
+ int base = 0;
CHECK_GT(sample.frames_count, base + 1);
CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 0]));
CHECK(IsAddressWithinFuncCode("OuterJSTrace", sample.stack[base + 1]));
@@ -397,6 +394,7 @@ static int CFunc(int depth) {
TEST(PureCStackTrace) {
TickSample sample;
InitTraceEnv(&sample);
+ InitializeVM();
// Check that sampler doesn't crash
CHECK_EQ(10, CFunc(10));
}