Revision: 15222
Author: [email protected]
Date: Thu Jun 20 01:12:59 2013
Log: remove all old style callbacks - patch 1 of many
[email protected]
BUG=
Review URL: https://codereview.chromium.org/17064004
http://code.google.com/p/v8/source/detail?r=15222
Modified:
/branches/bleeding_edge/test/cctest/test-accessors.cc
/branches/bleeding_edge/test/cctest/test-api.cc
=======================================
--- /branches/bleeding_edge/test/cctest/test-accessors.cc Fri Mar 15
05:06:53 2013
+++ /branches/bleeding_edge/test/cctest/test-accessors.cc Thu Jun 20
01:12:59 2013
@@ -44,10 +44,10 @@
using ::v8::AccessorInfo;
using ::v8::Extension;
-static v8::Handle<Value> handle_property(Local<String> name,
- const AccessorInfo&) {
+static void handle_property(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
ApiTestFuzzer::Fuzz();
- return v8_num(900);
+ info.GetReturnValue().Set(v8_num(900));
}
@@ -65,18 +65,18 @@
}
-static v8::Handle<Value> GetIntValue(Local<String> property,
- const AccessorInfo& info) {
+static void GetIntValue(Local<String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
int* value =
static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
- return v8_num(*value);
+ info.GetReturnValue().Set(v8_num(*value));
}
static void SetIntValue(Local<String> property,
Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<void>& info) {
int* field =
static_cast<int*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
*field = value->Int32Value();
@@ -114,19 +114,20 @@
static v8::Handle<v8::Object> x_holder;
-static v8::Handle<Value> XGetter(Local<String> name, const AccessorInfo&
info) {
+static void XGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
v8::Isolate* isolate = v8::Isolate::GetCurrent();
CHECK_EQ(isolate, info.GetIsolate());
CHECK_EQ(x_receiver, info.This());
CHECK_EQ(x_holder, info.Holder());
- return v8_num(x_register);
+ info.GetReturnValue().Set(v8_num(x_register));
}
static void XSetter(Local<String> name,
Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<void>& info) {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
CHECK_EQ(isolate, info.GetIsolate());
CHECK_EQ(x_holder, info.This());
@@ -160,11 +161,11 @@
}
-static v8::Handle<Value> AccessorProhibitsOverwritingGetter(
+static void AccessorProhibitsOverwritingGetter(
Local<String> name,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8::True();
+ info.GetReturnValue().Set(true);
}
@@ -208,12 +209,13 @@
template <int C>
-static v8::Handle<Value> HandleAllocatingGetter(Local<String> name,
- const AccessorInfo& info) {
+static void HandleAllocatingGetter(
+ Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
for (int i = 0; i < C; i++)
v8::String::New("foo");
- return v8::String::New("foo");
+ info.GetReturnValue().Set(v8::String::New("foo"));
}
@@ -239,8 +241,9 @@
CHECK_EQ(count_before, count_after);
}
-static v8::Handle<Value> CheckAccessorArgsCorrect(Local<String> name,
- const AccessorInfo&
info) {
+static void CheckAccessorArgsCorrect(
+ Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
CHECK(info.GetIsolate() == v8::Isolate::GetCurrent());
CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data")));
@@ -252,7 +255,7 @@
CHECK(info.GetIsolate() == v8::Isolate::GetCurrent());
CHECK(info.This() == info.Holder());
CHECK(info.Data()->Equals(v8::String::New("data")));
- return v8::Integer::New(17);
+ info.GetReturnValue().Set(17);
}
THREADED_TEST(DirectCall) {
@@ -273,12 +276,12 @@
}
}
-static v8::Handle<Value> EmptyGetter(Local<String> name,
- const AccessorInfo& info) {
+static void EmptyGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
CheckAccessorArgsCorrect(name, info);
ApiTestFuzzer::Fuzz();
CheckAccessorArgsCorrect(name, info);
- return v8::Handle<v8::Value>();
+ info.GetReturnValue().Set(v8::Handle<v8::Value>());
}
THREADED_TEST(EmptyResult) {
@@ -330,16 +333,17 @@
}
}
-static v8::Handle<Value> ThrowingGetAccessor(Local<String> name,
- const AccessorInfo& info) {
+static void ThrowingGetAccessor(
+ Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8::ThrowException(v8_str("g"));
+ v8::ThrowException(v8_str("g"));
}
static void ThrowingSetAccessor(Local<String> name,
Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<void>&
info) {
v8::ThrowException(value);
}
@@ -374,10 +378,10 @@
}
-static v8::Handle<Value> AllocGetter(Local<String> name,
- const AccessorInfo& info) {
+static void AllocGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8::Array::New(1000);
+ info.GetReturnValue().Set(v8::Array::New(1000));
}
@@ -397,8 +401,8 @@
}
-static v8::Handle<Value> StackCheck(Local<String> name,
- const AccessorInfo& info) {
+static void StackCheck(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
i::StackFrameIterator
iter(reinterpret_cast<i::Isolate*>(info.GetIsolate()));
for (int i = 0; !iter.done(); i++) {
i::StackFrame* frame = iter.frame();
@@ -409,7 +413,6 @@
CHECK(code->contains(pc));
iter.Advance();
}
- return v8::Undefined();
}
@@ -430,12 +433,12 @@
}
-static v8::Handle<Value> AllocateHandles(Local<String> name,
- const AccessorInfo& info) {
+static void AllocateHandles(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
for (int i = 0; i < i::kHandleBlockSize + 1; i++) {
v8::Local<v8::Value>::New(name);
}
- return v8::Integer::New(100);
+ info.GetReturnValue().Set(v8::Integer::New(100));
}
@@ -456,16 +459,16 @@
}
-v8::Handle<v8::Array> JSONStringifyEnumerator(const AccessorInfo& info) {
+void JSONStringifyEnumerator(const v8::PropertyCallbackInfo<v8::Array>&
info) {
v8::Handle<v8::Array> array = v8::Array::New(1);
array->Set(0, v8_str("regress"));
- return array;
+ info.GetReturnValue().Set(array);
}
-v8::Handle<v8::Value> JSONStringifyGetter(Local<String> name,
- const AccessorInfo& info) {
- return v8_str("crbug-161028");
+void JSONStringifyGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ info.GetReturnValue().Set(v8_str("crbug-161028"));
}
=======================================
--- /branches/bleeding_edge/test/cctest/test-api.cc Thu Jun 20 01:07:45 2013
+++ /branches/bleeding_edge/test/cctest/test-api.cc Thu Jun 20 01:12:59 2013
@@ -135,24 +135,25 @@
static int signature_callback_count;
-static v8::Handle<Value> IncrementingSignatureCallback(
- const v8::Arguments& args) {
+static void IncrementingSignatureCallback(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
signature_callback_count++;
v8::Handle<v8::Array> result = v8::Array::New(args.Length());
for (int i = 0; i < args.Length(); i++)
result->Set(v8::Integer::New(i), args[i]);
- return result;
+ args.GetReturnValue().Set(result);
}
-static v8::Handle<Value> SignatureCallback(const v8::Arguments& args) {
+static void SignatureCallback(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
v8::Handle<v8::Array> result = v8::Array::New(args.Length());
for (int i = 0; i < args.Length(); i++) {
result->Set(v8::Integer::New(i), args[i]);
}
- return result;
+ args.GetReturnValue().Set(result);
}
@@ -847,39 +848,6 @@
}
}
-static v8::Handle<Value> handle_call_impl(
- const v8::Arguments& args,
- i::Address callback) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, callback);
- args.GetReturnValue().Set(v8_str("bad value"));
- return v8_num(102);
-}
-
-static v8::Handle<Value> handle_call(const v8::Arguments& args) {
- return handle_call_impl(args, FUNCTION_ADDR(handle_call));
-}
-
-static v8::Handle<Value> handle_call_2(const v8::Arguments& args) {
- return handle_call_impl(args, FUNCTION_ADDR(handle_call_2));
-}
-
-static v8::Handle<Value> handle_call_indirect_impl(const v8::Arguments&
args,
- i::Address callback) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, callback);
- args.GetReturnValue().Set(v8_str("bad value"));
- args.GetReturnValue().Set(v8_num(102));
- return v8::Handle<Value>();
-}
-
-static v8::Handle<Value> handle_call_indirect(const v8::Arguments& args) {
- return handle_call_indirect_impl(args,
FUNCTION_ADDR(handle_call_indirect));
-}
-
-static v8::Handle<Value> handle_call_indirect_2(const v8::Arguments& args)
{
- return handle_call_indirect_impl(args,
FUNCTION_ADDR(handle_call_indirect_2));
-}
static void handle_callback_impl(const v8::FunctionCallbackInfo<Value>&
info,
i::Address callback) {
@@ -896,25 +864,6 @@
static void handle_callback_2(const v8::FunctionCallbackInfo<Value>& info)
{
return handle_callback_impl(info, FUNCTION_ADDR(handle_callback_2));
}
-
-static v8::Handle<Value> construct_call(const v8::Arguments& args) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, FUNCTION_ADDR(construct_call));
- args.This()->Set(v8_str("x"), v8_num(1));
- args.This()->Set(v8_str("y"), v8_num(2));
- args.GetReturnValue().Set(v8_str("bad value"));
- return args.This();
-}
-
-static v8::Handle<Value> construct_call_indirect(const v8::Arguments&
args) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, FUNCTION_ADDR(construct_call_indirect));
- args.This()->Set(v8_str("x"), v8_num(1));
- args.This()->Set(v8_str("y"), v8_num(2));
- args.GetReturnValue().Set(v8_str("bad value"));
- args.GetReturnValue().Set(args.This());
- return v8::Handle<Value>();
-}
static void construct_callback(
const v8::FunctionCallbackInfo<Value>& info) {
@@ -926,24 +875,6 @@
info.GetReturnValue().Set(info.This());
}
-
-static v8::Handle<Value> Return239(
- Local<String> name, const AccessorInfo& info) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(info, FUNCTION_ADDR(Return239));
- info.GetReturnValue().Set(v8_str("bad value"));
- return v8_num(239);
-}
-
-static v8::Handle<Value> Return239Indirect(
- Local<String> name, const AccessorInfo& info) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(info, FUNCTION_ADDR(Return239Indirect));
- Handle<Value> value = v8_num(239);
- info.GetReturnValue().Set(v8_str("bad value"));
- info.GetReturnValue().Set(value);
- return v8::Handle<Value>();
-}
static void Return239Callback(
Local<String> name, const v8::PropertyCallbackInfo<Value>& info) {
@@ -1017,30 +948,11 @@
THREADED_PROFILED_TEST(FunctionTemplate) {
- TestFunctionTemplateInitializer(handle_call, handle_call_2);
- TestFunctionTemplateInitializer(handle_call_indirect,
handle_call_indirect_2);
TestFunctionTemplateInitializer(handle_callback, handle_callback_2);
-
- TestFunctionTemplateAccessor(construct_call, Return239);
- TestFunctionTemplateAccessor(construct_call_indirect, Return239Indirect);
TestFunctionTemplateAccessor(construct_callback, Return239Callback);
}
-static v8::Handle<v8::Value> SimpleDirectCallback(const v8::Arguments&
args) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, FUNCTION_ADDR(SimpleDirectCallback));
- args.GetReturnValue().Set(v8_str("bad value"));
- return v8_num(51423 + args.Length());
-}
-
-static v8::Handle<v8::Value> SimpleIndirectCallback(const v8::Arguments&
args) {
- ApiTestFuzzer::Fuzz();
- CheckReturnValue(args, FUNCTION_ADDR(SimpleIndirectCallback));
- args.GetReturnValue().Set(v8_num(51423 + args.Length()));
- return v8::Handle<v8::Value>();
-}
-
static void SimpleCallback(const v8::FunctionCallbackInfo<v8::Value>&
info) {
ApiTestFuzzer::Fuzz();
CheckReturnValue(info, FUNCTION_ADDR(SimpleCallback));
@@ -1070,8 +982,6 @@
THREADED_PROFILED_TEST(SimpleCallback) {
- TestSimpleCallback(SimpleDirectCallback);
- TestSimpleCallback(SimpleIndirectCallback);
TestSimpleCallback(SimpleCallback);
}
@@ -1236,7 +1146,7 @@
v8::HandleScope scope(env->GetIsolate());
{
Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New(
- handle_call, Handle<v8::Value>(), Handle<v8::Signature>(), 23);
+ handle_callback, Handle<v8::Value>(), Handle<v8::Signature>(), 23);
Local<Function> fun = fun_templ->GetFunction();
env->Global()->Set(v8_str("obj"), fun);
Local<Script> script = v8_compile("obj.length");
@@ -1244,7 +1154,7 @@
}
{
Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(handle_call);
+ v8::FunctionTemplate::New(handle_callback);
fun_templ->SetLength(22);
Local<Function> fun = fun_templ->GetFunction();
env->Global()->Set(v8_str("obj"), fun);
@@ -1254,7 +1164,7 @@
{
// Without setting length it defaults to 0.
Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(handle_call);
+ v8::FunctionTemplate::New(handle_callback);
Local<Function> fun = fun_templ->GetFunction();
env->Global()->Set(v8_str("obj"), fun);
Local<Script> script = v8_compile("obj.length");
@@ -1264,10 +1174,10 @@
static void* expected_ptr;
-static v8::Handle<v8::Value> callback(const v8::Arguments& args) {
+static void callback(const v8::FunctionCallbackInfo<v8::Value>& args) {
void* ptr = v8::External::Cast(*args.Data())->Value();
CHECK_EQ(expected_ptr, ptr);
- return v8::True();
+ args.GetReturnValue().Set(true);
}
@@ -1645,15 +1555,16 @@
}
-static v8::Handle<Value> DummyCallHandler(const v8::Arguments& args) {
+static void DummyCallHandler(const v8::FunctionCallbackInfo<v8::Value>&
args) {
ApiTestFuzzer::Fuzz();
- return v8_num(13.4);
+ args.GetReturnValue().Set(v8_num(13.4));
}
-static v8::Handle<Value> GetM(Local<String> name, const AccessorInfo&) {
+static void GetM(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8_num(876);
+ info.GetReturnValue().Set(v8_num(876));
}
@@ -1699,15 +1610,16 @@
}
-static v8::Handle<Value> GetFlabby(const v8::Arguments& args) {
+static void GetFlabby(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- return v8_num(17.2);
+ args.GetReturnValue().Set(v8_num(17.2));
}
-static v8::Handle<Value> GetKnurd(Local<String> property, const
AccessorInfo&) {
+static void GetKnurd(Local<String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8_num(15.2);
+ info.GetReturnValue().Set(v8_num(15.2));
}
@@ -1770,75 +1682,73 @@
int echo_named_call_count;
-static v8::Handle<Value> EchoNamedProperty(Local<String> name,
- const AccessorInfo& info) {
+static void EchoNamedProperty(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(v8_str("data"), info.Data());
echo_named_call_count++;
- return name;
+ info.GetReturnValue().Set(name);
}
// Helper functions for Interceptor/Accessor interaction tests
-Handle<Value> SimpleAccessorGetter(Local<String> name,
- const AccessorInfo& info) {
+void SimpleAccessorGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
{
Handle<Object> self = info.This();
- return self->Get(String::Concat(v8_str("accessor_"), name));
+ info.GetReturnValue().Set(
+ self->Get(String::Concat(v8_str("accessor_"), name)));
}
void SimpleAccessorSetter(Local<String> name, Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<void>& info) {
Handle<Object> self = info.This();
self->Set(String::Concat(v8_str("accessor_"), name), value);
}
-Handle<Value> EmptyInterceptorGetter(Local<String> name,
- const AccessorInfo& info) {
- return Handle<Value>();
+void EmptyInterceptorGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
}
-Handle<Value> EmptyInterceptorSetter(Local<String> name,
- Local<Value> value,
- const AccessorInfo& info) {
- return Handle<Value>();
+void EmptyInterceptorSetter(Local<String> name,
+ Local<Value> value,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
}
-Handle<Value> InterceptorGetter(Local<String> name,
- const AccessorInfo& info) {
+void InterceptorGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
// Intercept names that start with 'interceptor_'.
String::Utf8Value utf8(name);
char* name_str = *utf8;
char prefix[] = "interceptor_";
int i;
for (i = 0; name_str[i] && prefix[i]; ++i) {
- if (name_str[i] != prefix[i]) return Handle<Value>();
+ if (name_str[i] != prefix[i]) return;
}
Handle<Object> self = info.This();
- return self->GetHiddenValue(v8_str(name_str + i));
+ info.GetReturnValue().Set(self->GetHiddenValue(v8_str(name_str + i)));
}
-Handle<Value> InterceptorSetter(Local<String> name,
- Local<Value> value,
- const AccessorInfo& info) {
+void InterceptorSetter(Local<String> name,
+ Local<Value> value,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
// Intercept accesses that set certain integer values.
if (value->IsInt32() && value->Int32Value() < 10000) {
Handle<Object> self = info.This();
self->SetHiddenValue(name, value);
- return value;
+ info.GetReturnValue().Set(value);
}
- return Handle<Value>();
}
void AddAccessor(Handle<FunctionTemplate> templ,
Handle<String> name,
- v8::AccessorGetter getter,
- v8::AccessorSetter setter) {
+ v8::AccessorGetterCallback getter,
+ v8::AccessorSetterCallback setter) {
templ->PrototypeTemplate()->SetAccessor(name, getter, setter);
}
void AddInterceptor(Handle<FunctionTemplate> templ,
- v8::NamedPropertyGetter getter,
- v8::NamedPropertySetter setter) {
+ v8::NamedPropertyGetterCallback getter,
+ v8::NamedPropertySetterCallback setter) {
templ->InstanceTemplate()->SetNamedPropertyHandler(getter, setter);
}
@@ -2079,12 +1989,13 @@
int echo_indexed_call_count = 0;
-static v8::Handle<Value> EchoIndexedProperty(uint32_t index,
- const AccessorInfo& info) {
+static void EchoIndexedProperty(
+ uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(v8_num(637), info.Data());
echo_indexed_call_count++;
- return v8_num(index);
+ info.GetReturnValue().Set(v8_num(index));
}
@@ -2240,23 +2151,22 @@
}
-static v8::Handle<Value> PrePropertyHandlerGet(Local<String> key,
- const AccessorInfo& info) {
+static void PrePropertyHandlerGet(
+ Local<String> key,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (v8_str("pre")->Equals(key)) {
- return v8_str("PrePropertyHandler: pre");
+ info.GetReturnValue().Set(v8_str("PrePropertyHandler: pre"));
}
- return v8::Handle<String>();
}
-static v8::Handle<v8::Integer> PrePropertyHandlerQuery(Local<String> key,
- const
AccessorInfo&) {
+static void PrePropertyHandlerQuery(
+ Local<String> key,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
if (v8_str("pre")->Equals(key)) {
- return v8::Integer::New(v8::None);
+ info.GetReturnValue().Set(static_cast<int32_t>(v8::None));
}
-
- return v8::Handle<v8::Integer>(); // do not intercept the call
}
@@ -2291,27 +2201,29 @@
static const int kTargetRecursionDepth = 200; // near maximum
-static v8::Handle<Value> CallScriptRecursivelyCall(const v8::Arguments&
args) {
+static void CallScriptRecursivelyCall(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
int depth = args.This()->Get(v8_str("depth"))->Int32Value();
- if (depth == kTargetRecursionDepth) return v8::Undefined();
+ if (depth == kTargetRecursionDepth) return;
args.This()->Set(v8_str("depth"), v8::Integer::New(depth + 1));
- return call_recursively_script->Run();
+ args.GetReturnValue().Set(call_recursively_script->Run());
}
-static v8::Handle<Value> CallFunctionRecursivelyCall(
- const v8::Arguments& args) {
+static void CallFunctionRecursivelyCall(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
int depth = args.This()->Get(v8_str("depth"))->Int32Value();
if (depth == kTargetRecursionDepth) {
printf("[depth = %d]\n", depth);
- return v8::Undefined();
+ return;
}
args.This()->Set(v8_str("depth"), v8::Integer::New(depth + 1));
v8::Handle<Value> function =
args.This()->Get(v8_str("callFunctionRecursively"));
- return function.As<Function>()->Call(args.This(), 0, NULL);
+ args.GetReturnValue().Set(
+ function.As<Function>()->Call(args.This(), 0, NULL));
}
@@ -2334,18 +2246,20 @@
}
-static v8::Handle<Value>
- ThrowingPropertyHandlerGet(Local<String> key, const AccessorInfo&) {
+static void ThrowingPropertyHandlerGet(
+ Local<String> key,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- return v8::ThrowException(key);
+ info.GetReturnValue().Set(v8::ThrowException(key));
}
-static v8::Handle<Value> ThrowingPropertyHandlerSet(Local<String> key,
- Local<Value>,
- const AccessorInfo&) {
+static void ThrowingPropertyHandlerSet(
+ Local<String> key,
+ Local<Value>,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
v8::ThrowException(key);
- return v8::Undefined(); // not the same as v8::Handle<v8::Value>()
+ info.GetReturnValue().SetUndefined(); // not the same as empty handle
}
@@ -2950,10 +2864,9 @@
static bool interceptor_for_hidden_properties_called;
-static v8::Handle<Value> InterceptorForHiddenProperties(
- Local<String> name, const AccessorInfo& info) {
+static void InterceptorForHiddenProperties(
+ Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
interceptor_for_hidden_properties_called = true;
- return v8::Handle<Value>();
}
@@ -3673,13 +3586,13 @@
}
-v8::Handle<Value> HandleF(const v8::Arguments& args) {
+void HandleF(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::HandleScope scope(args.GetIsolate());
ApiTestFuzzer::Fuzz();
Local<v8::Array> result = v8::Array::New(args.Length());
for (int i = 0; i < args.Length(); i++)
result->Set(i, args[i]);
- return scope.Close(result);
+ args.GetReturnValue().Set(scope.Close(result));
}
@@ -3803,7 +3716,7 @@
}
-v8::Handle<Value> ProvokeOutOfMemory(const v8::Arguments& args) {
+void ProvokeOutOfMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
LocalContext context;
@@ -3816,7 +3729,7 @@
CHECK(result.IsEmpty());
CHECK(context->HasOutOfMemoryException());
- return result;
+ args.GetReturnValue().Set(result);
}
@@ -4089,19 +4002,22 @@
}
-v8::Handle<Value> ThrowFromC(const v8::Arguments& args) {
+void ThrowFromC(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- return v8::ThrowException(v8_str("konto"));
+ v8::ThrowException(v8_str("konto"));
}
-v8::Handle<Value> CCatcher(const v8::Arguments& args) {
- if (args.Length() < 1) return v8::False();
+void CCatcher(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() < 1) {
+ args.GetReturnValue().Set(false);
+ return;
+ }
v8::HandleScope scope(args.GetIsolate());
v8::TryCatch try_catch;
Local<Value> result = v8::Script::Compile(args[0]->ToString())->Run();
CHECK(!try_catch.HasCaught() || result.IsEmpty());
- return v8::Boolean::New(try_catch.HasCaught());
+ args.GetReturnValue().Set(try_catch.HasCaught());
}
@@ -4167,10 +4083,9 @@
}
-static v8::Handle<Value> Fail(const v8::Arguments& args) {
+static void Fail(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK(false);
- return v8::Undefined();
}
@@ -4314,13 +4229,14 @@
-v8::Handle<Value> CThrowCountDown(const v8::Arguments& args) {
+void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(4, args.Length());
int count = args[0]->Int32Value();
int cInterval = args[2]->Int32Value();
if (count == 0) {
- return v8::ThrowException(v8_str("FromC"));
+ v8::ThrowException(v8_str("FromC"));
+ return;
} else {
Local<v8::Object> global = Context::GetCurrent()->Global();
Local<Value> fun = global->Get(v8_str("JSThrowCountDown"));
@@ -4339,15 +4255,17 @@
} else {
CHECK_NE(expected, count);
}
- return result;
+ args.GetReturnValue().Set(result);
+ return;
} else {
- return fun.As<Function>()->Call(global, 4, argv);
+ args.GetReturnValue().Set(fun.As<Function>()->Call(global, 4, argv));
+ return;
}
}
}
-v8::Handle<Value> JSCheck(const v8::Arguments& args) {
+void JSCheck(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(3, args.Length());
bool equality = args[0]->BooleanValue();
@@ -4358,7 +4276,6 @@
} else {
CHECK_NE(count, expected);
}
- return v8::Undefined();
}
@@ -4453,11 +4370,10 @@
fun->Call(fun, argc, a5);
}
-
-v8::Handle<Value> ThrowValue(const v8::Arguments& args) {
+void ThrowValue(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(1, args.Length());
- return v8::ThrowException(args[0]);
+ v8::ThrowException(args[0]);
}
@@ -4524,9 +4440,8 @@
}
-v8::Handle<v8::Value> WithTryCatch(const v8::Arguments& args) {
+void WithTryCatch(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::TryCatch try_catch;
- return v8::Undefined();
}
@@ -4614,12 +4529,12 @@
}
-static v8::Handle<Value> GetXValue(Local<String> name,
- const AccessorInfo& info) {
+static void GetXValue(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(info.Data(), v8_str("donut"));
CHECK_EQ(name, v8_str("x"));
- return name;
+ info.GetReturnValue().Set(name);
}
@@ -4856,12 +4771,12 @@
}
-static v8::Handle<Value> Get239Value(Local<String> name,
- const AccessorInfo& info) {
+static void Get239Value(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(info.Data(), v8_str("donut"));
CHECK_EQ(name, v8_str("239"));
- return name;
+ info.GetReturnValue().Set(name);
}
@@ -4894,7 +4809,7 @@
static void SetXValue(Local<String> name,
Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<void>& info) {
CHECK_EQ(value, v8_num(4));
CHECK_EQ(info.Data(), v8_str("donut"));
CHECK_EQ(name, v8_str("x"));
@@ -4941,7 +4856,7 @@
v8::HandleScope scope(v8::Isolate::GetCurrent());
Local<ObjectTemplate> templ = ObjectTemplate::New();
templ->SetAccessor(v8_str("x"),
- static_cast<v8::AccessorGetter>(NULL),
+ static_cast<v8::AccessorGetterCallback>(NULL),
NULL,
v8_str("donut"));
LocalContext context;
@@ -4953,11 +4868,11 @@
}
-static v8::Handle<Value> XPropertyGetter(Local<String> property,
- const AccessorInfo& info) {
+static void XPropertyGetter(Local<String> property,
+ const v8::PropertyCallbackInfo<v8::Value>&
info) {
ApiTestFuzzer::Fuzz();
CHECK(info.Data()->IsUndefined());
- return property;
+ info.GetReturnValue().Set(property);
}
@@ -5046,12 +4961,12 @@
}
-static v8::Handle<Value> SetXOnPrototypeGetter(Local<String> property,
- const AccessorInfo& info) {
+static void SetXOnPrototypeGetter(
+ Local<String> property,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
// Set x on the prototype object and do not handle the get request.
v8::Handle<v8::Value> proto = info.Holder()->GetPrototype();
proto.As<v8::Object>()->Set(v8_str("x"), v8::Integer::New(23));
- return v8::Handle<Value>();
}
@@ -5073,24 +4988,24 @@
}
-static v8::Handle<Value> IndexedPropertyGetter(uint32_t index,
- const AccessorInfo& info) {
+static void IndexedPropertyGetter(
+ uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (index == 37) {
- return v8::Handle<Value>(v8_num(625));
+ info.GetReturnValue().Set(v8_num(625));
}
- return v8::Handle<Value>();
}
-static v8::Handle<Value> IndexedPropertySetter(uint32_t index,
- Local<Value> value,
- const AccessorInfo& info) {
+static void IndexedPropertySetter(
+ uint32_t index,
+ Local<Value> value,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (index == 39) {
- return value;
+ info.GetReturnValue().Set(value);
}
- return v8::Handle<Value>();
}
@@ -5124,38 +5039,36 @@
}
-static v8::Handle<Value> UnboxedDoubleIndexedPropertyGetter(
+static void UnboxedDoubleIndexedPropertyGetter(
uint32_t index,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (index < 25) {
- return v8::Handle<Value>(v8_num(index));
+ info.GetReturnValue().Set(v8_num(index));
}
- return v8::Handle<Value>();
}
-static v8::Handle<Value> UnboxedDoubleIndexedPropertySetter(
+static void UnboxedDoubleIndexedPropertySetter(
uint32_t index,
Local<Value> value,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (index < 25) {
- return v8::Handle<Value>(v8_num(index));
+ info.GetReturnValue().Set(v8_num(index));
}
- return v8::Handle<Value>();
}
-Handle<v8::Array> UnboxedDoubleIndexedPropertyEnumerator(
- const AccessorInfo& info) {
+void UnboxedDoubleIndexedPropertyEnumerator(
+ const v8::PropertyCallbackInfo<v8::Array>& info) {
// Force the list of returned keys to be stored in a FastDoubleArray.
Local<Script> indexed_property_names_script = Script::Compile(v8_str(
"keys = new Array(); keys[125000] = 1;"
"for(i = 0; i < 80000; i++) { keys[i] = i; };"
"keys.length = 25; keys;"));
Local<Value> result = indexed_property_names_script->Run();
- return Local<v8::Array>::Cast(result);
+ info.GetReturnValue().Set(Local<v8::Array>::Cast(result));
}
@@ -5186,8 +5099,8 @@
}
-Handle<v8::Array> NonStrictArgsIndexedPropertyEnumerator(
- const AccessorInfo& info) {
+void NonStrictArgsIndexedPropertyEnumerator(
+ const v8::PropertyCallbackInfo<v8::Array>& info) {
// Force the list of returned keys to be stored in a Arguments object.
Local<Script> indexed_property_names_script = Script::Compile(v8_str(
"function f(w,x) {"
@@ -5201,18 +5114,17 @@
i::Handle<i::JSObject> o =
v8::Utils::OpenHandle<Object, i::JSObject>(result);
i::Handle<i::JSArray> array(reinterpret_cast<i::JSArray*>(*o));
- return v8::Utils::ToLocal(array);
+ info.GetReturnValue().Set(v8::Utils::ToLocal(array));
}
-static v8::Handle<Value> NonStrictIndexedPropertyGetter(
+static void NonStrictIndexedPropertyGetter(
uint32_t index,
- const AccessorInfo& info) {
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (index < 4) {
- return v8::Handle<Value>(v8_num(index));
+ info.GetReturnValue().Set(v8_num(index));
}
- return v8::Handle<Value>();
}
@@ -5237,10 +5149,10 @@
}
-static v8::Handle<Value> IdentityIndexedPropertyGetter(
+static void IdentityIndexedPropertyGetter(
uint32_t index,
- const AccessorInfo& info) {
- return v8::Integer::NewFromUnsigned(index);
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
+ info.GetReturnValue().Set(index);
}
@@ -5811,9 +5723,9 @@
}
-static v8::Handle<Value> HandleLogDelegator(const v8::Arguments& args) {
+static void HandleLogDelegator(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
- return v8::Undefined();
}
@@ -6048,7 +5960,7 @@
public:
NativeFunctionExtension(const char* name,
const char* source,
- v8::InvocationCallback fun = &Echo)
+ v8::FunctionCallback fun = &Echo)
: Extension(name, source),
function_(fun) { }
@@ -6057,12 +5969,11 @@
return v8::FunctionTemplate::New(function_);
}
- static v8::Handle<v8::Value> Echo(const v8::Arguments& args) {
- if (args.Length() >= 1) return (args[0]);
- return v8::Undefined();
+ static void Echo(const v8::FunctionCallbackInfo<v8::Value>& args) {
+ if (args.Length() >= 1) args.GetReturnValue().Set(args[0]);
}
private:
- v8::InvocationCallback function_;
+ v8::FunctionCallback function_;
};
@@ -6159,13 +6070,14 @@
"}";
-static v8::Handle<Value> CallFun(const v8::Arguments& args) {
+static void CallFun(const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
if (args.IsConstructCall()) {
args.This()->Set(v8_str("data"), args.Data());
- return v8::Null();
+ args.GetReturnValue().SetNull();
+ return;
}
- return args.Data();
+ args.GetReturnValue().Set(args.Data());
}
@@ -6330,8 +6242,8 @@
obj->ClearWeak(isolate);
}
-v8::Handle<Value> WhammyPropertyGetter(Local<String> name,
- const AccessorInfo& info) {
+void WhammyPropertyGetter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info)
{
Whammy* whammy =
static_cast<Whammy*>(v8::Handle<v8::External>::Cast(info.Data())->Value());
@@ -6346,7 +6258,7 @@
}
whammy->objects_[whammy->cursor_].Reset(info.GetIsolate(), obj);
whammy->cursor_ = (whammy->cursor_ + 1) % Whammy::kObjectCount;
- return whammy->getScript()->Run();
+ info.GetReturnValue().Set(whammy->getScript()->Run());
}
THREADED_TEST(WeakReference) {
@@ -6516,7 +6428,8 @@
v8::Handle<Function> args_fun;
-static v8::Handle<Value> ArgumentsTestCallback(const v8::Arguments& args) {
+static void ArgumentsTestCallback(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
ApiTestFuzzer::Fuzz();
CHECK_EQ(args_fun, args.Callee());
CHECK_EQ(3, args.Length());
@@ -6526,7 +6439,6 @@
CHECK_EQ(v8::Undefined(), args[3]);
v8::HandleScope scope(args.GetIsolate());
HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
- return v8::Undefined();
}
@@ -6540,34 +6452,33 @@
}
-static v8::Handle<Value> NoBlockGetterX(Local<String> name,
- const AccessorInfo&) {
- return v8::Handle<Value>();
+static void NoBlockGetterX(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>&) {
}
-static v8::Handle<Value> NoBlockGetterI(uint32_t index,
- const AccessorInfo&) {
- return v8::Handle<Value>();
+static void NoBlockGetterI(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Value>&) {
}
-static v8::Handle<v8::Boolean> PDeleter(Local<String> name,
- const AccessorInfo&) {
+static void PDeleter(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) {
if (!name->Equals(v8_str("foo"))) {
- return v8::Handle<v8::Boolean>(); // not intercepted
+ return; // not intercepted
}
- return v8::False(); // intercepted, and don't delete the property
+ info.GetReturnValue().Set(false); // intercepted, don't delete the
property
}
-static v8::Handle<v8::Boolean> IDeleter(uint32_t index, const
AccessorInfo&) {
+static void IDeleter(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Boolean>& info) {
if (index != 2) {
- return v8::Handle<v8::Boolean>(); // not intercepted
+ return; // not intercepted
}
- return v8::False(); // intercepted, and don't delete the property
+ info.GetReturnValue().Set(false); // intercepted, don't delete the
property
}
@@ -6597,40 +6508,40 @@
}
-static v8::Handle<Value> GetK(Local<String> name, const AccessorInfo&) {
+static void GetK(Local<String> name,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
if (name->Equals(v8_str("foo")) ||
name->Equals(v8_str("bar")) ||
name->Equals(v8_str("baz"))) {
- return v8::Undefined();
+ info.GetReturnValue().SetUndefined();
}
- return v8::Handle<Value>();
}
-static v8::Handle<Value> IndexedGetK(uint32_t index, const AccessorInfo&) {
+static void IndexedGetK(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
- if (index == 0 || index == 1) return v8::Undefined();
- return v8::Handle<Value>();
+ if (index == 0 || index == 1) info.GetReturnValue().SetUndefined();
}
-static v8::Handle<v8::Array> NamedEnum(const AccessorInfo&) {
+static void NamedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
ApiTestFuzzer::Fuzz();
***The diff for this file has been truncated for email.***
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.