Revision: 5688
Author: [email protected]
Date: Thu Oct 21 07:19:07 2010
Log: Clean up the log-stack-tracer test.
Create the functions using the normal API and remove some
unnecessary helpers.
Review URL: http://codereview.chromium.org/4024003
http://code.google.com/p/v8/source/detail?r=5688
Modified:
/branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Thu Sep 30
00:22:53 2010
+++ /branches/bleeding_edge/test/cctest/test-log-stack-tracer.cc Thu Oct 21
07:19:07 2010
@@ -197,13 +197,6 @@
v8::HandleScope scope;
env->Enter();
}
-
-
-static Handle<JSFunction> CompileFunction(const char* source) {
- Handle<JSFunction> result(JSFunction::cast(
- *v8::Utils::OpenHandle(*Script::Compile(String::New(source)))));
- return result;
-}
static void CheckJSFunctionAtAddress(const char* func_name, Address addr) {
@@ -216,16 +209,6 @@
obj)->shared()->name())->ToCString();
CHECK_EQ(func_name, *found_name);
}
-
-
-static void SetGlobalProperty(const char* name, Local<Value> value) {
- env->Global()->Set(String::New(name), value);
-}
-
-
-static Handle<v8::internal::String> NewString(const char* s) {
- return i::Factory::NewStringFromAscii(i::CStrVector(s));
-}
// This C++ function is called as a constructor, to grab the frame pointer
@@ -273,25 +256,18 @@
const char* trace_func_name) {
i::EmbeddedVector<char, 256> trace_call_buf;
i::OS::SNPrintF(trace_call_buf,
- "fp = new FPGrabber(); %s(fp.low_bits, fp.high_bits);",
- trace_func_name);
+ "function %s() {"
+ " fp = new FPGrabber();"
+ " %s(fp.low_bits, fp.high_bits);"
+ "}",
+ func_name, trace_func_name);
// Create the FPGrabber function, which grabs the caller's frame pointer
// when called as a constructor.
CreateFramePointerGrabberConstructor("FPGrabber");
// Compile the script.
- Handle<JSFunction> func = CompileFunction(trace_call_buf.start());
- CHECK(!func.is_null());
- func->shared()->set_name(*NewString(func_name));
-
-#ifdef DEBUG
- v8::internal::Code* func_code = func->code();
- CHECK(func_code->IsCode());
- func_code->Print();
-#endif
-
- SetGlobalProperty(func_name, v8::ToApi<Value>(func));
+ CompileRun(trace_call_buf.start());
}
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev