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

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

Issue 2083005: CPU profiler: add secure profiles by filtering out functions using security tokens. (Closed)
Patch Set: Reworded comment Created 10 years, 7 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-cpu-profiler.cc ('k') | test/cctest/test-profile-generator.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 4d9d75927d1a18e8f6d69bd8cac71d6b9126119b..3ce19d7154721ad33ba8a77f62c1e945155fb2f4 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -66,28 +66,6 @@ static void DoTraceHideCEntryFPAddress(Address fp) {
}
-static void CheckRetAddrIsInFunction(const char* func_name,
- Address ret_addr,
- Address func_start_addr,
- unsigned int func_len) {
- printf("CheckRetAddrIsInFunction \"%s\": %p %p %p\n",
- func_name, func_start_addr, ret_addr, func_start_addr + func_len);
- CHECK_GE(ret_addr, func_start_addr);
- CHECK_GE(func_start_addr + func_len, ret_addr);
-}
-
-
-static void CheckRetAddrIsInJSFunction(const char* func_name,
- Address ret_addr,
- Handle<JSFunction> func) {
- v8::internal::Code* func_code = func->code();
- CheckRetAddrIsInFunction(
- func_name, ret_addr,
- func_code->instruction_start(),
- func_code->ExecutableSize());
-}
-
-
// --- T r a c e E x t e n s i o n ---
class TraceExtension : public v8::Extension {
@@ -209,11 +187,16 @@ static Handle<JSFunction> GetGlobalJSFunction(const char* name) {
}
-static void CheckRetAddrIsInJSFunction(const char* func_name,
- Address ret_addr) {
- CheckRetAddrIsInJSFunction(func_name,
- ret_addr,
- GetGlobalJSFunction(func_name));
+static void CheckObjectIsJSFunction(const char* func_name,
+ Address addr) {
+ i::Object* obj = reinterpret_cast<i::Object*>(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);
}
@@ -272,6 +255,7 @@ static void CreateTraceCallerFunction(const char* func_name,
Handle<JSFunction> func = CompileFunction(trace_call_buf.start());
CHECK(!func.is_null());
i::FLAG_allow_natives_syntax = allow_natives_syntax;
+ func->shared()->set_name(*NewString(func_name));
#ifdef DEBUG
v8::internal::Code* func_code = func->code();
@@ -313,10 +297,8 @@ TEST(CFromJSStackTrace) {
// StackTracer::Trace
CHECK_GT(sample.frames_count, 1);
// Stack tracing will start from the first JS function, i.e. "JSFuncDoTrace"
- CheckRetAddrIsInJSFunction("JSFuncDoTrace",
- sample.stack[0]);
- CheckRetAddrIsInJSFunction("JSTrace",
- sample.stack[1]);
+ CheckObjectIsJSFunction("JSFuncDoTrace", sample.stack[0]);
+ CheckObjectIsJSFunction("JSTrace", sample.stack[1]);
}
@@ -359,10 +341,8 @@ TEST(PureJSStackTrace) {
sample.function);
CHECK_GT(sample.frames_count, 1);
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
- CheckRetAddrIsInJSFunction("JSTrace",
- sample.stack[0]);
- CheckRetAddrIsInJSFunction("OuterJSTrace",
- sample.stack[1]);
+ CheckObjectIsJSFunction("JSTrace", sample.stack[0]);
+ CheckObjectIsJSFunction("OuterJSTrace", sample.stack[1]);
}
« no previous file with comments | « test/cctest/test-cpu-profiler.cc ('k') | test/cctest/test-profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698