| Index: test/cctest/test-api.cc
|
| diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
|
| index 8f96a4a9d1637784c0cc1175bfb72a6af7a993f3..b95f292b6e1c1763e1eefd64086ed7ebcbc8fe6d 100755
|
| --- a/test/cctest/test-api.cc
|
| +++ b/test/cctest/test-api.cc
|
| @@ -73,6 +73,25 @@ using ::v8::V8;
|
| using ::v8::Value;
|
|
|
|
|
| +#define THREADED_PROFILED_TEST(Name) \
|
| + static void Test##Name(); \
|
| + TEST(Name##WithProfiler) { \
|
| + RunWithProfiler(&Test##Name); \
|
| + } \
|
| + THREADED_TEST(Name)
|
| +
|
| +void RunWithProfiler(void (*test)()) {
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
| + v8::Local<v8::String> profile_name = v8::String::New("my_profile1");
|
| + v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| +
|
| + cpu_profiler->StartCpuProfiling(profile_name);
|
| + (*test)();
|
| + cpu_profiler->DeleteAllCpuProfiles();
|
| +}
|
| +
|
| +
|
| static void ExpectString(const char* code, const char* expected) {
|
| Local<Value> result = CompileRun(code);
|
| CHECK(result->IsString());
|
| @@ -116,24 +135,25 @@ static void ExpectUndefined(const char* code) {
|
|
|
|
|
| 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);
|
| }
|
|
|
|
|
| @@ -828,39 +848,6 @@ static void CheckReturnValue(const T& t, i::Address callback) {
|
| }
|
| }
|
|
|
| -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) {
|
| @@ -878,25 +865,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) {
|
| ApiTestFuzzer::Fuzz();
|
| @@ -908,24 +876,6 @@ static void construct_callback(
|
| }
|
|
|
|
|
| -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) {
|
| ApiTestFuzzer::Fuzz();
|
| @@ -938,125 +888,70 @@ static void Return239Callback(
|
| template<typename Handler>
|
| static void TestFunctionTemplateInitializer(Handler handler,
|
| Handler handler_2) {
|
| - for (int i = 0; i < 2; i++) {
|
| - bool is_profiling = (i > 0);
|
| - // Test constructor calls.
|
| - {
|
| - LocalContext env;
|
| - v8::HandleScope scope(env->GetIsolate());
|
| -
|
| - v8::Local<v8::String> profile_name = v8::String::New("my_profile1");
|
| - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| - if (is_profiling) {
|
| - cpu_profiler->StartCpuProfiling(profile_name);
|
| - }
|
| -
|
| - Local<v8::FunctionTemplate> fun_templ =
|
| - v8::FunctionTemplate::New(handler);
|
| - Local<Function> fun = fun_templ->GetFunction();
|
| - env->Global()->Set(v8_str("obj"), fun);
|
| - Local<Script> script = v8_compile("obj()");
|
| - for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(102, script->Run()->Int32Value());
|
| - }
|
| -
|
| - if (is_profiling) {
|
| - cpu_profiler->StopCpuProfiling(profile_name);
|
| - }
|
| - }
|
| - // Use SetCallHandler to initialize a function template, should work like
|
| - // the previous one.
|
| - {
|
| - LocalContext env;
|
| - v8::HandleScope scope(env->GetIsolate());
|
| -
|
| - v8::Local<v8::String> profile_name = v8::String::New("my_profile2");
|
| - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| - if (is_profiling) {
|
| - cpu_profiler->StartCpuProfiling(profile_name);
|
| - }
|
| -
|
| - Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| - fun_templ->SetCallHandler(handler_2);
|
| - Local<Function> fun = fun_templ->GetFunction();
|
| - env->Global()->Set(v8_str("obj"), fun);
|
| - Local<Script> script = v8_compile("obj()");
|
| - for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(102, script->Run()->Int32Value());
|
| - }
|
| -
|
| - if (is_profiling) {
|
| - cpu_profiler->DeleteAllCpuProfiles();
|
| - }
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| -template<typename Constructor, typename Accessor>
|
| -static void TestFunctionTemplateAccessor(Constructor constructor,
|
| - Accessor accessor) {
|
| - for (int i = 0; i < 2; i++) {
|
| - bool is_profiling = (i > 0);
|
| + // Test constructor calls.
|
| + {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
|
|
| - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| - if (is_profiling) {
|
| - v8::Local<v8::String> profile_name = v8::String::New("my_profile1");
|
| - cpu_profiler->StartCpuProfiling(profile_name);
|
| - }
|
| -
|
| Local<v8::FunctionTemplate> fun_templ =
|
| - v8::FunctionTemplate::New(constructor);
|
| - fun_templ->SetClassName(v8_str("funky"));
|
| - fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), accessor);
|
| + v8::FunctionTemplate::New(handler);
|
| Local<Function> fun = fun_templ->GetFunction();
|
| env->Global()->Set(v8_str("obj"), fun);
|
| - Local<Value> result = v8_compile("(new obj()).toString()")->Run();
|
| - CHECK_EQ(v8_str("[object funky]"), result);
|
| - CompileRun("var obj_instance = new obj();");
|
| - Local<Script> script;
|
| - script = v8_compile("obj_instance.x");
|
| - for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(1, script->Run()->Int32Value());
|
| - }
|
| - script = v8_compile("obj_instance.m");
|
| + Local<Script> script = v8_compile("obj()");
|
| for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(239, script->Run()->Int32Value());
|
| + CHECK_EQ(102, script->Run()->Int32Value());
|
| }
|
| + }
|
| + // Use SetCallHandler to initialize a function template, should work like
|
| + // the previous one.
|
| + {
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
|
|
| - if (is_profiling) {
|
| - cpu_profiler->DeleteAllCpuProfiles();
|
| + Local<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| + fun_templ->SetCallHandler(handler_2);
|
| + Local<Function> fun = fun_templ->GetFunction();
|
| + env->Global()->Set(v8_str("obj"), fun);
|
| + Local<Script> script = v8_compile("obj()");
|
| + for (int i = 0; i < 30; i++) {
|
| + CHECK_EQ(102, script->Run()->Int32Value());
|
| }
|
| }
|
| }
|
|
|
|
|
| -THREADED_TEST(FunctionTemplate) {
|
| - TestFunctionTemplateInitializer(handle_call, handle_call_2);
|
| - TestFunctionTemplateInitializer(handle_call_indirect, handle_call_indirect_2);
|
| - TestFunctionTemplateInitializer(handle_callback, handle_callback_2);
|
| +template<typename Constructor, typename Accessor>
|
| +static void TestFunctionTemplateAccessor(Constructor constructor,
|
| + Accessor accessor) {
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
|
|
| - TestFunctionTemplateAccessor(construct_call, Return239);
|
| - TestFunctionTemplateAccessor(construct_call_indirect, Return239Indirect);
|
| - TestFunctionTemplateAccessor(construct_callback, Return239Callback);
|
| + Local<v8::FunctionTemplate> fun_templ =
|
| + v8::FunctionTemplate::New(constructor);
|
| + fun_templ->SetClassName(v8_str("funky"));
|
| + fun_templ->InstanceTemplate()->SetAccessor(v8_str("m"), accessor);
|
| + Local<Function> fun = fun_templ->GetFunction();
|
| + env->Global()->Set(v8_str("obj"), fun);
|
| + Local<Value> result = v8_compile("(new obj()).toString()")->Run();
|
| + CHECK_EQ(v8_str("[object funky]"), result);
|
| + CompileRun("var obj_instance = new obj();");
|
| + Local<Script> script;
|
| + script = v8_compile("obj_instance.x");
|
| + for (int i = 0; i < 30; i++) {
|
| + CHECK_EQ(1, script->Run()->Int32Value());
|
| + }
|
| + script = v8_compile("obj_instance.m");
|
| + for (int i = 0; i < 30; i++) {
|
| + CHECK_EQ(239, script->Run()->Int32Value());
|
| + }
|
| }
|
|
|
|
|
| -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());
|
| +THREADED_PROFILED_TEST(FunctionTemplate) {
|
| + TestFunctionTemplateInitializer(handle_callback, handle_callback_2);
|
| + TestFunctionTemplateAccessor(construct_callback, Return239Callback);
|
| }
|
|
|
| -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();
|
| @@ -1067,41 +962,26 @@ static void SimpleCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
|
|
|
| template<typename Callback>
|
| static void TestSimpleCallback(Callback callback) {
|
| - for (int i = 0; i < 2; i++) {
|
| - bool is_profiling = i;
|
| - LocalContext env;
|
| - v8::HandleScope scope(env->GetIsolate());
|
| -
|
| - v8::CpuProfiler* cpu_profiler = env->GetIsolate()->GetCpuProfiler();
|
| - if (is_profiling) {
|
| - v8::Local<v8::String> profile_name = v8::String::New("my_profile1");
|
| - cpu_profiler->StartCpuProfiling(profile_name);
|
| - }
|
| -
|
| - v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New();
|
| - object_template->Set("callback", v8::FunctionTemplate::New(callback));
|
| - v8::Local<v8::Object> object = object_template->NewInstance();
|
| - (*env)->Global()->Set(v8_str("callback_object"), object);
|
| - v8::Handle<v8::Script> script;
|
| - script = v8_compile("callback_object.callback(17)");
|
| - for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(51424, script->Run()->Int32Value());
|
| - }
|
| - script = v8_compile("callback_object.callback(17, 24)");
|
| - for (int i = 0; i < 30; i++) {
|
| - CHECK_EQ(51425, script->Run()->Int32Value());
|
| - }
|
| + LocalContext env;
|
| + v8::HandleScope scope(env->GetIsolate());
|
|
|
| - if (is_profiling) {
|
| - cpu_profiler->DeleteAllCpuProfiles();
|
| - }
|
| + v8::Handle<v8::ObjectTemplate> object_template = v8::ObjectTemplate::New();
|
| + object_template->Set("callback", v8::FunctionTemplate::New(callback));
|
| + v8::Local<v8::Object> object = object_template->NewInstance();
|
| + (*env)->Global()->Set(v8_str("callback_object"), object);
|
| + v8::Handle<v8::Script> script;
|
| + script = v8_compile("callback_object.callback(17)");
|
| + for (int i = 0; i < 30; i++) {
|
| + CHECK_EQ(51424, script->Run()->Int32Value());
|
| + }
|
| + script = v8_compile("callback_object.callback(17, 24)");
|
| + for (int i = 0; i < 30; i++) {
|
| + CHECK_EQ(51425, script->Run()->Int32Value());
|
| }
|
| }
|
|
|
|
|
| -THREADED_TEST(SimpleCallback) {
|
| - TestSimpleCallback(SimpleDirectCallback);
|
| - TestSimpleCallback(SimpleIndirectCallback);
|
| +THREADED_PROFILED_TEST(SimpleCallback) {
|
| TestSimpleCallback(SimpleCallback);
|
| }
|
|
|
| @@ -1194,7 +1074,7 @@ Handle<Value> TestFastReturnValues() {
|
| return scope.Close(CompileRun("callback_object.callback()"));
|
| }
|
|
|
| -THREADED_TEST(FastReturnValues) {
|
| +THREADED_PROFILED_TEST(FastReturnValues) {
|
| LocalContext env;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::Value> value;
|
| @@ -1266,7 +1146,7 @@ THREADED_TEST(FunctionTemplateSetLength) {
|
| 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");
|
| @@ -1274,7 +1154,7 @@ THREADED_TEST(FunctionTemplateSetLength) {
|
| }
|
| {
|
| 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);
|
| @@ -1284,7 +1164,7 @@ THREADED_TEST(FunctionTemplateSetLength) {
|
| {
|
| // 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");
|
| @@ -1294,10 +1174,10 @@ THREADED_TEST(FunctionTemplateSetLength) {
|
|
|
|
|
| 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);
|
| }
|
|
|
|
|
| @@ -1675,15 +1555,16 @@ THREADED_TEST(Boolean) {
|
| }
|
|
|
|
|
| -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));
|
| }
|
|
|
|
|
| @@ -1729,15 +1610,16 @@ THREADED_TEST(ObjectTemplate) {
|
| }
|
|
|
|
|
| -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));
|
| }
|
|
|
|
|
| @@ -1800,75 +1682,73 @@ THREADED_TEST(DescriptorInheritance) {
|
| 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);
|
| }
|
|
|
| @@ -2109,12 +1989,13 @@ THREADED_TEST(NamedPropertyHandlerGetter) {
|
| 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));
|
| }
|
|
|
|
|
| @@ -2221,7 +2102,7 @@ void CheckThisNamedPropertyEnumerator(
|
| }
|
|
|
|
|
| -THREADED_TEST(PropertyHandlerInPrototype) {
|
| +THREADED_PROFILED_TEST(PropertyHandlerInPrototype) {
|
| LocalContext env;
|
| v8::HandleScope scope(env->GetIsolate());
|
|
|
| @@ -2270,23 +2151,22 @@ THREADED_TEST(PropertyHandlerInPrototype) {
|
| }
|
|
|
|
|
| -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
|
| }
|
|
|
|
|
| @@ -2321,27 +2201,29 @@ v8::Handle<Script> call_recursively_script;
|
| 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));
|
| }
|
|
|
|
|
| @@ -2364,18 +2246,20 @@ THREADED_TEST(DeepCrossLanguageRecursion) {
|
| }
|
|
|
|
|
| -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
|
| }
|
|
|
|
|
| @@ -2782,12 +2666,31 @@ THREADED_TEST(ArrayBuffer_External) {
|
| }
|
|
|
|
|
| +static void CheckDataViewIsNeutered(v8::Handle<v8::DataView> dv) {
|
| + CHECK_EQ(0, static_cast<int>(dv->ByteLength()));
|
| + CHECK_EQ(0, static_cast<int>(dv->ByteOffset()));
|
| +}
|
| +
|
| +
|
| static void CheckIsNeutered(v8::Handle<v8::TypedArray> ta) {
|
| CHECK_EQ(0, static_cast<int>(ta->ByteLength()));
|
| CHECK_EQ(0, static_cast<int>(ta->Length()));
|
| CHECK_EQ(0, static_cast<int>(ta->ByteOffset()));
|
| }
|
|
|
| +
|
| +static void CheckIsTypedArrayVarNeutered(const char* name) {
|
| + i::ScopedVector<char> source(1024);
|
| + i::OS::SNPrintF(source,
|
| + "%s.byteLength == 0 && %s.byteOffset == 0 && %s.length == 0",
|
| + name, name, name);
|
| + CHECK(CompileRun(source.start())->IsTrue());
|
| + v8::Handle<v8::TypedArray> ta =
|
| + v8::Handle<v8::TypedArray>::Cast(CompileRun(name));
|
| + CheckIsNeutered(ta);
|
| +}
|
| +
|
| +
|
| template <typename TypedArray, int kElementSize>
|
| static Handle<TypedArray> CreateAndCheck(Handle<v8::ArrayBuffer> ab,
|
| int byteOffset,
|
| @@ -2829,6 +2732,10 @@ THREADED_TEST(ArrayBuffer_NeuteringApi) {
|
| v8::Handle<v8::Float64Array> f64a =
|
| CreateAndCheck<v8::Float64Array, 8>(buffer, 8, 127);
|
|
|
| + v8::Handle<v8::DataView> dv = v8::DataView::New(buffer, 1, 1023);
|
| + CHECK_EQ(1, static_cast<int>(dv->ByteOffset()));
|
| + CHECK_EQ(1023, static_cast<int>(dv->ByteLength()));
|
| +
|
| ScopedArrayBufferContents contents(buffer->Externalize());
|
| buffer->Neuter();
|
| CHECK_EQ(0, static_cast<int>(buffer->ByteLength()));
|
| @@ -2841,6 +2748,7 @@ THREADED_TEST(ArrayBuffer_NeuteringApi) {
|
| CheckIsNeutered(i32a);
|
| CheckIsNeutered(f32a);
|
| CheckIsNeutered(f64a);
|
| + CheckDataViewIsNeutered(dv);
|
| }
|
|
|
| THREADED_TEST(ArrayBuffer_NeuteringScript) {
|
| @@ -2858,43 +2766,32 @@ THREADED_TEST(ArrayBuffer_NeuteringScript) {
|
| "var u32a = new Uint32Array(ab, 4, 255);"
|
| "var i32a = new Int32Array(ab, 4, 255);"
|
| "var f32a = new Float32Array(ab, 4, 255);"
|
| - "var f64a = new Float64Array(ab, 8, 127);");
|
| + "var f64a = new Float64Array(ab, 8, 127);"
|
| + "var dv = new DataView(ab, 1, 1023);");
|
|
|
| v8::Handle<v8::ArrayBuffer> ab =
|
| Local<v8::ArrayBuffer>::Cast(CompileRun("ab"));
|
|
|
| - v8::Handle<v8::Uint8Array> u8a =
|
| - v8::Handle<v8::Uint8Array>::Cast(CompileRun("u8a"));
|
| - v8::Handle<v8::Uint8ClampedArray> u8c =
|
| - v8::Handle<v8::Uint8ClampedArray>::Cast(CompileRun("u8c"));
|
| - v8::Handle<v8::Int8Array> i8a =
|
| - v8::Handle<v8::Int8Array>::Cast(CompileRun("i8a"));
|
| -
|
| - v8::Handle<v8::Uint16Array> u16a =
|
| - v8::Handle<v8::Uint16Array>::Cast(CompileRun("u16a"));
|
| - v8::Handle<v8::Int16Array> i16a =
|
| - v8::Handle<v8::Int16Array>::Cast(CompileRun("i16a"));
|
| - v8::Handle<v8::Uint32Array> u32a =
|
| - v8::Handle<v8::Uint32Array>::Cast(CompileRun("u32a"));
|
| - v8::Handle<v8::Int32Array> i32a =
|
| - v8::Handle<v8::Int32Array>::Cast(CompileRun("i32a"));
|
| - v8::Handle<v8::Float32Array> f32a =
|
| - v8::Handle<v8::Float32Array>::Cast(CompileRun("f32a"));
|
| - v8::Handle<v8::Float64Array> f64a =
|
| - v8::Handle<v8::Float64Array>::Cast(CompileRun("f64a"));
|
| + v8::Handle<v8::DataView> dv =
|
| + v8::Handle<v8::DataView>::Cast(CompileRun("dv"));
|
|
|
| ScopedArrayBufferContents contents(ab->Externalize());
|
| ab->Neuter();
|
| CHECK_EQ(0, static_cast<int>(ab->ByteLength()));
|
| - CheckIsNeutered(u8a);
|
| - CheckIsNeutered(u8c);
|
| - CheckIsNeutered(i8a);
|
| - CheckIsNeutered(u16a);
|
| - CheckIsNeutered(i16a);
|
| - CheckIsNeutered(u32a);
|
| - CheckIsNeutered(i32a);
|
| - CheckIsNeutered(f32a);
|
| - CheckIsNeutered(f64a);
|
| + CHECK_EQ(0, CompileRun("ab.byteLength")->Int32Value());
|
| +
|
| + CheckIsTypedArrayVarNeutered("u8a");
|
| + CheckIsTypedArrayVarNeutered("u8c");
|
| + CheckIsTypedArrayVarNeutered("i8a");
|
| + CheckIsTypedArrayVarNeutered("u16a");
|
| + CheckIsTypedArrayVarNeutered("i16a");
|
| + CheckIsTypedArrayVarNeutered("u32a");
|
| + CheckIsTypedArrayVarNeutered("i32a");
|
| + CheckIsTypedArrayVarNeutered("f32a");
|
| + CheckIsTypedArrayVarNeutered("f64a");
|
| +
|
| + CHECK(CompileRun("dv.byteLength == 0 && dv.byteOffset == 0")->IsTrue());
|
| + CheckDataViewIsNeutered(dv);
|
| }
|
|
|
|
|
| @@ -2980,10 +2877,9 @@ THREADED_TEST(Regress97784) {
|
|
|
|
|
| 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>();
|
| }
|
|
|
|
|
| @@ -3073,7 +2969,7 @@ THREADED_TEST(ResettingGlobalHandle) {
|
| }
|
| v8::internal::GlobalHandles* global_handles =
|
| reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
|
| - int initial_handle_count = global_handles->NumberOfGlobalHandles();
|
| + int initial_handle_count = global_handles->global_handles_count();
|
| {
|
| v8::HandleScope scope(isolate);
|
| CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
|
| @@ -3082,13 +2978,13 @@ THREADED_TEST(ResettingGlobalHandle) {
|
| v8::HandleScope scope(isolate);
|
| global.Reset(isolate, v8_str("longer"));
|
| }
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count);
|
| {
|
| v8::HandleScope scope(isolate);
|
| CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 6);
|
| }
|
| global.Dispose(isolate);
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
|
| }
|
|
|
|
|
| @@ -3101,7 +2997,7 @@ THREADED_TEST(ResettingGlobalHandleToEmpty) {
|
| }
|
| v8::internal::GlobalHandles* global_handles =
|
| reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
|
| - int initial_handle_count = global_handles->NumberOfGlobalHandles();
|
| + int initial_handle_count = global_handles->global_handles_count();
|
| {
|
| v8::HandleScope scope(isolate);
|
| CHECK_EQ(v8::Local<String>::New(isolate, global)->Length(), 3);
|
| @@ -3112,7 +3008,7 @@ THREADED_TEST(ResettingGlobalHandleToEmpty) {
|
| global.Reset(isolate, empty);
|
| }
|
| CHECK(global.IsEmpty());
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count - 1);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count - 1);
|
| }
|
|
|
|
|
| @@ -3126,15 +3022,15 @@ THREADED_TEST(ClearAndLeakGlobal) {
|
| Local<String> str = v8_str("str");
|
| global_handles =
|
| reinterpret_cast<v8::internal::Isolate*>(isolate)->global_handles();
|
| - initial_handle_count = global_handles->NumberOfGlobalHandles();
|
| + initial_handle_count = global_handles->global_handles_count();
|
| global.Reset(isolate, str);
|
| }
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
|
| String* str = global.ClearAndLeak();
|
| CHECK(global.IsEmpty());
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count + 1);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count + 1);
|
| global_handles->Destroy(reinterpret_cast<i::Object**>(str));
|
| - CHECK_EQ(global_handles->NumberOfGlobalHandles(), initial_handle_count);
|
| + CHECK_EQ(global_handles->global_handles_count(), initial_handle_count);
|
| }
|
|
|
|
|
| @@ -3703,13 +3599,13 @@ THREADED_TEST(Array) {
|
| }
|
|
|
|
|
| -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));
|
| }
|
|
|
|
|
| @@ -3833,7 +3729,7 @@ TEST(OutOfMemory) {
|
| }
|
|
|
|
|
| -v8::Handle<Value> ProvokeOutOfMemory(const v8::Arguments& args) {
|
| +void ProvokeOutOfMemory(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
|
|
| LocalContext context;
|
| @@ -3846,7 +3742,7 @@ v8::Handle<Value> ProvokeOutOfMemory(const v8::Arguments& args) {
|
| CHECK(result.IsEmpty());
|
| CHECK(context->HasOutOfMemoryException());
|
|
|
| - return result;
|
| + args.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| @@ -4119,19 +4015,22 @@ THREADED_TEST(ConversionException) {
|
| }
|
|
|
|
|
| -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());
|
| }
|
|
|
|
|
| @@ -4197,10 +4096,9 @@ static void check_reference_error_message(
|
| }
|
|
|
|
|
| -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();
|
| }
|
|
|
|
|
| @@ -4344,13 +4242,14 @@ THREADED_TEST(ExternalScriptException) {
|
|
|
|
|
|
|
| -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"));
|
| @@ -4369,15 +4268,17 @@ v8::Handle<Value> CThrowCountDown(const v8::Arguments& args) {
|
| } 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();
|
| @@ -4388,7 +4289,6 @@ v8::Handle<Value> JSCheck(const v8::Arguments& args) {
|
| } else {
|
| CHECK_NE(count, expected);
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -4483,11 +4383,10 @@ TEST(ExceptionOrder) {
|
| 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]);
|
| }
|
|
|
|
|
| @@ -4554,9 +4453,8 @@ THREADED_TEST(TryCatchAndFinallyHidingException) {
|
| }
|
|
|
|
|
| -v8::Handle<v8::Value> WithTryCatch(const v8::Arguments& args) {
|
| +void WithTryCatch(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::TryCatch try_catch;
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -4644,12 +4542,12 @@ THREADED_TEST(MultiRun) {
|
| }
|
|
|
|
|
| -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);
|
| }
|
|
|
|
|
| @@ -4886,12 +4784,12 @@ THREADED_TEST(DontDeleteAPIAccessorsCannotBeOverriden) {
|
| }
|
|
|
|
|
| -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);
|
| }
|
|
|
|
|
| @@ -4924,7 +4822,7 @@ v8::Persistent<Value> xValue;
|
|
|
| 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"));
|
| @@ -4971,7 +4869,7 @@ THREADED_TEST(NoAccessors) {
|
| 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;
|
| @@ -4983,11 +4881,11 @@ THREADED_TEST(NoAccessors) {
|
| }
|
|
|
|
|
| -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);
|
| }
|
|
|
|
|
| @@ -5076,12 +4974,12 @@ THREADED_TEST(NamedInterceptorDictionaryICMultipleContext) {
|
| }
|
|
|
|
|
| -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>();
|
| }
|
|
|
|
|
| @@ -5103,24 +5001,24 @@ THREADED_TEST(NamedInterceptorMapTransitionRead) {
|
| }
|
|
|
|
|
| -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>();
|
| }
|
|
|
|
|
| @@ -5154,38 +5052,36 @@ THREADED_TEST(IndexedInterceptorWithIndexedAccessor) {
|
| }
|
|
|
|
|
| -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));
|
| }
|
|
|
|
|
| @@ -5216,8 +5112,8 @@ THREADED_TEST(IndexedInterceptorUnboxedDoubleWithIndexedAccessor) {
|
| }
|
|
|
|
|
| -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) {"
|
| @@ -5231,18 +5127,17 @@ Handle<v8::Array> NonStrictArgsIndexedPropertyEnumerator(
|
| 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>();
|
| }
|
|
|
|
|
| @@ -5267,10 +5162,10 @@ THREADED_TEST(IndexedInterceptorNonStrictArgsWithIndexedAccessor) {
|
| }
|
|
|
|
|
| -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);
|
| }
|
|
|
|
|
| @@ -5841,9 +5736,9 @@ static inline void PersistentHandles(v8::Isolate* isolate) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> HandleLogDelegator(const v8::Arguments& args) {
|
| +static void HandleLogDelegator(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -6078,7 +5973,7 @@ class NativeFunctionExtension : public Extension {
|
| public:
|
| NativeFunctionExtension(const char* name,
|
| const char* source,
|
| - v8::InvocationCallback fun = &Echo)
|
| + v8::FunctionCallback fun = &Echo)
|
| : Extension(name, source),
|
| function_(fun) { }
|
|
|
| @@ -6087,12 +5982,11 @@ class NativeFunctionExtension : public Extension {
|
| 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_;
|
| };
|
|
|
|
|
| @@ -6189,13 +6083,14 @@ static const char* kExtensionTestScript =
|
| "}";
|
|
|
|
|
| -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());
|
| }
|
|
|
|
|
| @@ -6360,8 +6255,8 @@ static void HandleWeakReference(v8::Isolate* isolate,
|
| 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());
|
|
|
| @@ -6376,7 +6271,7 @@ v8::Handle<Value> WhammyPropertyGetter(Local<String> name,
|
| }
|
| 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) {
|
| @@ -6546,7 +6441,8 @@ THREADED_TEST(IndependentHandleRevival) {
|
| 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());
|
| @@ -6556,7 +6452,6 @@ static v8::Handle<Value> ArgumentsTestCallback(const v8::Arguments& args) {
|
| CHECK_EQ(v8::Undefined(), args[3]);
|
| v8::HandleScope scope(args.GetIsolate());
|
| HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -6570,34 +6465,33 @@ THREADED_TEST(Arguments) {
|
| }
|
|
|
|
|
| -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
|
| }
|
|
|
|
|
| @@ -6627,40 +6521,40 @@ THREADED_TEST(Deleter) {
|
| }
|
|
|
|
|
| -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();
|
| v8::Handle<v8::Array> result = v8::Array::New(3);
|
| result->Set(v8::Integer::New(0), v8_str("foo"));
|
| result->Set(v8::Integer::New(1), v8_str("bar"));
|
| result->Set(v8::Integer::New(2), v8_str("baz"));
|
| - return result;
|
| + info.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| -static v8::Handle<v8::Array> IndexedEnum(const AccessorInfo&) {
|
| +static void IndexedEnum(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| v8::Handle<v8::Array> result = v8::Array::New(2);
|
| result->Set(v8::Integer::New(0), v8_str("0"));
|
| result->Set(v8::Integer::New(1), v8_str("1"));
|
| - return result;
|
| + info.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| @@ -6725,7 +6619,8 @@ int p_getter_count;
|
| int p_getter_count2;
|
|
|
|
|
| -static v8::Handle<Value> PGetter(Local<String> name, const AccessorInfo& info) {
|
| +static void PGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| p_getter_count++;
|
| v8::Handle<v8::Object> global = Context::GetCurrent()->Global();
|
| @@ -6739,7 +6634,6 @@ static v8::Handle<Value> PGetter(Local<String> name, const AccessorInfo& info) {
|
| } else if (name->Equals(v8_str("p4"))) {
|
| CHECK_EQ(info.This(), global->Get(v8_str("o4")));
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -6759,8 +6653,8 @@ static void RunHolderTest(v8::Handle<v8::ObjectTemplate> obj) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> PGetter2(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void PGetter2(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| p_getter_count2++;
|
| v8::Handle<v8::Object> global = Context::GetCurrent()->Global();
|
| @@ -6774,7 +6668,6 @@ static v8::Handle<Value> PGetter2(Local<String> name,
|
| } else if (name->Equals(v8_str("p4"))) {
|
| CHECK_EQ(info.This(), global->Get(v8_str("o4")));
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -7368,15 +7261,16 @@ THREADED_TEST(ErrorConstruction) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> YGetter(Local<String> name, const AccessorInfo& info) {
|
| +static void YGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(10);
|
| + info.GetReturnValue().Set(v8_num(10));
|
| }
|
|
|
|
|
| static void YSetter(Local<String> name,
|
| Local<Value> value,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<void>& info) {
|
| if (info.This()->Has(name)) {
|
| info.This()->Delete(name);
|
| }
|
| @@ -7451,7 +7345,7 @@ static bool IndexedSecurityTestCallback(Local<v8::Object> global,
|
|
|
|
|
| static int trouble_nesting = 0;
|
| -static v8::Handle<Value> TroubleCallback(const v8::Arguments& args) {
|
| +static void TroubleCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| trouble_nesting++;
|
|
|
| @@ -7461,7 +7355,8 @@ static v8::Handle<Value> TroubleCallback(const v8::Arguments& args) {
|
| arg_this->Get(v8_str("trouble_callee")) :
|
| arg_this->Get(v8_str("trouble_caller"));
|
| CHECK(trouble_callee->IsFunction());
|
| - return Function::Cast(*trouble_callee)->Call(arg_this, 0, NULL);
|
| + args.GetReturnValue().Set(
|
| + Function::Cast(*trouble_callee)->Call(arg_this, 0, NULL));
|
| }
|
|
|
|
|
| @@ -7991,29 +7886,31 @@ static bool IndexedAccessBlocker(Local<v8::Object> global,
|
|
|
|
|
| static int g_echo_value = -1;
|
| -static v8::Handle<Value> EchoGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| - return v8_num(g_echo_value);
|
| +static void EchoGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(v8_num(g_echo_value));
|
| }
|
|
|
|
|
| static void EchoSetter(Local<String> name,
|
| Local<Value> value,
|
| - const AccessorInfo&) {
|
| + const v8::PropertyCallbackInfo<void>&) {
|
| if (value->IsNumber())
|
| g_echo_value = value->Int32Value();
|
| }
|
|
|
|
|
| -static v8::Handle<Value> UnreachableGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void UnreachableGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK(false); // This function should not be called..
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| -static void UnreachableSetter(Local<String>, Local<Value>,
|
| - const AccessorInfo&) {
|
| +static void UnreachableSetter(Local<String>,
|
| + Local<Value>,
|
| + const v8::PropertyCallbackInfo<void>&) {
|
| CHECK(false); // This function should nto be called.
|
| }
|
|
|
| @@ -8390,19 +8287,21 @@ THREADED_TEST(AccessControlGetOwnPropertyNames) {
|
| }
|
|
|
|
|
| -static v8::Handle<v8::Array> IndexedPropertyEnumerator(const AccessorInfo&) {
|
| +static void IndexedPropertyEnumerator(
|
| + const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| v8::Handle<v8::Array> result = v8::Array::New(2);
|
| result->Set(0, v8::Integer::New(7));
|
| result->Set(1, v8::Object::New());
|
| - return result;
|
| + info.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| -static v8::Handle<v8::Array> NamedPropertyEnumerator(const AccessorInfo& info) {
|
| +static void NamedPropertyEnumerator(
|
| + const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| v8::Handle<v8::Array> result = v8::Array::New(2);
|
| result->Set(0, v8_str("x"));
|
| result->Set(1, v8::Object::New());
|
| - return result;
|
| + info.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| @@ -8435,9 +8334,9 @@ THREADED_TEST(GetOwnPropertyNamesWithInterceptor) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ConstTenGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| - return v8_num(10);
|
| +static void ConstTenGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(v8_num(10));
|
| }
|
|
|
|
|
| @@ -8701,28 +8600,33 @@ THREADED_TEST(AccessControlFlatten) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> AccessControlNamedGetter(
|
| - Local<String>, const AccessorInfo&) {
|
| - return v8::Integer::New(42);
|
| +static void AccessControlNamedGetter(
|
| + Local<String>,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(42);
|
| }
|
|
|
|
|
| -static v8::Handle<Value> AccessControlNamedSetter(
|
| - Local<String>, Local<Value> value, const AccessorInfo&) {
|
| - return value;
|
| +static void AccessControlNamedSetter(
|
| + Local<String>,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(value);
|
| }
|
|
|
|
|
| -static v8::Handle<Value> AccessControlIndexedGetter(
|
| +static void AccessControlIndexedGetter(
|
| uint32_t index,
|
| - const AccessorInfo& info) {
|
| - return v8_num(42);
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| -static v8::Handle<Value> AccessControlIndexedSetter(
|
| - uint32_t, Local<Value> value, const AccessorInfo&) {
|
| - return value;
|
| +static void AccessControlIndexedSetter(
|
| + uint32_t,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(value);
|
| }
|
|
|
|
|
| @@ -8797,9 +8701,10 @@ THREADED_TEST(Version) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InstanceFunctionCallback(const v8::Arguments& args) {
|
| +static void InstanceFunctionCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(12);
|
| + args.GetReturnValue().Set(v8_num(12));
|
| }
|
|
|
|
|
| @@ -8825,10 +8730,10 @@ THREADED_TEST(InstanceProperties) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value>
|
| -GlobalObjectInstancePropertiesGet(Local<String> key, const AccessorInfo&) {
|
| +static void GlobalObjectInstancePropertiesGet(
|
| + Local<String> key,
|
| + const v8::PropertyCallbackInfo<v8::Value>&) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -8928,9 +8833,10 @@ THREADED_TEST(CallKnownGlobalReceiver) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ShadowFunctionCallback(const v8::Arguments& args) {
|
| +static void ShadowFunctionCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(42);
|
| + args.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| @@ -8939,29 +8845,29 @@ static int shadow_y_setter_call_count;
|
| static int shadow_y_getter_call_count;
|
|
|
|
|
| -static void ShadowYSetter(Local<String>, Local<Value>, const AccessorInfo&) {
|
| +static void ShadowYSetter(Local<String>,
|
| + Local<Value>,
|
| + const v8::PropertyCallbackInfo<void>&) {
|
| shadow_y_setter_call_count++;
|
| shadow_y = 42;
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ShadowYGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void ShadowYGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| shadow_y_getter_call_count++;
|
| - return v8_num(shadow_y);
|
| + info.GetReturnValue().Set(v8_num(shadow_y));
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ShadowIndexedGet(uint32_t index,
|
| - const AccessorInfo& info) {
|
| - return v8::Handle<Value>();
|
| +static void ShadowIndexedGet(uint32_t index,
|
| + const v8::PropertyCallbackInfo<v8::Value>&) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ShadowNamedGet(Local<String> key,
|
| - const AccessorInfo&) {
|
| - return v8::Handle<Value>();
|
| +static void ShadowNamedGet(Local<String> key,
|
| + const v8::PropertyCallbackInfo<v8::Value>&) {
|
| }
|
|
|
|
|
| @@ -9311,7 +9217,8 @@ THREADED_TEST(Constructor) {
|
| }
|
|
|
|
|
| -static Handle<Value> ConstructorCallback(const Arguments& args) {
|
| +static void ConstructorCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| Local<Object> This;
|
|
|
| @@ -9327,13 +9234,14 @@ static Handle<Value> ConstructorCallback(const Arguments& args) {
|
| }
|
|
|
| This->Set(v8_str("a"), args[0]);
|
| - return This;
|
| + args.GetReturnValue().Set(This);
|
| }
|
|
|
|
|
| -static Handle<Value> FakeConstructorCallback(const Arguments& args) {
|
| +static void FakeConstructorCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return args[0];
|
| + args.GetReturnValue().Set(args[0]);
|
| }
|
|
|
|
|
| @@ -9701,15 +9609,16 @@ THREADED_TEST(CrossLazyLoad) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> call_as_function(const v8::Arguments& args) {
|
| +static void call_as_function(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| if (args.IsConstructCall()) {
|
| if (args[0]->IsInt32()) {
|
| - return v8_num(-args[0]->Int32Value());
|
| + args.GetReturnValue().Set(v8_num(-args[0]->Int32Value()));
|
| + return;
|
| }
|
| }
|
|
|
| - return args[0];
|
| + args.GetReturnValue().Set(args[0]);
|
| }
|
|
|
|
|
| @@ -9913,11 +9822,10 @@ THREADED_TEST(HandleIteration) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InterceptorHasOwnPropertyGetter(
|
| +static void InterceptorHasOwnPropertyGetter(
|
| Local<String> name,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -9944,12 +9852,11 @@ THREADED_TEST(InterceptorHasOwnProperty) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InterceptorHasOwnPropertyGetterGC(
|
| +static void InterceptorHasOwnPropertyGetterGC(
|
| Local<String> name,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -9982,8 +9889,9 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) {
|
| }
|
|
|
|
|
| -typedef v8::Handle<Value> (*NamedPropertyGetter)(Local<String> property,
|
| - const AccessorInfo& info);
|
| +typedef void (*NamedPropertyGetter)(
|
| + Local<String> property,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info);
|
|
|
|
|
| static void CheckInterceptorLoadIC(NamedPropertyGetter getter,
|
| @@ -9999,14 +9907,15 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter,
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InterceptorLoadICGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorLoadICGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| CHECK_EQ(isolate, info.GetIsolate());
|
| CHECK_EQ(v8_str("data"), info.Data());
|
| CHECK_EQ(v8_str("x"), name);
|
| - return v8::Integer::New(42);
|
| + info.GetReturnValue().Set(v8::Integer::New(42));
|
| }
|
|
|
|
|
| @@ -10025,11 +9934,14 @@ THREADED_TEST(InterceptorLoadIC) {
|
| // configurations of interceptor and explicit fields works fine
|
| // (those cases are special cased to get better performance).
|
|
|
| -static v8::Handle<Value> InterceptorLoadXICGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorLoadXICGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_str("x")->Equals(name)
|
| - ? v8::Handle<v8::Value>(v8::Integer::New(42)) : v8::Handle<v8::Value>();
|
| + info.GetReturnValue().Set(
|
| + v8_str("x")->Equals(name) ?
|
| + v8::Handle<v8::Value>(v8::Integer::New(42)) :
|
| + v8::Handle<v8::Value>());
|
| }
|
|
|
|
|
| @@ -10138,10 +10050,10 @@ THREADED_TEST(InterceptorLoadICInvalidatedField) {
|
|
|
|
|
| static int interceptor_load_not_handled_calls = 0;
|
| -static v8::Handle<Value> InterceptorLoadNotHandled(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorLoadNotHandled(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ++interceptor_load_not_handled_calls;
|
| - return v8::Handle<v8::Value>();
|
| }
|
|
|
|
|
| @@ -10192,7 +10104,7 @@ THREADED_TEST(InterceptorLoadICInvalidatedFieldViaGlobal) {
|
|
|
| static void SetOnThis(Local<String> name,
|
| Local<Value> value,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<void>& info) {
|
| info.This()->ForceSet(name, value);
|
| }
|
|
|
| @@ -10201,7 +10113,7 @@ THREADED_TEST(InterceptorLoadICWithCallbackOnHolder) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
|
| templ->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| - templ->SetAccessor(v8_str("y"), Return239);
|
| + templ->SetAccessor(v8_str("y"), Return239Callback);
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ->NewInstance());
|
|
|
| @@ -10231,7 +10143,7 @@ THREADED_TEST(InterceptorLoadICWithCallbackOnProto) {
|
| v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New();
|
| templ_o->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New();
|
| - templ_p->SetAccessor(v8_str("y"), Return239);
|
| + templ_p->SetAccessor(v8_str("y"), Return239Callback);
|
|
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ_o->NewInstance());
|
| @@ -10263,7 +10175,7 @@ THREADED_TEST(InterceptorLoadICForCallbackWithOverride) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
|
| templ->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| - templ->SetAccessor(v8_str("y"), Return239);
|
| + templ->SetAccessor(v8_str("y"), Return239Callback);
|
|
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ->NewInstance());
|
| @@ -10292,7 +10204,7 @@ THREADED_TEST(InterceptorLoadICCallbackNotNeeded) {
|
| v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New();
|
| templ_o->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New();
|
| - templ_p->SetAccessor(v8_str("y"), Return239);
|
| + templ_p->SetAccessor(v8_str("y"), Return239Callback);
|
|
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ_o->NewInstance());
|
| @@ -10320,7 +10232,7 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallback) {
|
| v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New();
|
| templ_o->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New();
|
| - templ_p->SetAccessor(v8_str("y"), Return239, SetOnThis);
|
| + templ_p->SetAccessor(v8_str("y"), Return239Callback, SetOnThis);
|
|
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ_o->NewInstance());
|
| @@ -10352,7 +10264,7 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) {
|
| v8::Handle<v8::ObjectTemplate> templ_o = ObjectTemplate::New();
|
| templ_o->SetNamedPropertyHandler(InterceptorLoadXICGetter);
|
| v8::Handle<v8::ObjectTemplate> templ_p = ObjectTemplate::New();
|
| - templ_p->SetAccessor(v8_str("y"), Return239, SetOnThis);
|
| + templ_p->SetAccessor(v8_str("y"), Return239Callback, SetOnThis);
|
|
|
| LocalContext context;
|
| context->Global()->Set(v8_str("o"), templ_o->NewInstance());
|
| @@ -10375,11 +10287,12 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InterceptorLoadICGetter0(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorLoadICGetter0(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| CHECK(v8_str("x")->Equals(name));
|
| - return v8::Integer::New(0);
|
| + info.GetReturnValue().Set(v8::Integer::New(0));
|
| }
|
|
|
|
|
| @@ -10390,11 +10303,13 @@ THREADED_TEST(InterceptorReturningZero) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> InterceptorStoreICSetter(
|
| - Local<String> key, Local<Value> value, const AccessorInfo&) {
|
| +static void InterceptorStoreICSetter(
|
| + Local<String> key,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK(v8_str("x")->Equals(key));
|
| CHECK_EQ(42, value->Int32Value());
|
| - return value;
|
| + info.GetReturnValue().Set(value);
|
| }
|
|
|
|
|
| @@ -10435,11 +10350,12 @@ v8::Handle<Value> call_ic_function;
|
| v8::Handle<Value> call_ic_function2;
|
| v8::Handle<Value> call_ic_function3;
|
|
|
| -static v8::Handle<Value> InterceptorCallICGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorCallICGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| CHECK(v8_str("x")->Equals(name));
|
| - return call_ic_function;
|
| + info.GetReturnValue().Set(call_ic_function);
|
| }
|
|
|
|
|
| @@ -10480,11 +10396,12 @@ THREADED_TEST(InterceptorCallICSeesOthers) {
|
|
|
|
|
| static v8::Handle<Value> call_ic_function4;
|
| -static v8::Handle<Value> InterceptorCallICGetter4(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorCallICGetter4(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| CHECK(v8_str("x")->Equals(name));
|
| - return call_ic_function4;
|
| + info.GetReturnValue().Set(call_ic_function4);
|
| }
|
|
|
|
|
| @@ -10557,13 +10474,12 @@ THREADED_TEST(InterceptorCallICConstantFunctionUsed) {
|
|
|
|
|
| static v8::Handle<Value> call_ic_function5;
|
| -static v8::Handle<Value> InterceptorCallICGetter5(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorCallICGetter5(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (v8_str("x")->Equals(name))
|
| - return call_ic_function5;
|
| - else
|
| - return Local<Value>();
|
| + info.GetReturnValue().Set(call_ic_function5);
|
| }
|
|
|
|
|
| @@ -10591,13 +10507,12 @@ THREADED_TEST(InterceptorCallICConstantFunctionNotNeeded) {
|
|
|
|
|
| static v8::Handle<Value> call_ic_function6;
|
| -static v8::Handle<Value> InterceptorCallICGetter6(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorCallICGetter6(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (v8_str("x")->Equals(name))
|
| - return call_ic_function6;
|
| - else
|
| - return Local<Value>();
|
| + info.GetReturnValue().Set(call_ic_function6);
|
| }
|
|
|
|
|
| @@ -10716,8 +10631,9 @@ THREADED_TEST(InterceptorCallICCachedFromGlobal) {
|
| CHECK_EQ(239 * 10, value->Int32Value());
|
| }
|
|
|
| -static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorCallICFastApi(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| CheckReturnValue(info, FUNCTION_ADDR(InterceptorCallICFastApi));
|
| int* call_count =
|
| @@ -10726,22 +10642,21 @@ static v8::Handle<Value> InterceptorCallICFastApi(Local<String> name,
|
| if ((*call_count) % 20 == 0) {
|
| HEAP->CollectAllGarbage(i::Heap::kNoGCFlags);
|
| }
|
| - return v8::Handle<Value>();
|
| }
|
|
|
| -static v8::Handle<Value> FastApiCallback_TrivialSignature(
|
| - const v8::Arguments& args) {
|
| +static void FastApiCallback_TrivialSignature(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_TrivialSignature));
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| CHECK_EQ(isolate, args.GetIsolate());
|
| CHECK_EQ(args.This(), args.Holder());
|
| CHECK(args.Data()->Equals(v8_str("method_data")));
|
| - return v8::Integer::New(args[0]->Int32Value() + 1);
|
| + args.GetReturnValue().Set(args[0]->Int32Value() + 1);
|
| }
|
|
|
| -static v8::Handle<Value> FastApiCallback_SimpleSignature(
|
| - const v8::Arguments& args) {
|
| +static void FastApiCallback_SimpleSignature(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_SimpleSignature));
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| @@ -10751,7 +10666,7 @@ static v8::Handle<Value> FastApiCallback_SimpleSignature(
|
| // Note, we're using HasRealNamedProperty instead of Has to avoid
|
| // invoking the interceptor again.
|
| CHECK(args.Holder()->HasRealNamedProperty(v8_str("foo")));
|
| - return v8::Integer::New(args[0]->Int32Value() + 1);
|
| + args.GetReturnValue().Set(args[0]->Int32Value() + 1);
|
| }
|
|
|
| // Helper to maximize the odds of object moving.
|
| @@ -10765,14 +10680,13 @@ static void GenerateSomeGarbage() {
|
| }
|
|
|
|
|
| -v8::Handle<v8::Value> DirectApiCallback(const v8::Arguments& args) {
|
| +void DirectApiCallback(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| static int count = 0;
|
| if (count++ % 3 == 0) {
|
| HEAP->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask);
|
| // This should move the stub
|
| GenerateSomeGarbage(); // This should ensure the old stub memory is flushed
|
| }
|
| - return v8::Handle<v8::Value>();
|
| }
|
|
|
|
|
| @@ -10795,8 +10709,9 @@ THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) {
|
| }
|
|
|
|
|
| -v8::Handle<v8::Value> ThrowingDirectApiCallback(const v8::Arguments& args) {
|
| - return v8::ThrowException(v8_str("g"));
|
| +void ThrowingDirectApiCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| + v8::ThrowException(v8_str("g"));
|
| }
|
|
|
|
|
| @@ -10829,21 +10744,6 @@ static Handle<Value> DoDirectGetter() {
|
| return v8_str("Direct Getter Result");
|
| }
|
|
|
| -static v8::Handle<v8::Value> DirectGetter(Local<String> name,
|
| - const v8::AccessorInfo& info) {
|
| - CheckReturnValue(info, FUNCTION_ADDR(DirectGetter));
|
| - info.GetReturnValue().Set(v8_str("Garbage"));
|
| - return DoDirectGetter();
|
| -}
|
| -
|
| -static v8::Handle<v8::Value> DirectGetterIndirect(
|
| - Local<String> name,
|
| - const v8::AccessorInfo& info) {
|
| - CheckReturnValue(info, FUNCTION_ADDR(DirectGetterIndirect));
|
| - info.GetReturnValue().Set(DoDirectGetter());
|
| - return v8::Handle<v8::Value>();
|
| -}
|
| -
|
| static void DirectGetterCallback(
|
| Local<String> name,
|
| const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| @@ -10870,16 +10770,15 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
|
| CHECK_EQ(31, p_getter_count);
|
| }
|
|
|
| -THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
|
| - LoadICFastApi_DirectCall_GCMoveStub(DirectGetterIndirect);
|
| +THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
|
| LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback);
|
| - LoadICFastApi_DirectCall_GCMoveStub(DirectGetter);
|
| }
|
|
|
|
|
| -v8::Handle<v8::Value> ThrowingDirectGetterCallback(
|
| - Local<String> name, const v8::AccessorInfo& info) {
|
| - return v8::ThrowException(v8_str("g"));
|
| +void ThrowingDirectGetterCallback(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + v8::ThrowException(v8_str("g"));
|
| }
|
|
|
|
|
| @@ -10899,7 +10798,7 @@ THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
|
| }
|
|
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -10926,7 +10825,7 @@ THREADED_TEST(InterceptorCallICFastApi_TrivialSignature) {
|
| CHECK_EQ(100, interceptor_call_count);
|
| }
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -10957,7 +10856,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature) {
|
| CHECK_EQ(100, interceptor_call_count);
|
| }
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -10994,7 +10893,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
|
| CHECK_GE(interceptor_call_count, 50);
|
| }
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -11031,7 +10930,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
|
| CHECK_GE(interceptor_call_count, 50);
|
| }
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -11071,7 +10970,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
|
| CHECK_GE(interceptor_call_count, 50);
|
| }
|
|
|
| -THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
|
| +THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
|
| int interceptor_call_count = 0;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| @@ -11111,7 +11010,7 @@ THREADED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
|
| CHECK_GE(interceptor_call_count, 50);
|
| }
|
|
|
| -THREADED_TEST(CallICFastApi_TrivialSignature) {
|
| +THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| v8::Handle<v8::FunctionTemplate> method_templ =
|
| @@ -11135,7 +11034,7 @@ THREADED_TEST(CallICFastApi_TrivialSignature) {
|
| CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
|
| }
|
|
|
| -THREADED_TEST(CallICFastApi_SimpleSignature) {
|
| +THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| v8::Handle<v8::FunctionTemplate> method_templ =
|
| @@ -11163,7 +11062,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature) {
|
| CHECK_EQ(42, context->Global()->Get(v8_str("result"))->Int32Value());
|
| }
|
|
|
| -THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
|
| +THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| v8::Handle<v8::FunctionTemplate> method_templ =
|
| @@ -11196,7 +11095,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss1) {
|
| CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
|
| }
|
|
|
| -THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
|
| +THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| v8::Handle<v8::FunctionTemplate> method_templ =
|
| @@ -11232,7 +11131,7 @@ THREADED_TEST(CallICFastApi_SimpleSignature_Miss2) {
|
| CHECK_EQ(42, context->Global()->Get(v8_str("saved_result"))->Int32Value());
|
| }
|
|
|
| -THREADED_TEST(CallICFastApi_SimpleSignature_TypeError) {
|
| +THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::FunctionTemplate> fun_templ = v8::FunctionTemplate::New();
|
| v8::Handle<v8::FunctionTemplate> method_templ =
|
| @@ -11271,13 +11170,13 @@ THREADED_TEST(CallICFastApi_SimpleSignature_TypeError) {
|
|
|
| v8::Handle<Value> keyed_call_ic_function;
|
|
|
| -static v8::Handle<Value> InterceptorKeyedCallICGetter(
|
| - Local<String> name, const AccessorInfo& info) {
|
| +static void InterceptorKeyedCallICGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (v8_str("x")->Equals(name)) {
|
| - return keyed_call_ic_function;
|
| + info.GetReturnValue().Set(keyed_call_ic_function);
|
| }
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -11428,13 +11327,13 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) {
|
|
|
| static int interceptor_call_count = 0;
|
|
|
| -static v8::Handle<Value> InterceptorICRefErrorGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InterceptorICRefErrorGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (v8_str("x")->Equals(name) && interceptor_call_count++ < 20) {
|
| - return call_ic_function2;
|
| + info.GetReturnValue().Set(call_ic_function2);
|
| }
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -11471,18 +11370,17 @@ THREADED_TEST(InterceptorICReferenceErrors) {
|
|
|
| static int interceptor_ic_exception_get_count = 0;
|
|
|
| -static v8::Handle<Value> InterceptorICExceptionGetter(
|
| +static void InterceptorICExceptionGetter(
|
| Local<String> name,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (v8_str("x")->Equals(name) && ++interceptor_ic_exception_get_count < 20) {
|
| - return call_ic_function3;
|
| + info.GetReturnValue().Set(call_ic_function3);
|
| }
|
| if (interceptor_ic_exception_get_count == 20) {
|
| - return v8::ThrowException(v8_num(42));
|
| + v8::ThrowException(v8_num(42));
|
| + return;
|
| }
|
| - // Do not handle get for properties other than x.
|
| - return v8::Handle<Value>();
|
| }
|
|
|
| // Test interceptor load/call IC where the interceptor throws an
|
| @@ -11518,14 +11416,14 @@ THREADED_TEST(InterceptorICGetterExceptions) {
|
|
|
| static int interceptor_ic_exception_set_count = 0;
|
|
|
| -static v8::Handle<Value> InterceptorICExceptionSetter(
|
| - Local<String> key, Local<Value> value, const AccessorInfo&) {
|
| +static void InterceptorICExceptionSetter(
|
| + Local<String> key,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| if (++interceptor_ic_exception_set_count > 20) {
|
| - return v8::ThrowException(v8_num(42));
|
| + v8::ThrowException(v8_num(42));
|
| }
|
| - // Do not actually handle setting.
|
| - return v8::Handle<Value>();
|
| }
|
|
|
| // Test interceptor store IC where the interceptor throws an exception
|
| @@ -11552,7 +11450,8 @@ THREADED_TEST(InterceptorICSetterExceptions) {
|
| THREADED_TEST(NullNamedInterceptor) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
|
| - templ->SetNamedPropertyHandler(static_cast<v8::NamedPropertyGetter>(0));
|
| + templ->SetNamedPropertyHandler(
|
| + static_cast<v8::NamedPropertyGetterCallback>(0));
|
| LocalContext context;
|
| templ->Set("x", v8_num(42));
|
| v8::Handle<v8::Object> obj = templ->NewInstance();
|
| @@ -11567,7 +11466,8 @@ THREADED_TEST(NullNamedInterceptor) {
|
| THREADED_TEST(NullIndexedInterceptor) {
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
| v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New();
|
| - templ->SetIndexedPropertyHandler(static_cast<v8::IndexedPropertyGetter>(0));
|
| + templ->SetIndexedPropertyHandler(
|
| + static_cast<v8::IndexedPropertyGetterCallback>(0));
|
| LocalContext context;
|
| templ->Set("42", v8_num(42));
|
| v8::Handle<v8::Object> obj = templ->NewInstance();
|
| @@ -11590,11 +11490,11 @@ THREADED_TEST(NamedPropertyHandlerGetterAttributes) {
|
| }
|
|
|
|
|
| -static Handle<Value> ThrowingGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void ThrowingGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| ThrowException(Handle<Value>());
|
| - return Undefined();
|
| + info.GetReturnValue().SetUndefined();
|
| }
|
|
|
|
|
| @@ -11651,7 +11551,8 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) {
|
| }
|
|
|
|
|
| -static Handle<Value> ThrowingCallbackWithTryCatch(const Arguments& args) {
|
| +static void ThrowingCallbackWithTryCatch(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| TryCatch try_catch;
|
| // Verboseness is important: it triggers message delivery which can call into
|
| // external code.
|
| @@ -11660,7 +11561,6 @@ static Handle<Value> ThrowingCallbackWithTryCatch(const Arguments& args) {
|
| CHECK(try_catch.HasCaught());
|
| CHECK(!i::Isolate::Current()->has_pending_exception());
|
| CHECK(!i::Isolate::Current()->has_scheduled_exception());
|
| - return Undefined();
|
| }
|
|
|
|
|
| @@ -11718,17 +11618,17 @@ THREADED_TEST(ExceptionsDoNotPropagatePastTryCatch) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ParentGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void ParentGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(1);
|
| + info.GetReturnValue().Set(v8_num(1));
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ChildGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void ChildGetter(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(42);
|
| + info.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| @@ -11790,9 +11690,10 @@ THREADED_TEST(Overriding) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> IsConstructHandler(const v8::Arguments& args) {
|
| +static void IsConstructHandler(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Boolean::New(args.IsConstructCall());
|
| + args.GetReturnValue().Set(args.IsConstructCall());
|
| }
|
|
|
|
|
| @@ -12033,7 +11934,7 @@ void ApiTestFuzzer::CallTest() {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ThrowInJS(const v8::Arguments& args) {
|
| +static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
| ApiTestFuzzer::Fuzz();
|
| v8::Unlocker unlocker(CcTest::default_isolate());
|
| @@ -12051,12 +11952,12 @@ static v8::Handle<Value> ThrowInJS(const v8::Arguments& args) {
|
| // when the TryCatch is destroyed.
|
| exception = Local<Value>::New(try_catch.Exception());
|
| }
|
| - return v8::ThrowException(exception);
|
| + v8::ThrowException(exception);
|
| }
|
| }
|
|
|
|
|
| -static v8::Handle<Value> ThrowInJSNoCatch(const v8::Arguments& args) {
|
| +static void ThrowInJSNoCatch(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| CHECK(v8::Locker::IsLocked(CcTest::default_isolate()));
|
| ApiTestFuzzer::Fuzz();
|
| v8::Unlocker unlocker(CcTest::default_isolate());
|
| @@ -12066,7 +11967,7 @@ static v8::Handle<Value> ThrowInJSNoCatch(const v8::Arguments& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| v8::Handle<Value> value = CompileRun(code);
|
| CHECK(value.IsEmpty());
|
| - return scope.Close(v8_str("foo"));
|
| + args.GetReturnValue().Set(v8_str("foo"));
|
| }
|
| }
|
|
|
| @@ -12124,10 +12025,9 @@ THREADED_TEST(RecursiveLocking) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> UnlockForAMoment(const v8::Arguments& args) {
|
| +static void UnlockForAMoment(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| v8::Unlocker unlocker(CcTest::default_isolate());
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -12885,9 +12785,10 @@ THREADED_TEST(CompilationCache) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> FunctionNameCallback(const v8::Arguments& args) {
|
| +static void FunctionNameCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8_num(42);
|
| + args.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| @@ -14056,28 +13957,27 @@ static int force_set_set_count = 0;
|
| static int force_set_get_count = 0;
|
| bool pass_on_get = false;
|
|
|
| -static v8::Handle<v8::Value> ForceSetGetter(v8::Local<v8::String> name,
|
| - const v8::AccessorInfo& info) {
|
| +static void ForceSetGetter(v8::Local<v8::String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| force_set_get_count++;
|
| if (pass_on_get) {
|
| - return v8::Handle<v8::Value>();
|
| - } else {
|
| - return v8::Int32::New(3);
|
| + return;
|
| }
|
| + info.GetReturnValue().Set(3);
|
| }
|
|
|
| static void ForceSetSetter(v8::Local<v8::String> name,
|
| v8::Local<v8::Value> value,
|
| - const v8::AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<void>& info) {
|
| force_set_set_count++;
|
| }
|
|
|
| -static v8::Handle<v8::Value> ForceSetInterceptSetter(
|
| +static void ForceSetInterceptSetter(
|
| v8::Local<v8::String> name,
|
| v8::Local<v8::Value> value,
|
| - const v8::AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| force_set_set_count++;
|
| - return v8::Undefined();
|
| + info.GetReturnValue().SetUndefined();
|
| }
|
|
|
| TEST(ForceSet) {
|
| @@ -14191,15 +14091,12 @@ static int force_delete_interceptor_count = 0;
|
| static bool pass_on_delete = false;
|
|
|
|
|
| -static v8::Handle<v8::Boolean> ForceDeleteDeleter(
|
| +static void ForceDeleteDeleter(
|
| v8::Local<v8::String> name,
|
| - const v8::AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Boolean>& info) {
|
| force_delete_interceptor_count++;
|
| - if (pass_on_delete) {
|
| - return v8::Handle<v8::Boolean>();
|
| - } else {
|
| - return v8::True();
|
| - }
|
| + if (pass_on_delete) return;
|
| + info.GetReturnValue().Set(true);
|
| }
|
|
|
|
|
| @@ -14305,13 +14202,26 @@ static v8::Local<Context> calling_context2;
|
| // Check that the call to the callback is initiated in
|
| // calling_context2, the directly calling context is calling_context1
|
| // and the callback itself is in calling_context0.
|
| -static v8::Handle<Value> GetCallingContextCallback(const v8::Arguments& args) {
|
| +static void GetCallingContextCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| ApiTestFuzzer::Fuzz();
|
| CHECK(Context::GetCurrent() == calling_context0);
|
| CHECK(args.GetIsolate()->GetCurrentContext() == calling_context0);
|
| CHECK(Context::GetCalling() == calling_context1);
|
| CHECK(Context::GetEntered() == calling_context2);
|
| - return v8::Integer::New(42);
|
| + args.GetReturnValue().Set(42);
|
| +}
|
| +
|
| +
|
| +THREADED_TEST(GetCurrentContextWhenNotInContext) {
|
| + i::Isolate* isolate = i::Isolate::Current();
|
| + CHECK(isolate != NULL);
|
| + CHECK(isolate->context() == NULL);
|
| + v8::Isolate* v8_isolate = reinterpret_cast<v8::Isolate*>(isolate);
|
| + v8::HandleScope scope(v8_isolate);
|
| + // The following should not crash, but return an empty handle.
|
| + v8::Local<v8::Context> current = v8_isolate->GetCurrentContext();
|
| + CHECK(current.IsEmpty());
|
| }
|
|
|
|
|
| @@ -14817,20 +14727,18 @@ THREADED_TEST(PixelArrayInfo) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> NotHandledIndexedPropertyGetter(
|
| +static void NotHandledIndexedPropertyGetter(
|
| uint32_t index,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| -static v8::Handle<Value> NotHandledIndexedPropertySetter(
|
| +static void NotHandledIndexedPropertySetter(
|
| uint32_t index,
|
| Local<Value> value,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| ApiTestFuzzer::Fuzz();
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -15561,8 +15469,6 @@ template <typename ElementType, typename TypedArray,
|
| void TypedArrayTestHelper(v8::ExternalArrayType array_type,
|
| int64_t low, int64_t high) {
|
| const int kElementCount = 50;
|
| - i::FLAG_harmony_array_buffer = true;
|
| - i::FLAG_harmony_typed_arrays = true;
|
|
|
| i::ScopedVector<ElementType> backing_store(kElementCount+2);
|
|
|
| @@ -15646,8 +15552,27 @@ THREADED_TEST(Uint8ClampedArray) {
|
| }
|
|
|
|
|
| -#define IS_TYPED_ARRAY_TEST(TypedArray) \
|
| - THREADED_TEST(Is##TypedArray) { \
|
| +THREADED_TEST(DataView) {
|
| + const int kSize = 50;
|
| +
|
| + i::ScopedVector<uint8_t> backing_store(kSize+2);
|
| +
|
| + LocalContext env;
|
| + v8::Isolate* isolate = env->GetIsolate();
|
| + v8::HandleScope handle_scope(isolate);
|
| +
|
| + Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(
|
| + backing_store.start(), 2 + kSize);
|
| + Local<v8::DataView> dv =
|
| + v8::DataView::New(ab, 2, kSize);
|
| + CHECK_EQ(2, static_cast<int>(dv->ByteOffset()));
|
| + CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
|
| + CHECK_EQ(ab, dv->Buffer());
|
| +}
|
| +
|
| +
|
| +#define IS_ARRAY_BUFFER_VIEW_TEST(View) \
|
| + THREADED_TEST(Is##View) { \
|
| i::FLAG_harmony_array_buffer = true; \
|
| i::FLAG_harmony_typed_arrays = true; \
|
| LocalContext env; \
|
| @@ -15656,21 +15581,23 @@ THREADED_TEST(Uint8ClampedArray) {
|
| \
|
| Handle<Value> result = CompileRun( \
|
| "var ab = new ArrayBuffer(128);" \
|
| - "new " #TypedArray "(ab)"); \
|
| - CHECK(result->Is##TypedArray()); \
|
| + "new " #View "(ab)"); \
|
| + CHECK(result->IsArrayBufferView()); \
|
| + CHECK(result->Is##View()); \
|
| }
|
|
|
| -IS_TYPED_ARRAY_TEST(Uint8Array)
|
| -IS_TYPED_ARRAY_TEST(Int8Array)
|
| -IS_TYPED_ARRAY_TEST(Uint16Array)
|
| -IS_TYPED_ARRAY_TEST(Int16Array)
|
| -IS_TYPED_ARRAY_TEST(Uint32Array)
|
| -IS_TYPED_ARRAY_TEST(Int32Array)
|
| -IS_TYPED_ARRAY_TEST(Float32Array)
|
| -IS_TYPED_ARRAY_TEST(Float64Array)
|
| -IS_TYPED_ARRAY_TEST(Uint8ClampedArray)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Uint8Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Int8Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Uint16Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Int16Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Uint32Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Int32Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Float32Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Float64Array)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(Uint8ClampedArray)
|
| +IS_ARRAY_BUFFER_VIEW_TEST(DataView)
|
|
|
| -#undef IS_TYPED_ARRAY_TEST
|
| +#undef IS_ARRAY_BUFFER_VIEW_TEST
|
|
|
|
|
|
|
| @@ -15726,7 +15653,7 @@ void checkStackFrame(const char* expected_script_name,
|
| }
|
|
|
|
|
| -v8::Handle<Value> AnalyzeStackInNativeCode(const v8::Arguments& args) {
|
| +void AnalyzeStackInNativeCode(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| const char* origin = "capture-stack-trace-test";
|
| const int kOverviewTest = 1;
|
| @@ -15774,7 +15701,6 @@ v8::Handle<Value> AnalyzeStackInNativeCode(const v8::Arguments& args) {
|
|
|
| CHECK(stackTrace->AsArray()->IsArray());
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -16013,7 +15939,8 @@ TEST(RethrowBogusErrorStackTrace) {
|
| }
|
|
|
|
|
| -v8::Handle<Value> AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) {
|
| +void AnalyzeStackOfEvalWithSourceURL(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| v8::Handle<v8::StackTrace> stackTrace =
|
| v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
|
| @@ -16025,7 +15952,6 @@ v8::Handle<Value> AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) {
|
| CHECK(!name.IsEmpty());
|
| CHECK_EQ(url, name);
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -16057,8 +15983,8 @@ TEST(SourceURLInStackTrace) {
|
| }
|
|
|
|
|
| -v8::Handle<Value> AnalyzeStackOfInlineScriptWithSourceURL(
|
| - const v8::Arguments& args) {
|
| +void AnalyzeStackOfInlineScriptWithSourceURL(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| v8::Handle<v8::StackTrace> stackTrace =
|
| v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
|
| @@ -16070,7 +15996,6 @@ v8::Handle<Value> AnalyzeStackOfInlineScriptWithSourceURL(
|
| CHECK(!name.IsEmpty());
|
| CHECK_EQ(url, name);
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -16103,8 +16028,8 @@ TEST(InlineScriptWithSourceURLInStackTrace) {
|
| }
|
|
|
|
|
| -v8::Handle<Value> AnalyzeStackOfDynamicScriptWithSourceURL(
|
| - const v8::Arguments& args) {
|
| +void AnalyzeStackOfDynamicScriptWithSourceURL(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| v8::Handle<v8::StackTrace> stackTrace =
|
| v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed);
|
| @@ -16116,7 +16041,6 @@ v8::Handle<Value> AnalyzeStackOfDynamicScriptWithSourceURL(
|
| CHECK(!name.IsEmpty());
|
| CHECK_EQ(url, name);
|
| }
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -16252,10 +16176,10 @@ TEST(Regress2107) {
|
|
|
| static uint32_t* stack_limit;
|
|
|
| -static v8::Handle<Value> GetStackLimitCallback(const v8::Arguments& args) {
|
| +static void GetStackLimitCallback(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| stack_limit = reinterpret_cast<uint32_t*>(
|
| i::Isolate::Current()->stack_guard()->real_climit());
|
| - return v8::Undefined();
|
| }
|
|
|
|
|
| @@ -16524,14 +16448,14 @@ THREADED_TEST(QuietSignalingNaNs) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> SpaghettiIncident(const v8::Arguments& args) {
|
| +static void SpaghettiIncident(
|
| + const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| v8::HandleScope scope(args.GetIsolate());
|
| v8::TryCatch tc;
|
| v8::Handle<v8::String> str(args[0]->ToString());
|
| USE(str);
|
| if (tc.HasCaught())
|
| - return tc.ReThrow();
|
| - return v8::Undefined();
|
| + tc.ReThrow();
|
| }
|
|
|
|
|
| @@ -16735,40 +16659,42 @@ THREADED_TEST(FunctionGetScriptId) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> GetterWhichReturns42(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void GetterWhichReturns42(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
| CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
| - return v8_num(42);
|
| + info.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| -static void SetterWhichSetsYOnThisTo23(Local<String> name,
|
| - Local<Value> value,
|
| - const AccessorInfo& info) {
|
| +static void SetterWhichSetsYOnThisTo23(
|
| + Local<String> name,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<void>& info) {
|
| CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
| CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
| info.This()->Set(v8_str("y"), v8_num(23));
|
| }
|
|
|
|
|
| -Handle<Value> FooGetInterceptor(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +void FooGetInterceptor(Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
| CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
| - if (!name->Equals(v8_str("foo"))) return Handle<Value>();
|
| - return v8_num(42);
|
| + if (!name->Equals(v8_str("foo"))) return;
|
| + info.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| -Handle<Value> FooSetInterceptor(Local<String> name,
|
| - Local<Value> value,
|
| - const AccessorInfo& info) {
|
| +void FooSetInterceptor(Local<String> name,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject());
|
| CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject());
|
| - if (!name->Equals(v8_str("foo"))) return Handle<Value>();
|
| + if (!name->Equals(v8_str("foo"))) return;
|
| info.This()->Set(v8_str("y"), v8_num(23));
|
| - return v8_num(23);
|
| + info.GetReturnValue().Set(v8_num(23));
|
| }
|
|
|
|
|
| @@ -16807,18 +16733,20 @@ TEST(SetterOnConstructorPrototype) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> NamedPropertyGetterWhichReturns42(
|
| - Local<String> name, const AccessorInfo& info) {
|
| - return v8_num(42);
|
| +static void NamedPropertyGetterWhichReturns42(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(v8_num(42));
|
| }
|
|
|
|
|
| -static v8::Handle<Value> NamedPropertySetterWhichSetsYOnThisTo23(
|
| - Local<String> name, Local<Value> value, const AccessorInfo& info) {
|
| +static void NamedPropertySetterWhichSetsYOnThisTo23(
|
| + Local<String> name,
|
| + Local<Value> value,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| if (name->Equals(v8_str("x"))) {
|
| info.This()->Set(v8_str("y"), v8_num(23));
|
| }
|
| - return v8::Handle<Value>();
|
| }
|
|
|
|
|
| @@ -16957,6 +16885,7 @@ TEST(GCCallbacks) {
|
|
|
|
|
| THREADED_TEST(AddToJSFunctionResultCache) {
|
| + i::FLAG_stress_compaction = false;
|
| i::FLAG_allow_natives_syntax = true;
|
| v8::HandleScope scope(v8::Isolate::GetCurrent());
|
|
|
| @@ -18058,16 +17987,16 @@ THREADED_TEST(Equals) {
|
| }
|
|
|
|
|
| -static v8::Handle<v8::Value> Getter(v8::Local<v8::String> property,
|
| - const v8::AccessorInfo& info ) {
|
| - return v8_str("42!");
|
| +static void Getter(v8::Local<v8::String> property,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info ) {
|
| + info.GetReturnValue().Set(v8_str("42!"));
|
| }
|
|
|
|
|
| -static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) {
|
| +static void Enumerator(const v8::PropertyCallbackInfo<v8::Array>& info) {
|
| v8::Handle<v8::Array> result = v8::Array::New();
|
| result->Set(0, v8_str("universalAnswer"));
|
| - return result;
|
| + info.GetReturnValue().Set(result);
|
| }
|
|
|
|
|
| @@ -18213,44 +18142,44 @@ THREADED_TEST(CreationContextOfJsFunction) {
|
| }
|
|
|
|
|
| -Handle<Value> HasOwnPropertyIndexedPropertyGetter(uint32_t index,
|
| - const AccessorInfo& info) {
|
| - if (index == 42) return v8_str("yes");
|
| - return Handle<v8::Integer>();
|
| +void HasOwnPropertyIndexedPropertyGetter(
|
| + uint32_t index,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (index == 42) info.GetReturnValue().Set(v8_str("yes"));
|
| }
|
|
|
|
|
| -Handle<Value> HasOwnPropertyNamedPropertyGetter(Local<String> property,
|
| - const AccessorInfo& info) {
|
| - if (property->Equals(v8_str("foo"))) return v8_str("yes");
|
| - return Handle<Value>();
|
| +void HasOwnPropertyNamedPropertyGetter(
|
| + Local<String> property,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(v8_str("yes"));
|
| }
|
|
|
|
|
| -Handle<v8::Integer> HasOwnPropertyIndexedPropertyQuery(
|
| - uint32_t index, const AccessorInfo& info) {
|
| - if (index == 42) return v8_num(1).As<v8::Integer>();
|
| - return Handle<v8::Integer>();
|
| +void HasOwnPropertyIndexedPropertyQuery(
|
| + uint32_t index, const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + if (index == 42) info.GetReturnValue().Set(1);
|
| }
|
|
|
|
|
| -Handle<v8::Integer> HasOwnPropertyNamedPropertyQuery(
|
| - Local<String> property, const AccessorInfo& info) {
|
| - if (property->Equals(v8_str("foo"))) return v8_num(1).As<v8::Integer>();
|
| - return Handle<v8::Integer>();
|
| +void HasOwnPropertyNamedPropertyQuery(
|
| + Local<String> property,
|
| + const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(1);
|
| }
|
|
|
|
|
| -Handle<v8::Integer> HasOwnPropertyNamedPropertyQuery2(
|
| - Local<String> property, const AccessorInfo& info) {
|
| - if (property->Equals(v8_str("bar"))) return v8_num(1).As<v8::Integer>();
|
| - return Handle<v8::Integer>();
|
| +void HasOwnPropertyNamedPropertyQuery2(
|
| + Local<String> property,
|
| + const v8::PropertyCallbackInfo<v8::Integer>& info) {
|
| + if (property->Equals(v8_str("bar"))) info.GetReturnValue().Set(1);
|
| }
|
|
|
|
|
| -Handle<Value> HasOwnPropertyAccessorGetter(Local<String> property,
|
| - const AccessorInfo& info) {
|
| - return v8_str("yes");
|
| +void HasOwnPropertyAccessorGetter(
|
| + Local<String> property,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| + info.GetReturnValue().Set(v8_str("yes"));
|
| }
|
|
|
|
|
| @@ -18437,8 +18366,7 @@ TEST(SetErrorMessageForCodeGenFromStrings) {
|
| }
|
|
|
|
|
| -static v8::Handle<Value> NonObjectThis(const v8::Arguments& args) {
|
| - return v8::Undefined();
|
| +static void NonObjectThis(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| }
|
|
|
|
|
| @@ -18751,7 +18679,7 @@ void CallCompletedCallback2() {
|
| }
|
|
|
|
|
| -Handle<Value> RecursiveCall(const Arguments& args) {
|
| +void RecursiveCall(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
| int32_t level = args[0]->Int32Value();
|
| if (level < 3) {
|
| level++;
|
| @@ -18766,7 +18694,6 @@ Handle<Value> RecursiveCall(const Arguments& args) {
|
| i::OS::Print("Recursion ends.\n");
|
| CHECK_EQ(0, callback_fired);
|
| }
|
| - return Undefined();
|
| }
|
|
|
|
|
| @@ -18899,13 +18826,6 @@ TEST(PrimaryStubCache) {
|
| }
|
|
|
|
|
| -static int fatal_error_callback_counter = 0;
|
| -static void CountingErrorCallback(const char* location, const char* message) {
|
| - printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message);
|
| - fatal_error_callback_counter++;
|
| -}
|
| -
|
| -
|
| TEST(StaticGetters) {
|
| LocalContext context;
|
| i::Factory* factory = i::Isolate::Current()->factory();
|
| @@ -18923,31 +18843,6 @@ TEST(StaticGetters) {
|
| i::Handle<i::Object> false_value = factory->false_value();
|
| CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value);
|
| CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value);
|
| -
|
| - // Test after-death behavior.
|
| - CHECK(i::Internals::IsInitialized(isolate));
|
| - CHECK_EQ(0, fatal_error_callback_counter);
|
| - v8::V8::SetFatalErrorHandler(CountingErrorCallback);
|
| - v8::Utils::ReportApiFailure("StaticGetters()", "Kill V8");
|
| - i::Isolate::Current()->TearDown();
|
| - CHECK(!i::Internals::IsInitialized(isolate));
|
| - CHECK_EQ(1, fatal_error_callback_counter);
|
| - CHECK(v8::Undefined().IsEmpty());
|
| - CHECK_EQ(2, fatal_error_callback_counter);
|
| - CHECK(v8::Undefined(isolate).IsEmpty());
|
| - CHECK_EQ(3, fatal_error_callback_counter);
|
| - CHECK(v8::Null().IsEmpty());
|
| - CHECK_EQ(4, fatal_error_callback_counter);
|
| - CHECK(v8::Null(isolate).IsEmpty());
|
| - CHECK_EQ(5, fatal_error_callback_counter);
|
| - CHECK(v8::True().IsEmpty());
|
| - CHECK_EQ(6, fatal_error_callback_counter);
|
| - CHECK(v8::True(isolate).IsEmpty());
|
| - CHECK_EQ(7, fatal_error_callback_counter);
|
| - CHECK(v8::False().IsEmpty());
|
| - CHECK_EQ(8, fatal_error_callback_counter);
|
| - CHECK(v8::False(isolate).IsEmpty());
|
| - CHECK_EQ(9, fatal_error_callback_counter);
|
| }
|
|
|
|
|
| @@ -18977,35 +18872,23 @@ TEST(StringEmpty) {
|
| i::Handle<i::Object> empty_string = factory->empty_string();
|
| CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string);
|
| CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string);
|
| -
|
| - // Test after-death behavior.
|
| - CHECK(i::Internals::IsInitialized(isolate));
|
| - CHECK_EQ(0, fatal_error_callback_counter);
|
| - v8::V8::SetFatalErrorHandler(CountingErrorCallback);
|
| - v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8");
|
| - i::Isolate::Current()->TearDown();
|
| - CHECK(!i::Internals::IsInitialized(isolate));
|
| - CHECK_EQ(1, fatal_error_callback_counter);
|
| - CHECK(v8::String::Empty().IsEmpty());
|
| - CHECK_EQ(2, fatal_error_callback_counter);
|
| - CHECK(v8::String::Empty(isolate).IsEmpty());
|
| - CHECK_EQ(3, fatal_error_callback_counter);
|
| }
|
|
|
|
|
| static int instance_checked_getter_count = 0;
|
| -static Handle<Value> InstanceCheckedGetter(Local<String> name,
|
| - const AccessorInfo& info) {
|
| +static void InstanceCheckedGetter(
|
| + Local<String> name,
|
| + const v8::PropertyCallbackInfo<v8::Value>& info) {
|
| CHECK_EQ(name, v8_str("foo"));
|
| instance_checked_getter_count++;
|
| - return v8_num(11);
|
| + info.GetReturnValue().Set(v8_num(11));
|
| }
|
|
|
|
|
| static int instance_checked_setter_count = 0;
|
| static void InstanceCheckedSetter(Local<String> name,
|
| Local<Value> value,
|
| - const AccessorInfo& info) {
|
| + const v8::PropertyCallbackInfo<void>& info) {
|
| CHECK_EQ(name, v8_str("foo"));
|
| CHECK_EQ(value, v8_num(23));
|
| instance_checked_setter_count++;
|
| @@ -19397,6 +19280,18 @@ THREADED_TEST(Regress2535) {
|
| }
|
|
|
|
|
| +THREADED_TEST(Regress2746) {
|
| + LocalContext context;
|
| + v8::HandleScope scope(context->GetIsolate());
|
| + Local<Object> obj = Object::New();
|
| + Local<String> key = String::New("key");
|
| + obj->SetHiddenValue(key, v8::Undefined());
|
| + Local<Value> value = obj->GetHiddenValue(key);
|
| + CHECK(!value.IsEmpty());
|
| + CHECK(value->IsUndefined());
|
| +}
|
| +
|
| +
|
| #ifndef WIN32
|
| class ThreadInterruptTest {
|
| public:
|
|
|