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

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

Issue 1169002: Fix issue 658: update test-log-stack-tracer after r4211. (Closed)
Patch Set: Created 10 years, 9 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 | « no previous file | no next file » | 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 d744acb3c10b797e89476991c96ef0129e1c5b29..f5c21932813e000768e24fff85a2a4441f6d01df 100644
--- a/test/cctest/test-log-stack-tracer.cc
+++ b/test/cctest/test-log-stack-tracer.cc
@@ -26,7 +26,6 @@ using v8::internal::byte;
using v8::internal::Address;
using v8::internal::Handle;
using v8::internal::JSFunction;
-using v8::internal::SharedFunctionInfo;
using v8::internal::StackTracer;
using v8::internal::TickSample;
using v8::internal::Top;
@@ -78,10 +77,9 @@ static void CheckRetAddrIsInFunction(const char* func_name,
}
-static void CheckRetAddrIsInSharedFunctionInfo(
- const char* func_name,
- Address ret_addr,
- Handle<SharedFunctionInfo> func) {
+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,
@@ -192,16 +190,10 @@ static void InitializeVM() {
}
-static Handle<SharedFunctionInfo> CompileFunction(const char* source) {
- Handle<v8::internal::Object> obj =
- v8::Utils::OpenHandle(*Script::Compile(String::New(source)));
- Handle<SharedFunctionInfo> shared;
- if (obj->IsSharedFunctionInfo()) {
- shared = Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(*obj));
- } else {
- shared = Handle<SharedFunctionInfo>(JSFunction::cast(*obj)->shared());
- }
- return shared;
+static Handle<JSFunction> CompileFunction(const char* source) {
+ Handle<JSFunction> result(JSFunction::cast(
+ *v8::Utils::OpenHandle(*Script::Compile(String::New(source)))));
+ return result;
}
@@ -210,17 +202,16 @@ static Local<Value> GetGlobalProperty(const char* name) {
}
-static Handle<SharedFunctionInfo> GetGlobalJSFunction(const char* name) {
- Handle<SharedFunctionInfo> js_func(
- SharedFunctionInfo::cast(
- *(v8::Utils::OpenHandle(*GetGlobalProperty(name)))));
- return js_func;
+static Handle<JSFunction> GetGlobalJSFunction(const char* name) {
+ Handle<JSFunction> result(JSFunction::cast(
+ *v8::Utils::OpenHandle(*GetGlobalProperty(name))));
+ return result;
}
-static void CheckRetAddrIsInSharedFunctionInfo(const char* func_name,
+static void CheckRetAddrIsInJSFunction(const char* func_name,
Address ret_addr) {
- CheckRetAddrIsInSharedFunctionInfo(func_name,
+ CheckRetAddrIsInJSFunction(func_name,
ret_addr,
Kasper Lund 2010/03/23 11:53:28 Indentation.
mnaganov (inactive) 2010/03/23 12:39:18 Done.
GetGlobalJSFunction(func_name));
}
@@ -278,7 +269,7 @@ static void CreateTraceCallerFunction(const char* func_name,
i::CodeGeneratorPatcher patcher;
bool allow_natives_syntax = i::FLAG_allow_natives_syntax;
i::FLAG_allow_natives_syntax = true;
- Handle<SharedFunctionInfo> func = CompileFunction(trace_call_buf.start());
+ Handle<JSFunction> func = CompileFunction(trace_call_buf.start());
CHECK(!func.is_null());
i::FLAG_allow_natives_syntax = allow_natives_syntax;
@@ -289,59 +280,56 @@ static void CreateTraceCallerFunction(const char* func_name,
#endif
SetGlobalProperty(func_name, v8::ToApi<Value>(func));
+ CHECK_EQ(*func, *GetGlobalJSFunction(func_name));
}
TEST(CFromJSStackTrace) {
- // TODO(657): Fixup test after FunctionBoilerplate removal.
- return;
-
TickSample sample;
InitTraceEnv(&sample);
InitializeVM();
v8::HandleScope scope;
CreateTraceCallerFunction("JSFuncDoTrace", "trace");
- CompileRun(
+ CHECK(!CompileRun(
Kasper Lund 2010/03/23 11:53:28 I would create a local handle for the result and d
mnaganov (inactive) 2010/03/23 12:39:18 Good point. Done.
"function JSTrace() {"
" JSFuncDoTrace();"
"};\n"
- "JSTrace();");
+ "JSTrace();\n"
+ "true;").IsEmpty());
CHECK_GT(sample.frames_count, 1);
// Stack sampling will start from the first JS function, i.e. "JSFuncDoTrace"
- CheckRetAddrIsInSharedFunctionInfo("JSFuncDoTrace",
+ CheckRetAddrIsInJSFunction("JSFuncDoTrace",
sample.stack[0]);
Kasper Lund 2010/03/23 11:53:28 Indentation.
mnaganov (inactive) 2010/03/23 12:39:18 Done.
- CheckRetAddrIsInSharedFunctionInfo("JSTrace",
+ CheckRetAddrIsInJSFunction("JSTrace",
sample.stack[1]);
Kasper Lund 2010/03/23 11:53:28 Indentation.
mnaganov (inactive) 2010/03/23 12:39:18 Done.
}
TEST(PureJSStackTrace) {
- // TODO(657): Fixup test after FunctionBoilerplate removal.
- return;
-
TickSample sample;
InitTraceEnv(&sample);
InitializeVM();
v8::HandleScope scope;
CreateTraceCallerFunction("JSFuncDoTrace", "js_trace");
- CompileRun(
+ CHECK(!CompileRun(
Kasper Lund 2010/03/23 11:53:28 I would create a local handle for the result and d
mnaganov (inactive) 2010/03/23 12:39:18 Done.
"function JSTrace() {"
" JSFuncDoTrace();"
"};\n"
"function OuterJSTrace() {"
" JSTrace();"
"};\n"
- "OuterJSTrace();");
+ "OuterJSTrace();\n"
+ "true;").IsEmpty());
// The last JS function called.
CHECK_EQ(GetGlobalJSFunction("JSFuncDoTrace")->address(),
sample.function);
CHECK_GT(sample.frames_count, 1);
// Stack sampling will start from the caller of JSFuncDoTrace, i.e. "JSTrace"
- CheckRetAddrIsInSharedFunctionInfo("JSTrace",
+ CheckRetAddrIsInJSFunction("JSTrace",
sample.stack[0]);
Kasper Lund 2010/03/23 11:53:28 Indentation.
mnaganov (inactive) 2010/03/23 12:39:18 Done.
- CheckRetAddrIsInSharedFunctionInfo("OuterJSTrace",
+ CheckRetAddrIsInJSFunction("OuterJSTrace",
sample.stack[1]);
Kasper Lund 2010/03/23 11:53:28 Indentation.
mnaganov (inactive) 2010/03/23 12:39:18 Done.
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698