summaryrefslogtreecommitdiff
path: root/deps/v8/test/cctest/test-log-stack-tracer.cc
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/cctest/test-log-stack-tracer.cc')
-rw-r--r--deps/v8/test/cctest/test-log-stack-tracer.cc44
1 files changed, 22 insertions, 22 deletions
diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc
index bf72184fb..b967c7388 100644
--- a/deps/v8/test/cctest/test-log-stack-tracer.cc
+++ b/deps/v8/test/cctest/test-log-stack-tracer.cc
@@ -1,4 +1,4 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
+// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
@@ -36,10 +36,9 @@
#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"
#include "vm-state-inl.h"
using v8::Function;
@@ -52,10 +51,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 +77,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 +163,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,9 +276,12 @@ 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) {
+ // BUG(1303) Inlining of JSFuncDoTrace() in JSTrace below breaks this test.
+ i::FLAG_use_inlining = false;
+
TickSample sample;
InitTraceEnv(&sample);
@@ -302,13 +305,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 +319,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 +354,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 +396,7 @@ static int CFunc(int depth) {
TEST(PureCStackTrace) {
TickSample sample;
InitTraceEnv(&sample);
+ InitializeVM();
// Check that sampler doesn't crash
CHECK_EQ(10, CFunc(10));
}