Revision: 4222
Author: mikhail.naga...@gmail.com
Date: Tue Mar 23 05:42:47 2010
Log: Fix issue 658: update test-log-stack-tracer after r4211.
It appears that semi-automatic changes made to test's code were
incorrect. v8::Script::Compile returns wrapped JSFunction,
not SharedFunctionInfo.
Review URL: http://codereview.chromium.org/1169002
http://code.google.com/p/v8/source/detail?r=4222
Modified:
/branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Mon Mar 22
23:04:44 2010
+++ /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Tue Mar 23
05:42:47 2010
@@ -26,7 +26,6 @@
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 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 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,19 +202,18 @@
}
-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,
- ret_addr,
- GetGlobalJSFunction(func_name));
+ CheckRetAddrIsInJSFunction(func_name,
+ ret_addr,
+ GetGlobalJSFunction(func_name));
}
@@ -278,7 +269,7 @@
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,60 +280,59 @@
#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(
+ Local<Value> result = CompileRun(
"function JSTrace() {"
" JSFuncDoTrace();"
"};\n"
- "JSTrace();");
+ "JSTrace();\n"
+ "true;");
+ CHECK(!result.IsEmpty());
CHECK_GT(sample.frames_count, 1);
// Stack sampling will start from the first JS function,
i.e. "JSFuncDoTrace"
- CheckRetAddrIsInSharedFunctionInfo("JSFuncDoTrace",
- sample.stack[0]);
- CheckRetAddrIsInSharedFunctionInfo("JSTrace",
- sample.stack[1]);
+ CheckRetAddrIsInJSFunction("JSFuncDoTrace",
+ sample.stack[0]);
+ CheckRetAddrIsInJSFunction("JSTrace",
+ sample.stack[1]);
}
TEST(PureJSStackTrace) {
- // TODO(657): Fixup test after FunctionBoilerplate removal.
- return;
-
TickSample sample;
InitTraceEnv(&sample);
InitializeVM();
v8::HandleScope scope;
CreateTraceCallerFunction("JSFuncDoTrace", "js_trace");
- CompileRun(
+ Local<Value> result = CompileRun(
"function JSTrace() {"
" JSFuncDoTrace();"
"};\n"
"function OuterJSTrace() {"
" JSTrace();"
"};\n"
- "OuterJSTrace();");
+ "OuterJSTrace();\n"
+ "true;");
+ CHECK(!result.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",
- sample.stack[0]);
- CheckRetAddrIsInSharedFunctionInfo("OuterJSTrace",
- sample.stack[1]);
+ CheckRetAddrIsInJSFunction("JSTrace",
+ sample.stack[0]);
+ CheckRetAddrIsInJSFunction("OuterJSTrace",
+ sample.stack[1]);
}
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
To unsubscribe from this group, send email to v8-dev+unsubscribegooglegroups.com or reply
to this email with the words "REMOVE ME" as the subject.