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

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

Issue 6614010: [Isolates] Merge 6700:7030 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' 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
===================================================================
--- test/cctest/test-log-stack-tracer.cc (revision 7006)
+++ test/cctest/test-log-stack-tracer.cc (working copy)
@@ -33,6 +33,7 @@
#include "v8.h"
+#include "api.h"
#include "codegen.h"
#include "log.h"
#include "isolate.h"
@@ -201,19 +202,19 @@
}
-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());
- i::SmartPointer<char> found_name =
- i::String::cast(
- JSFunction::cast(
- obj)->shared()->name())->ToCString();
- CHECK_EQ(func_name, *found_name);
+static bool IsAddressWithinFuncCode(JSFunction* function, Address addr) {
+ i::Code* code = function->code();
+ return code->contains(addr);
}
+static bool IsAddressWithinFuncCode(const char* func_name, Address addr) {
+ v8::Local<v8::Value> func = env->Global()->Get(v8_str(func_name));
+ CHECK(func->IsFunction());
+ JSFunction* js_func = JSFunction::cast(*v8::Utils::OpenHandle(*func));
+ return IsAddressWithinFuncCode(js_func, addr);
+}
+
// This C++ function is called as a constructor, to grab the frame pointer
// from the calling function. When this function runs, the stack contains
// a C_Entry frame and a Construct frame above the calling function's frame.
@@ -310,8 +311,8 @@
// Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
CHECK_GT(sample.frames_count, base + 1);
- CheckJSFunctionAtAddress("JSFuncDoTrace", sample.stack[base + 0]);
- CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 1]);
+ CHECK(IsAddressWithinFuncCode("JSFuncDoTrace", sample.stack[base + 0]));
+ CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 1]));
}
@@ -352,9 +353,6 @@
// DoTraceHideCEntryFPAddress(EBP) [native]
// StackTracer::Trace
//
- // 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);
// The VM state tracking keeps track of external callbacks and puts
// them at the top of the sample stack.
@@ -364,8 +362,8 @@
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
CHECK_GT(sample.frames_count, base + 1);
- CheckJSFunctionAtAddress("JSTrace", sample.stack[base + 0]);
- CheckJSFunctionAtAddress("OuterJSTrace", sample.stack[base + 1]);
+ CHECK(IsAddressWithinFuncCode("JSTrace", sample.stack[base + 0]));
+ CHECK(IsAddressWithinFuncCode("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