Commit a74f511e authored by dcarney@chromium.org's avatar dcarney@chromium.org

remove all old style callbacks - patch 3

TBR=svenpanne@chromium.org
BUG=

Review URL: https://codereview.chromium.org/17336003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15237 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 149d31eb
...@@ -47,7 +47,7 @@ class PrintExtension : public v8::Extension { ...@@ -47,7 +47,7 @@ class PrintExtension : public v8::Extension {
PrintExtension() : v8::Extension("v8/print", kSource) { } PrintExtension() : v8::Extension("v8/print", kSource) { }
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<v8::String> name); v8::Handle<v8::String> name);
static v8::Handle<v8::Value> Print(const v8::Arguments& args); static void Print(const v8::FunctionCallbackInfo<v8::Value>& args);
private: private:
static const char* kSource; static const char* kSource;
}; };
...@@ -62,16 +62,15 @@ v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction( ...@@ -62,16 +62,15 @@ v8::Handle<v8::FunctionTemplate> PrintExtension::GetNativeFunction(
} }
v8::Handle<v8::Value> PrintExtension::Print(const v8::Arguments& args) { void PrintExtension::Print(const v8::FunctionCallbackInfo<v8::Value>& args) {
for (int i = 0; i < args.Length(); i++) { for (int i = 0; i < args.Length(); i++) {
if (i != 0) printf(" "); if (i != 0) printf(" ");
v8::HandleScope scope(args.GetIsolate()); v8::HandleScope scope(args.GetIsolate());
v8::String::Utf8Value str(args[i]); v8::String::Utf8Value str(args[i]);
if (*str == NULL) return v8::Undefined(); if (*str == NULL) return;
printf("%s", *str); printf("%s", *str);
} }
printf("\n"); printf("\n");
return v8::Undefined();
} }
......
...@@ -4264,43 +4264,46 @@ TEST(NoBreakWhenBootstrapping) { ...@@ -4264,43 +4264,46 @@ TEST(NoBreakWhenBootstrapping) {
CheckDebuggerUnloaded(); CheckDebuggerUnloaded();
} }
static v8::Handle<v8::Array> NamedEnum(const v8::AccessorInfo&) { static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Handle<v8::Array> result = v8::Array::New(3); v8::Handle<v8::Array> result = v8::Array::New(3);
result->Set(v8::Integer::New(0), v8::String::New("a")); result->Set(v8::Integer::New(0), v8::String::New("a"));
result->Set(v8::Integer::New(1), v8::String::New("b")); result->Set(v8::Integer::New(1), v8::String::New("b"));
result->Set(v8::Integer::New(2), v8::String::New("c")); result->Set(v8::Integer::New(2), v8::String::New("c"));
return result; info.GetReturnValue().Set(result);
} }
static v8::Handle<v8::Array> IndexedEnum(const v8::AccessorInfo&) { static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
v8::Handle<v8::Array> result = v8::Array::New(2); v8::Handle<v8::Array> result = v8::Array::New(2);
result->Set(v8::Integer::New(0), v8::Number::New(1)); result->Set(v8::Integer::New(0), v8::Number::New(1));
result->Set(v8::Integer::New(1), v8::Number::New(10)); result->Set(v8::Integer::New(1), v8::Number::New(10));
return result; info.GetReturnValue().Set(result);
} }
static v8::Handle<v8::Value> NamedGetter(v8::Local<v8::String> name, static void NamedGetter(v8::Local<v8::String> name,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::String::Utf8Value n(name); v8::String::Utf8Value n(name);
if (strcmp(*n, "a") == 0) { if (strcmp(*n, "a") == 0) {
return v8::String::New("AA"); info.GetReturnValue().Set(v8::String::New("AA"));
return;
} else if (strcmp(*n, "b") == 0) { } else if (strcmp(*n, "b") == 0) {
return v8::String::New("BB"); info.GetReturnValue().Set(v8::String::New("BB"));
return;
} else if (strcmp(*n, "c") == 0) { } else if (strcmp(*n, "c") == 0) {
return v8::String::New("CC"); info.GetReturnValue().Set(v8::String::New("CC"));
return;
} else { } else {
return v8::Undefined(); info.GetReturnValue().SetUndefined();
return;
} }
info.GetReturnValue().Set(name);
return name;
} }
static v8::Handle<v8::Value> IndexedGetter(uint32_t index, static void IndexedGetter(uint32_t index,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
return v8::Number::New(index + 1); info.GetReturnValue().Set(static_cast<double>(index + 1));
} }
...@@ -4530,9 +4533,10 @@ TEST(HiddenPrototypePropertyMirror) { ...@@ -4530,9 +4533,10 @@ TEST(HiddenPrototypePropertyMirror) {
} }
static v8::Handle<v8::Value> ProtperyXNativeGetter( static void ProtperyXNativeGetter(
v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::String> property,
return v8::Integer::New(10); const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(10);
} }
...@@ -4567,9 +4571,10 @@ TEST(NativeGetterPropertyMirror) { ...@@ -4567,9 +4571,10 @@ TEST(NativeGetterPropertyMirror) {
} }
static v8::Handle<v8::Value> ProtperyXNativeGetterThrowingError( static void ProtperyXNativeGetterThrowingError(
v8::Local<v8::String> property, const v8::AccessorInfo& info) { v8::Local<v8::String> property,
return CompileRun("throw new Error('Error message');"); const v8::PropertyCallbackInfo<v8::Value>& info) {
CompileRun("throw new Error('Error message');");
} }
...@@ -5112,9 +5117,9 @@ class DebuggerThread : public v8::internal::Thread { ...@@ -5112,9 +5117,9 @@ class DebuggerThread : public v8::internal::Thread {
}; };
static v8::Handle<v8::Value> ThreadedAtBarrier1(const v8::Arguments& args) { static void ThreadedAtBarrier1(
const v8::FunctionCallbackInfo<v8::Value>& args) {
threaded_debugging_barriers.barrier_1.Wait(); threaded_debugging_barriers.barrier_1.Wait();
return v8::Undefined();
} }
...@@ -5480,28 +5485,27 @@ v8::Handle<v8::Function> debugger_call_with_closure; ...@@ -5480,28 +5485,27 @@ v8::Handle<v8::Function> debugger_call_with_closure;
// Function to retrieve the number of JavaScript frames by calling a JavaScript // Function to retrieve the number of JavaScript frames by calling a JavaScript
// in the debugger. // in the debugger.
static v8::Handle<v8::Value> CheckFrameCount(const v8::Arguments& args) { static void CheckFrameCount(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(v8::Debug::Call(frame_count)->IsNumber()); CHECK(v8::Debug::Call(frame_count)->IsNumber());
CHECK_EQ(args[0]->Int32Value(), CHECK_EQ(args[0]->Int32Value(),
v8::Debug::Call(frame_count)->Int32Value()); v8::Debug::Call(frame_count)->Int32Value());
return v8::Undefined();
} }
// Function to retrieve the source line of the top JavaScript frame by calling a // Function to retrieve the source line of the top JavaScript frame by calling a
// JavaScript function in the debugger. // JavaScript function in the debugger.
static v8::Handle<v8::Value> CheckSourceLine(const v8::Arguments& args) { static void CheckSourceLine(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(v8::Debug::Call(frame_source_line)->IsNumber()); CHECK(v8::Debug::Call(frame_source_line)->IsNumber());
CHECK_EQ(args[0]->Int32Value(), CHECK_EQ(args[0]->Int32Value(),
v8::Debug::Call(frame_source_line)->Int32Value()); v8::Debug::Call(frame_source_line)->Int32Value());
return v8::Undefined();
} }
// Function to test passing an additional parameter to a JavaScript function // Function to test passing an additional parameter to a JavaScript function
// called in the debugger. It also tests that functions called in the debugger // called in the debugger. It also tests that functions called in the debugger
// can throw exceptions. // can throw exceptions.
static v8::Handle<v8::Value> CheckDataParameter(const v8::Arguments& args) { static void CheckDataParameter(
const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Handle<v8::String> data = v8::String::New("Test"); v8::Handle<v8::String> data = v8::String::New("Test");
CHECK(v8::Debug::Call(debugger_call_with_data, data)->IsString()); CHECK(v8::Debug::Call(debugger_call_with_data, data)->IsString());
...@@ -5512,16 +5516,13 @@ static v8::Handle<v8::Value> CheckDataParameter(const v8::Arguments& args) { ...@@ -5512,16 +5516,13 @@ static v8::Handle<v8::Value> CheckDataParameter(const v8::Arguments& args) {
v8::Debug::Call(debugger_call_with_data); v8::Debug::Call(debugger_call_with_data);
CHECK(catcher.HasCaught()); CHECK(catcher.HasCaught());
CHECK(catcher.Exception()->IsString()); CHECK(catcher.Exception()->IsString());
return v8::Undefined();
} }
// Function to test using a JavaScript with closure in the debugger. // Function to test using a JavaScript with closure in the debugger.
static v8::Handle<v8::Value> CheckClosure(const v8::Arguments& args) { static void CheckClosure(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(v8::Debug::Call(debugger_call_with_closure)->IsNumber()); CHECK(v8::Debug::Call(debugger_call_with_closure)->IsNumber());
CHECK_EQ(3, v8::Debug::Call(debugger_call_with_closure)->Int32Value()); CHECK_EQ(3, v8::Debug::Call(debugger_call_with_closure)->Int32Value());
return v8::Undefined();
} }
...@@ -7017,9 +7018,9 @@ v8::Handle<v8::Context> debugger_context; ...@@ -7017,9 +7018,9 @@ v8::Handle<v8::Context> debugger_context;
// Property getter that checks that current and calling contexts // Property getter that checks that current and calling contexts
// are both the debugee contexts. // are both the debugee contexts.
static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( static void NamedGetterWithCallingContextCheck(
v8::Local<v8::String> name, v8::Local<v8::String> name,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a")); CHECK_EQ(0, strcmp(*v8::String::Utf8Value(name), "a"));
v8::Handle<v8::Context> current = v8::Context::GetCurrent(); v8::Handle<v8::Context> current = v8::Context::GetCurrent();
CHECK(current == debugee_context); CHECK(current == debugee_context);
...@@ -7027,7 +7028,7 @@ static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck( ...@@ -7027,7 +7028,7 @@ static v8::Handle<v8::Value> NamedGetterWithCallingContextCheck(
v8::Handle<v8::Context> calling = v8::Context::GetCalling(); v8::Handle<v8::Context> calling = v8::Context::GetCalling();
CHECK(calling == debugee_context); CHECK(calling == debugee_context);
CHECK(calling != debugger_context); CHECK(calling != debugger_context);
return v8::Int32::New(1); info.GetReturnValue().Set(1);
} }
...@@ -7302,11 +7303,10 @@ static void DebugEventBreakWithOptimizedStack(v8::DebugEvent event, ...@@ -7302,11 +7303,10 @@ static void DebugEventBreakWithOptimizedStack(v8::DebugEvent event,
} }
static v8::Handle<v8::Value> ScheduleBreak(const v8::Arguments& args) { static void ScheduleBreak(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Debug::SetDebugEventListener(DebugEventBreakWithOptimizedStack, v8::Debug::SetDebugEventListener(DebugEventBreakWithOptimizedStack,
v8::Undefined()); v8::Undefined());
v8::Debug::DebugBreak(); v8::Debug::DebugBreak();
return v8::Undefined();
} }
......
...@@ -88,13 +88,13 @@ class DeclarationContext { ...@@ -88,13 +88,13 @@ class DeclarationContext {
// The handlers are called as static functions that forward // The handlers are called as static functions that forward
// to the instance specific virtual methods. // to the instance specific virtual methods.
static v8::Handle<Value> HandleGet(Local<String> key, static void HandleGet(Local<String> key,
const AccessorInfo& info); const v8::PropertyCallbackInfo<v8::Value>& info);
static v8::Handle<Value> HandleSet(Local<String> key, static void HandleSet(Local<String> key,
Local<Value> value, Local<Value> value,
const AccessorInfo& info); const v8::PropertyCallbackInfo<v8::Value>& info);
static v8::Handle<Integer> HandleQuery(Local<String> key, static void HandleQuery(Local<String> key,
const AccessorInfo& info); const v8::PropertyCallbackInfo<v8::Integer>& info);
private: private:
bool is_initialized_; bool is_initialized_;
...@@ -104,7 +104,7 @@ class DeclarationContext { ...@@ -104,7 +104,7 @@ class DeclarationContext {
int set_count_; int set_count_;
int query_count_; int query_count_;
static DeclarationContext* GetInstance(const AccessorInfo& info); static DeclarationContext* GetInstance(Local<Value> data);
}; };
...@@ -173,33 +173,36 @@ void DeclarationContext::Check(const char* source, ...@@ -173,33 +173,36 @@ void DeclarationContext::Check(const char* source,
} }
v8::Handle<Value> DeclarationContext::HandleGet(Local<String> key, void DeclarationContext::HandleGet(
const AccessorInfo& info) { Local<String> key,
DeclarationContext* context = GetInstance(info); const v8::PropertyCallbackInfo<v8::Value>& info) {
DeclarationContext* context = GetInstance(info.Data());
context->get_count_++; context->get_count_++;
return context->Get(key); info.GetReturnValue().Set(context->Get(key));
} }
v8::Handle<Value> DeclarationContext::HandleSet(Local<String> key, void DeclarationContext::HandleSet(
Local<Value> value, Local<String> key,
const AccessorInfo& info) { Local<Value> value,
DeclarationContext* context = GetInstance(info); const v8::PropertyCallbackInfo<v8::Value>& info) {
DeclarationContext* context = GetInstance(info.Data());
context->set_count_++; context->set_count_++;
return context->Set(key, value); info.GetReturnValue().Set(context->Set(key, value));
} }
v8::Handle<Integer> DeclarationContext::HandleQuery(Local<String> key, void DeclarationContext::HandleQuery(
const AccessorInfo& info) { Local<String> key,
DeclarationContext* context = GetInstance(info); const v8::PropertyCallbackInfo<v8::Integer>& info) {
DeclarationContext* context = GetInstance(info.Data());
context->query_count_++; context->query_count_++;
return context->Query(key); info.GetReturnValue().Set(context->Query(key));
} }
DeclarationContext* DeclarationContext::GetInstance(const AccessorInfo& info) { DeclarationContext* DeclarationContext::GetInstance(Local<Value> data) {
void* value = External::Cast(*info.Data())->Value(); void* value = Local<External>::Cast(data)->Value();
return static_cast<DeclarationContext*>(value); return static_cast<DeclarationContext*>(value);
} }
......
...@@ -92,12 +92,12 @@ class TraceExtension : public v8::Extension { ...@@ -92,12 +92,12 @@ class TraceExtension : public v8::Extension {
TraceExtension() : v8::Extension("v8/trace", kSource) { } TraceExtension() : v8::Extension("v8/trace", kSource) { }
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<String> name); v8::Handle<String> name);
static v8::Handle<v8::Value> Trace(const v8::Arguments& args); static void Trace(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::Handle<v8::Value> JSTrace(const v8::Arguments& args); static void JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::Handle<v8::Value> JSEntrySP(const v8::Arguments& args); static void JSEntrySP(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::Handle<v8::Value> JSEntrySPLevel2(const v8::Arguments& args); static void JSEntrySPLevel2(const v8::FunctionCallbackInfo<v8::Value>& args);
private: private:
static Address GetFP(const v8::Arguments& args); static Address GetFP(const v8::FunctionCallbackInfo<v8::Value>& args);
static const char* kSource; static const char* kSource;
}; };
...@@ -125,7 +125,7 @@ v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunction( ...@@ -125,7 +125,7 @@ v8::Handle<v8::FunctionTemplate> TraceExtension::GetNativeFunction(
} }
Address TraceExtension::GetFP(const v8::Arguments& args) { Address TraceExtension::GetFP(const v8::FunctionCallbackInfo<v8::Value>& args) {
// Convert frame pointer from encoding as smis in the arguments to a pointer. // Convert frame pointer from encoding as smis in the arguments to a pointer.
CHECK_EQ(2, args.Length()); // Ignore second argument on 32-bit platform. CHECK_EQ(2, args.Length()); // Ignore second argument on 32-bit platform.
#if defined(V8_HOST_ARCH_32_BIT) #if defined(V8_HOST_ARCH_32_BIT)
...@@ -142,15 +142,13 @@ Address TraceExtension::GetFP(const v8::Arguments& args) { ...@@ -142,15 +142,13 @@ Address TraceExtension::GetFP(const v8::Arguments& args) {
} }
v8::Handle<v8::Value> TraceExtension::Trace(const v8::Arguments& args) { void TraceExtension::Trace(const v8::FunctionCallbackInfo<v8::Value>& args) {
DoTrace(GetFP(args)); DoTrace(GetFP(args));
return v8::Undefined();
} }
v8::Handle<v8::Value> TraceExtension::JSTrace(const v8::Arguments& args) { void TraceExtension::JSTrace(const v8::FunctionCallbackInfo<v8::Value>& args) {
DoTraceHideCEntryFPAddress(GetFP(args)); DoTraceHideCEntryFPAddress(GetFP(args));
return v8::Undefined();
} }
...@@ -160,20 +158,19 @@ static Address GetJsEntrySp() { ...@@ -160,20 +158,19 @@ static Address GetJsEntrySp() {
} }
v8::Handle<v8::Value> TraceExtension::JSEntrySP(const v8::Arguments& args) { void TraceExtension::JSEntrySP(
const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_NE(0, GetJsEntrySp()); CHECK_NE(0, GetJsEntrySp());
return v8::Undefined();
} }
v8::Handle<v8::Value> TraceExtension::JSEntrySPLevel2( void TraceExtension::JSEntrySPLevel2(
const v8::Arguments& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate()); v8::HandleScope scope(args.GetIsolate());
const Address js_entry_sp = GetJsEntrySp(); const Address js_entry_sp = GetJsEntrySp();
CHECK_NE(0, js_entry_sp); CHECK_NE(0, js_entry_sp);
CompileRun("js_entry_sp();"); CompileRun("js_entry_sp();");
CHECK_EQ(js_entry_sp, GetJsEntrySp()); CHECK_EQ(js_entry_sp, GetJsEntrySp());
return v8::Undefined();
} }
...@@ -197,7 +194,7 @@ static bool IsAddressWithinFuncCode(const char* func_name, Address addr) { ...@@ -197,7 +194,7 @@ static bool IsAddressWithinFuncCode(const char* func_name, Address addr) {
// This C++ function is called as a constructor, to grab the frame pointer // This C++ function is called as a constructor, to grab the frame pointer
// from the calling function. When this function runs, the stack contains // 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. // a C_Entry frame and a Construct frame above the calling function's frame.
static v8::Handle<Value> construct_call(const v8::Arguments& args) { static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate()); i::Isolate* isolate = reinterpret_cast<i::Isolate*>(args.GetIsolate());
i::StackFrameIterator frame_iterator(isolate); i::StackFrameIterator frame_iterator(isolate);
CHECK(frame_iterator.frame()->is_exit()); CHECK(frame_iterator.frame()->is_exit());
...@@ -219,7 +216,7 @@ static v8::Handle<Value> construct_call(const v8::Arguments& args) { ...@@ -219,7 +216,7 @@ static v8::Handle<Value> construct_call(const v8::Arguments& args) {
#else #else
#error Host architecture is neither 32-bit nor 64-bit. #error Host architecture is neither 32-bit nor 64-bit.
#endif #endif
return args.This(); args.GetReturnValue().Set(args.This());
} }
......
...@@ -392,8 +392,7 @@ TEST(Issue23768) { ...@@ -392,8 +392,7 @@ TEST(Issue23768) {
} }
static v8::Handle<v8::Value> ObjMethod1(const v8::Arguments& args) { static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
return v8::Handle<v8::Value>();
} }
TEST(LogCallbacks) { TEST(LogCallbacks) {
...@@ -431,19 +430,17 @@ TEST(LogCallbacks) { ...@@ -431,19 +430,17 @@ TEST(LogCallbacks) {
} }
static v8::Handle<v8::Value> Prop1Getter(v8::Local<v8::String> property, static void Prop1Getter(v8::Local<v8::String> property,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
return v8::Handle<v8::Value>();
} }
static void Prop1Setter(v8::Local<v8::String> property, static void Prop1Setter(v8::Local<v8::String> property,
v8::Local<v8::Value> value, v8::Local<v8::Value> value,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<void>& info) {
} }
static v8::Handle<v8::Value> Prop2Getter(v8::Local<v8::String> property, static void Prop2Getter(v8::Local<v8::String> property,
const v8::AccessorInfo& info) { const v8::PropertyCallbackInfo<v8::Value>& info) {
return v8::Handle<v8::Value>();
} }
TEST(LogAccessorCallbacks) { TEST(LogAccessorCallbacks) {
......
...@@ -804,8 +804,8 @@ class ProfilerExtension : public v8::Extension { ...@@ -804,8 +804,8 @@ class ProfilerExtension : public v8::Extension {
ProfilerExtension() : v8::Extension("v8/profiler", kSource) { } ProfilerExtension() : v8::Extension("v8/profiler", kSource) { }
virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction( virtual v8::Handle<v8::FunctionTemplate> GetNativeFunction(
v8::Handle<v8::String> name); v8::Handle<v8::String> name);
static v8::Handle<v8::Value> StartProfiling(const v8::Arguments& args); static void StartProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
static v8::Handle<v8::Value> StopProfiling(const v8::Arguments& args); static void StopProfiling(const v8::FunctionCallbackInfo<v8::Value>& args);
private: private:
static const char* kSource; static const char* kSource;
}; };
...@@ -828,25 +828,23 @@ v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunction( ...@@ -828,25 +828,23 @@ v8::Handle<v8::FunctionTemplate> ProfilerExtension::GetNativeFunction(
} }
v8::Handle<v8::Value> ProfilerExtension::StartProfiling( void ProfilerExtension::StartProfiling(
const v8::Arguments& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
if (args.Length() > 0) if (args.Length() > 0)
cpu_profiler->StartCpuProfiling(args[0].As<v8::String>()); cpu_profiler->StartCpuProfiling(args[0].As<v8::String>());
else else
cpu_profiler->StartCpuProfiling(v8::String::New("")); cpu_profiler->StartCpuProfiling(v8::String::New(""));
return v8::Undefined();
} }
v8::Handle<v8::Value> ProfilerExtension::StopProfiling( void ProfilerExtension::StopProfiling(
const v8::Arguments& args) { const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler(); v8::CpuProfiler* cpu_profiler = args.GetIsolate()->GetCpuProfiler();
if (args.Length() > 0) if (args.Length() > 0)
cpu_profiler->StopCpuProfiling(args[0].As<v8::String>()); cpu_profiler->StopCpuProfiling(args[0].As<v8::String>());
else else
cpu_profiler->StopCpuProfiling(v8::String::New("")); cpu_profiler->StopCpuProfiling(v8::String::New(""));
return v8::Undefined();
} }
......
...@@ -33,37 +33,33 @@ ...@@ -33,37 +33,33 @@
v8::internal::Semaphore* semaphore = NULL; v8::internal::Semaphore* semaphore = NULL;
v8::Handle<v8::Value> Signal(const v8::Arguments& args) { void Signal(const v8::FunctionCallbackInfo<v8::Value>& args) {
semaphore->Signal(); semaphore->Signal();
return v8::Undefined();
} }
v8::Handle<v8::Value> TerminateCurrentThread(const v8::Arguments& args) { void TerminateCurrentThread(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::V8::TerminateExecution(); v8::V8::TerminateExecution();
return v8::Undefined();
} }
v8::Handle<v8::Value> Fail(const v8::Arguments& args) { void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(false); CHECK(false);
return v8::Undefined();
} }
v8::Handle<v8::Value> Loop(const v8::Arguments& args) { void Loop(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Handle<v8::String> source = v8::Handle<v8::String> source =
v8::String::New("try { doloop(); fail(); } catch(e) { fail(); }"); v8::String::New("try { doloop(); fail(); } catch(e) { fail(); }");
v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run(); v8::Handle<v8::Value> result = v8::Script::Compile(source)->Run();
CHECK(result.IsEmpty()); CHECK(result.IsEmpty());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
return v8::Undefined();
} }
v8::Handle<v8::Value> DoLoop(const v8::Arguments& args) { void DoLoop(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch; v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("function f() {" v8::Script::Compile(v8::String::New("function f() {"
...@@ -84,11 +80,10 @@ v8::Handle<v8::Value> DoLoop(const v8::Arguments& args) { ...@@ -84,11 +80,10 @@ v8::Handle<v8::Value> DoLoop(const v8::Arguments& args) {
CHECK(try_catch.Message().IsEmpty()); CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue()); CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
return v8::Undefined();
} }
v8::Handle<v8::Value> DoLoopNoCall(const v8::Arguments& args) { void DoLoopNoCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch; v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("var term = true;" v8::Script::Compile(v8::String::New("var term = true;"
...@@ -101,13 +96,12 @@ v8::Handle<v8::Value> DoLoopNoCall(const v8::Arguments& args) { ...@@ -101,13 +96,12 @@ v8::Handle<v8::Value> DoLoopNoCall(const v8::Arguments& args) {
CHECK(try_catch.Message().IsEmpty()); CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue()); CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
return v8::Undefined();
} }
v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate( v8::Handle<v8::ObjectTemplate> CreateGlobalTemplate(
v8::InvocationCallback terminate, v8::FunctionCallback terminate,
v8::InvocationCallback doloop) { v8::FunctionCallback doloop) {
v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New(); v8::Handle<v8::ObjectTemplate> global = v8::ObjectTemplate::New();
global->Set(v8::String::New("terminate"), global->Set(v8::String::New("terminate"),
v8::FunctionTemplate::New(terminate)); v8::FunctionTemplate::New(terminate));
...@@ -268,19 +262,19 @@ TEST(TerminateMultipleV8ThreadsDefaultIsolate) { ...@@ -268,19 +262,19 @@ TEST(TerminateMultipleV8ThreadsDefaultIsolate) {
int call_count = 0; int call_count = 0;
v8::Handle<v8::Value> TerminateOrReturnObject(const v8::Arguments& args) { void TerminateOrReturnObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
if (++call_count == 10) { if (++call_count == 10) {
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::V8::TerminateExecution(); v8::V8::TerminateExecution();
return v8::Undefined(); return;
} }
v8::Local<v8::Object> result = v8::Object::New(); v8::Local<v8::Object> result = v8::Object::New();
result->Set(v8::String::New("x"), v8::Integer::New(42)); result->Set(v8::String::New("x"), v8::Integer::New(42));
return result; args.GetReturnValue().Set(result);
} }
v8::Handle<v8::Value> LoopGetProperty(const v8::Arguments& args) { void LoopGetProperty(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch; v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("function f() {" v8::Script::Compile(v8::String::New("function f() {"
...@@ -299,7 +293,6 @@ v8::Handle<v8::Value> LoopGetProperty(const v8::Arguments& args) { ...@@ -299,7 +293,6 @@ v8::Handle<v8::Value> LoopGetProperty(const v8::Arguments& args) {
CHECK(try_catch.Message().IsEmpty()); CHECK(try_catch.Message().IsEmpty());
CHECK(!try_catch.CanContinue()); CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
return v8::Undefined();
} }
...@@ -329,7 +322,7 @@ TEST(TerminateLoadICException) { ...@@ -329,7 +322,7 @@ TEST(TerminateLoadICException) {
v8::Script::Compile(source)->Run(); v8::Script::Compile(source)->Run();
} }
v8::Handle<v8::Value> ReenterAfterTermination(const v8::Arguments& args) { void ReenterAfterTermination(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch; v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("function f() {" v8::Script::Compile(v8::String::New("function f() {"
...@@ -351,7 +344,6 @@ v8::Handle<v8::Value> ReenterAfterTermination(const v8::Arguments& args) { ...@@ -351,7 +344,6 @@ v8::Handle<v8::Value> ReenterAfterTermination(const v8::Arguments& args) {
CHECK(!try_catch.CanContinue()); CHECK(!try_catch.CanContinue());
CHECK(v8::V8::IsExecutionTerminating()); CHECK(v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("function f() { fail(); } f()"))->Run(); v8::Script::Compile(v8::String::New("function f() { fail(); } f()"))->Run();
return v8::Undefined();
} }
// Test that reentry into V8 while the termination exception is still pending // Test that reentry into V8 while the termination exception is still pending
...@@ -373,7 +365,7 @@ TEST(TerminateAndReenterFromThreadItself) { ...@@ -373,7 +365,7 @@ TEST(TerminateAndReenterFromThreadItself) {
"f()"))->Run()->IsTrue()); "f()"))->Run()->IsTrue());
} }
v8::Handle<v8::Value> DoLoopCancelTerminate(const v8::Arguments& args) { void DoLoopCancelTerminate(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch; v8::TryCatch try_catch;
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
v8::Script::Compile(v8::String::New("var term = true;" v8::Script::Compile(v8::String::New("var term = true;"
...@@ -390,7 +382,6 @@ v8::Handle<v8::Value> DoLoopCancelTerminate(const v8::Arguments& args) { ...@@ -390,7 +382,6 @@ v8::Handle<v8::Value> DoLoopCancelTerminate(const v8::Arguments& args) {
CHECK(try_catch.HasTerminated()); CHECK(try_catch.HasTerminated());
v8::V8::CancelTerminateExecution(v8::Isolate::GetCurrent()); v8::V8::CancelTerminateExecution(v8::Isolate::GetCurrent());
CHECK(!v8::V8::IsExecutionTerminating()); CHECK(!v8::V8::IsExecutionTerminating());
return v8::Undefined();
} }
// Test that a single thread of JavaScript execution can terminate // Test that a single thread of JavaScript execution can terminate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment