From: dcarney@chromium.org Date: Thu, 20 Jun 2013 08:07:45 +0000 (+0000) Subject: remove all old style callbacks - patch 2 X-Git-Tag: upstream/4.7.83~13770 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=89fb509c7738ed9f504db1a886eb8bf89aa9bf42;p=platform%2Fupstream%2Fv8.git remove all old style callbacks - patch 2 R=svenpanne@chromium.org BUG= Review URL: https://codereview.chromium.org/17071004 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15221 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 353ac83..32e2829 100755 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -8767,9 +8767,10 @@ THREADED_TEST(Version) { } -static v8::Handle InstanceFunctionCallback(const v8::Arguments& args) { +static void InstanceFunctionCallback( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - return v8_num(12); + args.GetReturnValue().Set(v8_num(12)); } @@ -8795,10 +8796,10 @@ THREADED_TEST(InstanceProperties) { } -static v8::Handle -GlobalObjectInstancePropertiesGet(Local key, const AccessorInfo&) { +static void GlobalObjectInstancePropertiesGet( + Local key, + const v8::PropertyCallbackInfo&) { ApiTestFuzzer::Fuzz(); - return v8::Handle(); } @@ -8898,9 +8899,10 @@ THREADED_TEST(CallKnownGlobalReceiver) { } -static v8::Handle ShadowFunctionCallback(const v8::Arguments& args) { +static void ShadowFunctionCallback( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - return v8_num(42); + args.GetReturnValue().Set(v8_num(42)); } @@ -8909,29 +8911,29 @@ static int shadow_y_setter_call_count; static int shadow_y_getter_call_count; -static void ShadowYSetter(Local, Local, const AccessorInfo&) { +static void ShadowYSetter(Local, + Local, + const v8::PropertyCallbackInfo&) { shadow_y_setter_call_count++; shadow_y = 42; } -static v8::Handle ShadowYGetter(Local name, - const AccessorInfo& info) { +static void ShadowYGetter(Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); shadow_y_getter_call_count++; - return v8_num(shadow_y); + info.GetReturnValue().Set(v8_num(shadow_y)); } -static v8::Handle ShadowIndexedGet(uint32_t index, - const AccessorInfo& info) { - return v8::Handle(); +static void ShadowIndexedGet(uint32_t index, + const v8::PropertyCallbackInfo&) { } -static v8::Handle ShadowNamedGet(Local key, - const AccessorInfo&) { - return v8::Handle(); +static void ShadowNamedGet(Local key, + const v8::PropertyCallbackInfo&) { } @@ -9281,7 +9283,8 @@ THREADED_TEST(Constructor) { } -static Handle ConstructorCallback(const Arguments& args) { +static void ConstructorCallback( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); Local This; @@ -9297,13 +9300,14 @@ static Handle ConstructorCallback(const Arguments& args) { } This->Set(v8_str("a"), args[0]); - return This; + args.GetReturnValue().Set(This); } -static Handle FakeConstructorCallback(const Arguments& args) { +static void FakeConstructorCallback( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - return args[0]; + args.GetReturnValue().Set(args[0]); } @@ -9671,15 +9675,16 @@ THREADED_TEST(CrossLazyLoad) { } -static v8::Handle call_as_function(const v8::Arguments& args) { +static void call_as_function(const v8::FunctionCallbackInfo& 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]); } @@ -9883,11 +9888,10 @@ THREADED_TEST(HandleIteration) { } -static v8::Handle InterceptorHasOwnPropertyGetter( +static void InterceptorHasOwnPropertyGetter( Local name, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8::Handle(); } @@ -9914,12 +9918,11 @@ THREADED_TEST(InterceptorHasOwnProperty) { } -static v8::Handle InterceptorHasOwnPropertyGetterGC( +static void InterceptorHasOwnPropertyGetterGC( Local name, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); - return v8::Handle(); } @@ -9952,8 +9955,9 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) { } -typedef v8::Handle (*NamedPropertyGetter)(Local property, - const AccessorInfo& info); +typedef void (*NamedPropertyGetter)( + Local property, + const v8::PropertyCallbackInfo& info); static void CheckInterceptorLoadIC(NamedPropertyGetter getter, @@ -9969,14 +9973,15 @@ static void CheckInterceptorLoadIC(NamedPropertyGetter getter, } -static v8::Handle InterceptorLoadICGetter(Local name, - const AccessorInfo& info) { +static void InterceptorLoadICGetter( + Local name, + const v8::PropertyCallbackInfo& 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)); } @@ -9995,11 +10000,14 @@ THREADED_TEST(InterceptorLoadIC) { // configurations of interceptor and explicit fields works fine // (those cases are special cased to get better performance). -static v8::Handle InterceptorLoadXICGetter(Local name, - const AccessorInfo& info) { +static void InterceptorLoadXICGetter( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8_str("x")->Equals(name) - ? v8::Handle(v8::Integer::New(42)) : v8::Handle(); + info.GetReturnValue().Set( + v8_str("x")->Equals(name) ? + v8::Handle(v8::Integer::New(42)) : + v8::Handle()); } @@ -10108,10 +10116,10 @@ THREADED_TEST(InterceptorLoadICInvalidatedField) { static int interceptor_load_not_handled_calls = 0; -static v8::Handle InterceptorLoadNotHandled(Local name, - const AccessorInfo& info) { +static void InterceptorLoadNotHandled( + Local name, + const v8::PropertyCallbackInfo& info) { ++interceptor_load_not_handled_calls; - return v8::Handle(); } @@ -10345,11 +10353,12 @@ THREADED_TEST(InterceptorLoadICInvalidatedCallbackViaGlobal) { } -static v8::Handle InterceptorLoadICGetter0(Local name, - const AccessorInfo& info) { +static void InterceptorLoadICGetter0( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); CHECK(v8_str("x")->Equals(name)); - return v8::Integer::New(0); + info.GetReturnValue().Set(v8::Integer::New(0)); } @@ -10360,11 +10369,13 @@ THREADED_TEST(InterceptorReturningZero) { } -static v8::Handle InterceptorStoreICSetter( - Local key, Local value, const AccessorInfo&) { +static void InterceptorStoreICSetter( + Local key, + Local value, + const v8::PropertyCallbackInfo& info) { CHECK(v8_str("x")->Equals(key)); CHECK_EQ(42, value->Int32Value()); - return value; + info.GetReturnValue().Set(value); } @@ -10405,11 +10416,12 @@ v8::Handle call_ic_function; v8::Handle call_ic_function2; v8::Handle call_ic_function3; -static v8::Handle InterceptorCallICGetter(Local name, - const AccessorInfo& info) { +static void InterceptorCallICGetter( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); CHECK(v8_str("x")->Equals(name)); - return call_ic_function; + info.GetReturnValue().Set(call_ic_function); } @@ -10450,11 +10462,12 @@ THREADED_TEST(InterceptorCallICSeesOthers) { static v8::Handle call_ic_function4; -static v8::Handle InterceptorCallICGetter4(Local name, - const AccessorInfo& info) { +static void InterceptorCallICGetter4( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); CHECK(v8_str("x")->Equals(name)); - return call_ic_function4; + info.GetReturnValue().Set(call_ic_function4); } @@ -10527,13 +10540,12 @@ THREADED_TEST(InterceptorCallICConstantFunctionUsed) { static v8::Handle call_ic_function5; -static v8::Handle InterceptorCallICGetter5(Local name, - const AccessorInfo& info) { +static void InterceptorCallICGetter5( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); if (v8_str("x")->Equals(name)) - return call_ic_function5; - else - return Local(); + info.GetReturnValue().Set(call_ic_function5); } @@ -10561,13 +10573,12 @@ THREADED_TEST(InterceptorCallICConstantFunctionNotNeeded) { static v8::Handle call_ic_function6; -static v8::Handle InterceptorCallICGetter6(Local name, - const AccessorInfo& info) { +static void InterceptorCallICGetter6( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); if (v8_str("x")->Equals(name)) - return call_ic_function6; - else - return Local(); + info.GetReturnValue().Set(call_ic_function6); } @@ -10686,8 +10697,9 @@ THREADED_TEST(InterceptorCallICCachedFromGlobal) { CHECK_EQ(239 * 10, value->Int32Value()); } -static v8::Handle InterceptorCallICFastApi(Local name, - const AccessorInfo& info) { +static void InterceptorCallICFastApi( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); CheckReturnValue(info, FUNCTION_ADDR(InterceptorCallICFastApi)); int* call_count = @@ -10696,22 +10708,21 @@ static v8::Handle InterceptorCallICFastApi(Local name, if ((*call_count) % 20 == 0) { HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); } - return v8::Handle(); } -static v8::Handle FastApiCallback_TrivialSignature( - const v8::Arguments& args) { +static void FastApiCallback_TrivialSignature( + const v8::FunctionCallbackInfo& 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 FastApiCallback_SimpleSignature( - const v8::Arguments& args) { +static void FastApiCallback_SimpleSignature( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); CheckReturnValue(args, FUNCTION_ADDR(FastApiCallback_SimpleSignature)); v8::Isolate* isolate = v8::Isolate::GetCurrent(); @@ -10721,7 +10732,7 @@ static v8::Handle 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. @@ -10735,14 +10746,13 @@ static void GenerateSomeGarbage() { } -v8::Handle DirectApiCallback(const v8::Arguments& args) { +void DirectApiCallback(const v8::FunctionCallbackInfo& 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(); } @@ -10765,8 +10775,9 @@ THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) { } -v8::Handle ThrowingDirectApiCallback(const v8::Arguments& args) { - return v8::ThrowException(v8_str("g")); +void ThrowingDirectApiCallback( + const v8::FunctionCallbackInfo& args) { + v8::ThrowException(v8_str("g")); } @@ -10799,21 +10810,6 @@ static Handle DoDirectGetter() { return v8_str("Direct Getter Result"); } -static v8::Handle DirectGetter(Local name, - const v8::AccessorInfo& info) { - CheckReturnValue(info, FUNCTION_ADDR(DirectGetter)); - info.GetReturnValue().Set(v8_str("Garbage")); - return DoDirectGetter(); -} - -static v8::Handle DirectGetterIndirect( - Local name, - const v8::AccessorInfo& info) { - CheckReturnValue(info, FUNCTION_ADDR(DirectGetterIndirect)); - info.GetReturnValue().Set(DoDirectGetter()); - return v8::Handle(); -} - static void DirectGetterCallback( Local name, const v8::PropertyCallbackInfo& info) { @@ -10841,15 +10837,14 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) { } THREADED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { - LoadICFastApi_DirectCall_GCMoveStub(DirectGetterIndirect); LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); - LoadICFastApi_DirectCall_GCMoveStub(DirectGetter); } -v8::Handle ThrowingDirectGetterCallback( - Local name, const v8::AccessorInfo& info) { - return v8::ThrowException(v8_str("g")); +void ThrowingDirectGetterCallback( + Local name, + const v8::PropertyCallbackInfo& info) { + v8::ThrowException(v8_str("g")); } @@ -11241,13 +11236,13 @@ THREADED_TEST(CallICFastApi_SimpleSignature_TypeError) { v8::Handle keyed_call_ic_function; -static v8::Handle InterceptorKeyedCallICGetter( - Local name, const AccessorInfo& info) { +static void InterceptorKeyedCallICGetter( + Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); if (v8_str("x")->Equals(name)) { - return keyed_call_ic_function; + info.GetReturnValue().Set(keyed_call_ic_function); } - return v8::Handle(); } @@ -11398,13 +11393,13 @@ THREADED_TEST(InterceptorKeyedCallICMapChangeAfter) { static int interceptor_call_count = 0; -static v8::Handle InterceptorICRefErrorGetter(Local name, - const AccessorInfo& info) { +static void InterceptorICRefErrorGetter( + Local name, + const v8::PropertyCallbackInfo& 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(); } @@ -11441,18 +11436,17 @@ THREADED_TEST(InterceptorICReferenceErrors) { static int interceptor_ic_exception_get_count = 0; -static v8::Handle InterceptorICExceptionGetter( +static void InterceptorICExceptionGetter( Local name, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& 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(); } // Test interceptor load/call IC where the interceptor throws an @@ -11488,14 +11482,14 @@ THREADED_TEST(InterceptorICGetterExceptions) { static int interceptor_ic_exception_set_count = 0; -static v8::Handle InterceptorICExceptionSetter( - Local key, Local value, const AccessorInfo&) { +static void InterceptorICExceptionSetter( + Local key, + Local value, + const v8::PropertyCallbackInfo& 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(); } // Test interceptor store IC where the interceptor throws an exception @@ -11522,7 +11516,8 @@ THREADED_TEST(InterceptorICSetterExceptions) { THREADED_TEST(NullNamedInterceptor) { v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Handle templ = ObjectTemplate::New(); - templ->SetNamedPropertyHandler(static_cast(0)); + templ->SetNamedPropertyHandler( + static_cast(0)); LocalContext context; templ->Set("x", v8_num(42)); v8::Handle obj = templ->NewInstance(); @@ -11537,7 +11532,8 @@ THREADED_TEST(NullNamedInterceptor) { THREADED_TEST(NullIndexedInterceptor) { v8::HandleScope scope(v8::Isolate::GetCurrent()); v8::Handle templ = ObjectTemplate::New(); - templ->SetIndexedPropertyHandler(static_cast(0)); + templ->SetIndexedPropertyHandler( + static_cast(0)); LocalContext context; templ->Set("42", v8_num(42)); v8::Handle obj = templ->NewInstance(); @@ -11560,11 +11556,11 @@ THREADED_TEST(NamedPropertyHandlerGetterAttributes) { } -static Handle ThrowingGetter(Local name, - const AccessorInfo& info) { +static void ThrowingGetter(Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); ThrowException(Handle()); - return Undefined(); + info.GetReturnValue().SetUndefined(); } @@ -11621,7 +11617,8 @@ THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) { } -static Handle ThrowingCallbackWithTryCatch(const Arguments& args) { +static void ThrowingCallbackWithTryCatch( + const v8::FunctionCallbackInfo& args) { TryCatch try_catch; // Verboseness is important: it triggers message delivery which can call into // external code. @@ -11630,7 +11627,6 @@ static Handle ThrowingCallbackWithTryCatch(const Arguments& args) { CHECK(try_catch.HasCaught()); CHECK(!i::Isolate::Current()->has_pending_exception()); CHECK(!i::Isolate::Current()->has_scheduled_exception()); - return Undefined(); } @@ -11688,17 +11684,17 @@ THREADED_TEST(ExceptionsDoNotPropagatePastTryCatch) { } -static v8::Handle ParentGetter(Local name, - const AccessorInfo& info) { +static void ParentGetter(Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8_num(1); + info.GetReturnValue().Set(v8_num(1)); } -static v8::Handle ChildGetter(Local name, - const AccessorInfo& info) { +static void ChildGetter(Local name, + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8_num(42); + info.GetReturnValue().Set(v8_num(42)); } @@ -11760,9 +11756,10 @@ THREADED_TEST(Overriding) { } -static v8::Handle IsConstructHandler(const v8::Arguments& args) { +static void IsConstructHandler( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - return v8::Boolean::New(args.IsConstructCall()); + args.GetReturnValue().Set(args.IsConstructCall()); } @@ -12003,7 +12000,7 @@ void ApiTestFuzzer::CallTest() { } -static v8::Handle ThrowInJS(const v8::Arguments& args) { +static void ThrowInJS(const v8::FunctionCallbackInfo& args) { CHECK(v8::Locker::IsLocked(CcTest::default_isolate())); ApiTestFuzzer::Fuzz(); v8::Unlocker unlocker(CcTest::default_isolate()); @@ -12021,12 +12018,12 @@ static v8::Handle ThrowInJS(const v8::Arguments& args) { // when the TryCatch is destroyed. exception = Local::New(try_catch.Exception()); } - return v8::ThrowException(exception); + v8::ThrowException(exception); } } -static v8::Handle ThrowInJSNoCatch(const v8::Arguments& args) { +static void ThrowInJSNoCatch(const v8::FunctionCallbackInfo& args) { CHECK(v8::Locker::IsLocked(CcTest::default_isolate())); ApiTestFuzzer::Fuzz(); v8::Unlocker unlocker(CcTest::default_isolate()); @@ -12036,7 +12033,7 @@ static v8::Handle ThrowInJSNoCatch(const v8::Arguments& args) { v8::HandleScope scope(args.GetIsolate()); v8::Handle value = CompileRun(code); CHECK(value.IsEmpty()); - return scope.Close(v8_str("foo")); + args.GetReturnValue().Set(v8_str("foo")); } } @@ -12094,10 +12091,9 @@ THREADED_TEST(RecursiveLocking) { } -static v8::Handle UnlockForAMoment(const v8::Arguments& args) { +static void UnlockForAMoment(const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); v8::Unlocker unlocker(CcTest::default_isolate()); - return v8::Undefined(); } @@ -12855,9 +12851,10 @@ THREADED_TEST(CompilationCache) { } -static v8::Handle FunctionNameCallback(const v8::Arguments& args) { +static void FunctionNameCallback( + const v8::FunctionCallbackInfo& args) { ApiTestFuzzer::Fuzz(); - return v8_num(42); + args.GetReturnValue().Set(v8_num(42)); } @@ -14026,28 +14023,27 @@ static int force_set_set_count = 0; static int force_set_get_count = 0; bool pass_on_get = false; -static v8::Handle ForceSetGetter(v8::Local name, - const v8::AccessorInfo& info) { +static void ForceSetGetter(v8::Local name, + const v8::PropertyCallbackInfo& info) { force_set_get_count++; if (pass_on_get) { - return v8::Handle(); - } else { - return v8::Int32::New(3); + return; } + info.GetReturnValue().Set(3); } static void ForceSetSetter(v8::Local name, v8::Local value, - const v8::AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { force_set_set_count++; } -static v8::Handle ForceSetInterceptSetter( +static void ForceSetInterceptSetter( v8::Local name, v8::Local value, - const v8::AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { force_set_set_count++; - return v8::Undefined(); + info.GetReturnValue().SetUndefined(); } TEST(ForceSet) { @@ -14161,15 +14157,12 @@ static int force_delete_interceptor_count = 0; static bool pass_on_delete = false; -static v8::Handle ForceDeleteDeleter( +static void ForceDeleteDeleter( v8::Local name, - const v8::AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { force_delete_interceptor_count++; - if (pass_on_delete) { - return v8::Handle(); - } else { - return v8::True(); - } + if (pass_on_delete) return; + info.GetReturnValue().Set(true); } @@ -14275,13 +14268,14 @@ static v8::Local 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 GetCallingContextCallback(const v8::Arguments& args) { +static void GetCallingContextCallback( + const v8::FunctionCallbackInfo& 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); } @@ -14787,20 +14781,18 @@ THREADED_TEST(PixelArrayInfo) { } -static v8::Handle NotHandledIndexedPropertyGetter( +static void NotHandledIndexedPropertyGetter( uint32_t index, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8::Handle(); } -static v8::Handle NotHandledIndexedPropertySetter( +static void NotHandledIndexedPropertySetter( uint32_t index, Local value, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { ApiTestFuzzer::Fuzz(); - return v8::Handle(); } @@ -15696,7 +15688,7 @@ void checkStackFrame(const char* expected_script_name, } -v8::Handle AnalyzeStackInNativeCode(const v8::Arguments& args) { +void AnalyzeStackInNativeCode(const v8::FunctionCallbackInfo& args) { v8::HandleScope scope(args.GetIsolate()); const char* origin = "capture-stack-trace-test"; const int kOverviewTest = 1; @@ -15744,7 +15736,6 @@ v8::Handle AnalyzeStackInNativeCode(const v8::Arguments& args) { CHECK(stackTrace->AsArray()->IsArray()); } - return v8::Undefined(); } @@ -15983,7 +15974,8 @@ TEST(RethrowBogusErrorStackTrace) { } -v8::Handle AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) { +void AnalyzeStackOfEvalWithSourceURL( + const v8::FunctionCallbackInfo& args) { v8::HandleScope scope(args.GetIsolate()); v8::Handle stackTrace = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); @@ -15995,7 +15987,6 @@ v8::Handle AnalyzeStackOfEvalWithSourceURL(const v8::Arguments& args) { CHECK(!name.IsEmpty()); CHECK_EQ(url, name); } - return v8::Undefined(); } @@ -16027,8 +16018,8 @@ TEST(SourceURLInStackTrace) { } -v8::Handle AnalyzeStackOfInlineScriptWithSourceURL( - const v8::Arguments& args) { +void AnalyzeStackOfInlineScriptWithSourceURL( + const v8::FunctionCallbackInfo& args) { v8::HandleScope scope(args.GetIsolate()); v8::Handle stackTrace = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); @@ -16040,7 +16031,6 @@ v8::Handle AnalyzeStackOfInlineScriptWithSourceURL( CHECK(!name.IsEmpty()); CHECK_EQ(url, name); } - return v8::Undefined(); } @@ -16073,8 +16063,8 @@ TEST(InlineScriptWithSourceURLInStackTrace) { } -v8::Handle AnalyzeStackOfDynamicScriptWithSourceURL( - const v8::Arguments& args) { +void AnalyzeStackOfDynamicScriptWithSourceURL( + const v8::FunctionCallbackInfo& args) { v8::HandleScope scope(args.GetIsolate()); v8::Handle stackTrace = v8::StackTrace::CurrentStackTrace(10, v8::StackTrace::kDetailed); @@ -16086,7 +16076,6 @@ v8::Handle AnalyzeStackOfDynamicScriptWithSourceURL( CHECK(!name.IsEmpty()); CHECK_EQ(url, name); } - return v8::Undefined(); } @@ -16222,10 +16211,10 @@ TEST(Regress2107) { static uint32_t* stack_limit; -static v8::Handle GetStackLimitCallback(const v8::Arguments& args) { +static void GetStackLimitCallback( + const v8::FunctionCallbackInfo& args) { stack_limit = reinterpret_cast( i::Isolate::Current()->stack_guard()->real_climit()); - return v8::Undefined(); } @@ -16494,14 +16483,14 @@ THREADED_TEST(QuietSignalingNaNs) { } -static v8::Handle SpaghettiIncident(const v8::Arguments& args) { +static void SpaghettiIncident( + const v8::FunctionCallbackInfo& args) { v8::HandleScope scope(args.GetIsolate()); v8::TryCatch tc; v8::Handle str(args[0]->ToString()); USE(str); if (tc.HasCaught()) - return tc.ReThrow(); - return v8::Undefined(); + tc.ReThrow(); } @@ -16705,40 +16694,42 @@ THREADED_TEST(FunctionGetScriptId) { } -static v8::Handle GetterWhichReturns42(Local name, - const AccessorInfo& info) { +static void GetterWhichReturns42( + Local name, + const v8::PropertyCallbackInfo& 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 name, - Local value, - const AccessorInfo& info) { +static void SetterWhichSetsYOnThisTo23( + Local name, + Local value, + const v8::PropertyCallbackInfo& 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 FooGetInterceptor(Local name, - const AccessorInfo& info) { +void FooGetInterceptor(Local name, + const v8::PropertyCallbackInfo& info) { CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject()); CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject()); - if (!name->Equals(v8_str("foo"))) return Handle(); - return v8_num(42); + if (!name->Equals(v8_str("foo"))) return; + info.GetReturnValue().Set(v8_num(42)); } -Handle FooSetInterceptor(Local name, - Local value, - const AccessorInfo& info) { +void FooSetInterceptor(Local name, + Local value, + const v8::PropertyCallbackInfo& info) { CHECK(v8::Utils::OpenHandle(*info.This())->IsJSObject()); CHECK(v8::Utils::OpenHandle(*info.Holder())->IsJSObject()); - if (!name->Equals(v8_str("foo"))) return Handle(); + 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)); } @@ -16777,18 +16768,20 @@ TEST(SetterOnConstructorPrototype) { } -static v8::Handle NamedPropertyGetterWhichReturns42( - Local name, const AccessorInfo& info) { - return v8_num(42); +static void NamedPropertyGetterWhichReturns42( + Local name, + const v8::PropertyCallbackInfo& info) { + info.GetReturnValue().Set(v8_num(42)); } -static v8::Handle NamedPropertySetterWhichSetsYOnThisTo23( - Local name, Local value, const AccessorInfo& info) { +static void NamedPropertySetterWhichSetsYOnThisTo23( + Local name, + Local value, + const v8::PropertyCallbackInfo& info) { if (name->Equals(v8_str("x"))) { info.This()->Set(v8_str("y"), v8_num(23)); } - return v8::Handle(); } @@ -18028,16 +18021,16 @@ THREADED_TEST(Equals) { } -static v8::Handle Getter(v8::Local property, - const v8::AccessorInfo& info ) { - return v8_str("42!"); +static void Getter(v8::Local property, + const v8::PropertyCallbackInfo& info ) { + info.GetReturnValue().Set(v8_str("42!")); } -static v8::Handle Enumerator(const v8::AccessorInfo& info) { +static void Enumerator(const v8::PropertyCallbackInfo& info) { v8::Handle result = v8::Array::New(); result->Set(0, v8_str("universalAnswer")); - return result; + info.GetReturnValue().Set(result); } @@ -18183,44 +18176,44 @@ THREADED_TEST(CreationContextOfJsFunction) { } -Handle HasOwnPropertyIndexedPropertyGetter(uint32_t index, - const AccessorInfo& info) { - if (index == 42) return v8_str("yes"); - return Handle(); +void HasOwnPropertyIndexedPropertyGetter( + uint32_t index, + const v8::PropertyCallbackInfo& info) { + if (index == 42) info.GetReturnValue().Set(v8_str("yes")); } -Handle HasOwnPropertyNamedPropertyGetter(Local property, - const AccessorInfo& info) { - if (property->Equals(v8_str("foo"))) return v8_str("yes"); - return Handle(); +void HasOwnPropertyNamedPropertyGetter( + Local property, + const v8::PropertyCallbackInfo& info) { + if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(v8_str("yes")); } -Handle HasOwnPropertyIndexedPropertyQuery( - uint32_t index, const AccessorInfo& info) { - if (index == 42) return v8_num(1).As(); - return Handle(); +void HasOwnPropertyIndexedPropertyQuery( + uint32_t index, const v8::PropertyCallbackInfo& info) { + if (index == 42) info.GetReturnValue().Set(1); } -Handle HasOwnPropertyNamedPropertyQuery( - Local property, const AccessorInfo& info) { - if (property->Equals(v8_str("foo"))) return v8_num(1).As(); - return Handle(); +void HasOwnPropertyNamedPropertyQuery( + Local property, + const v8::PropertyCallbackInfo& info) { + if (property->Equals(v8_str("foo"))) info.GetReturnValue().Set(1); } -Handle HasOwnPropertyNamedPropertyQuery2( - Local property, const AccessorInfo& info) { - if (property->Equals(v8_str("bar"))) return v8_num(1).As(); - return Handle(); +void HasOwnPropertyNamedPropertyQuery2( + Local property, + const v8::PropertyCallbackInfo& info) { + if (property->Equals(v8_str("bar"))) info.GetReturnValue().Set(1); } -Handle HasOwnPropertyAccessorGetter(Local property, - const AccessorInfo& info) { - return v8_str("yes"); +void HasOwnPropertyAccessorGetter( + Local property, + const v8::PropertyCallbackInfo& info) { + info.GetReturnValue().Set(v8_str("yes")); } @@ -18407,8 +18400,7 @@ TEST(SetErrorMessageForCodeGenFromStrings) { } -static v8::Handle NonObjectThis(const v8::Arguments& args) { - return v8::Undefined(); +static void NonObjectThis(const v8::FunctionCallbackInfo& args) { } @@ -18721,7 +18713,7 @@ void CallCompletedCallback2() { } -Handle RecursiveCall(const Arguments& args) { +void RecursiveCall(const v8::FunctionCallbackInfo& args) { int32_t level = args[0]->Int32Value(); if (level < 3) { level++; @@ -18736,7 +18728,6 @@ Handle RecursiveCall(const Arguments& args) { i::OS::Print("Recursion ends.\n"); CHECK_EQ(0, callback_fired); } - return Undefined(); } @@ -18964,18 +18955,19 @@ TEST(StringEmpty) { static int instance_checked_getter_count = 0; -static Handle InstanceCheckedGetter(Local name, - const AccessorInfo& info) { +static void InstanceCheckedGetter( + Local name, + const v8::PropertyCallbackInfo& 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 name, Local value, - const AccessorInfo& info) { + const v8::PropertyCallbackInfo& info) { CHECK_EQ(name, v8_str("foo")); CHECK_EQ(value, v8_num(23)); instance_checked_setter_count++;