Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Unified Diff: test/cctest/test-log-stack-tracer.cc

Issue 6529055: [Isolates] Merge crankshaft (r5922 from bleeding_edge). (Closed)
Patch Set: Win32 port Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/test-log.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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]);
}
« no previous file with comments | « test/cctest/test-log.cc ('k') | test/cctest/test-mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698