diff options
author | Steve Block <steveblock@google.com> | 2011-05-26 01:26:41 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2011-06-02 15:09:56 +0100 |
commit | 44f0eee88ff00398ff7f715fab053374d808c90d (patch) | |
tree | addd100e906cd43f843f3aaf64b445f17f46fe0f /test/cctest/test-log-stack-tracer.cc | |
parent | 1b63b9ad386abd62f61af0e29246a687f5311b53 (diff) | |
download | android_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.tar.gz android_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.tar.bz2 android_external_v8-44f0eee88ff00398ff7f715fab053374d808c90d.zip |
Update V8 to r7427: Initial merge by git
As required by WebKit r82507
Change-Id: I7ae83ef3f689356043b4929255b7c1dd31d8c5df
Diffstat (limited to 'test/cctest/test-log-stack-tracer.cc')
-rw-r--r-- | test/cctest/test-log-stack-tracer.cc | 38 |
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)); } |