| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2444 | 2444 |
| 2445 env->Global()->Set(v8_str("depth"), v8::Integer::New(0)); | 2445 env->Global()->Set(v8_str("depth"), v8::Integer::New(0)); |
| 2446 Script::Compile(v8_str("callFunctionRecursively()"))->Run(); | 2446 Script::Compile(v8_str("callFunctionRecursively()"))->Run(); |
| 2447 } | 2447 } |
| 2448 | 2448 |
| 2449 | 2449 |
| 2450 static void ThrowingPropertyHandlerGet( | 2450 static void ThrowingPropertyHandlerGet( |
| 2451 Local<String> key, | 2451 Local<String> key, |
| 2452 const v8::PropertyCallbackInfo<v8::Value>& info) { | 2452 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 2453 ApiTestFuzzer::Fuzz(); | 2453 ApiTestFuzzer::Fuzz(); |
| 2454 info.GetReturnValue().Set(v8::ThrowException(key)); | 2454 info.GetReturnValue().Set(info.GetIsolate()->ThrowException(key)); |
| 2455 } | 2455 } |
| 2456 | 2456 |
| 2457 | 2457 |
| 2458 static void ThrowingPropertyHandlerSet( | 2458 static void ThrowingPropertyHandlerSet( |
| 2459 Local<String> key, | 2459 Local<String> key, |
| 2460 Local<Value>, | 2460 Local<Value>, |
| 2461 const v8::PropertyCallbackInfo<v8::Value>& info) { | 2461 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 2462 v8::ThrowException(key); | 2462 info.GetIsolate()->ThrowException(key); |
| 2463 info.GetReturnValue().SetUndefined(); // not the same as empty handle | 2463 info.GetReturnValue().SetUndefined(); // not the same as empty handle |
| 2464 } | 2464 } |
| 2465 | 2465 |
| 2466 | 2466 |
| 2467 THREADED_TEST(CallbackExceptionRegression) { | 2467 THREADED_TEST(CallbackExceptionRegression) { |
| 2468 v8::HandleScope scope(CcTest::isolate()); | 2468 v8::HandleScope scope(CcTest::isolate()); |
| 2469 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); | 2469 v8::Handle<v8::ObjectTemplate> obj = ObjectTemplate::New(); |
| 2470 obj->SetNamedPropertyHandler(ThrowingPropertyHandlerGet, | 2470 obj->SetNamedPropertyHandler(ThrowingPropertyHandlerGet, |
| 2471 ThrowingPropertyHandlerSet); | 2471 ThrowingPropertyHandlerSet); |
| 2472 LocalContext env; | 2472 LocalContext env; |
| (...skipping 1895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4368 CheckUncle(&try_catch); | 4368 CheckUncle(&try_catch); |
| 4369 | 4369 |
| 4370 int64_t integer_value = obj->IntegerValue(); | 4370 int64_t integer_value = obj->IntegerValue(); |
| 4371 CHECK_EQ(0.0, static_cast<double>(integer_value)); | 4371 CHECK_EQ(0.0, static_cast<double>(integer_value)); |
| 4372 CheckUncle(&try_catch); | 4372 CheckUncle(&try_catch); |
| 4373 } | 4373 } |
| 4374 | 4374 |
| 4375 | 4375 |
| 4376 void ThrowFromC(const v8::FunctionCallbackInfo<v8::Value>& args) { | 4376 void ThrowFromC(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 4377 ApiTestFuzzer::Fuzz(); | 4377 ApiTestFuzzer::Fuzz(); |
| 4378 v8::ThrowException(v8_str("konto")); | 4378 args.GetIsolate()->ThrowException(v8_str("konto")); |
| 4379 } | 4379 } |
| 4380 | 4380 |
| 4381 | 4381 |
| 4382 void CCatcher(const v8::FunctionCallbackInfo<v8::Value>& args) { | 4382 void CCatcher(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 4383 if (args.Length() < 1) { | 4383 if (args.Length() < 1) { |
| 4384 args.GetReturnValue().Set(false); | 4384 args.GetReturnValue().Set(false); |
| 4385 return; | 4385 return; |
| 4386 } | 4386 } |
| 4387 v8::HandleScope scope(args.GetIsolate()); | 4387 v8::HandleScope scope(args.GetIsolate()); |
| 4388 v8::TryCatch try_catch; | 4388 v8::TryCatch try_catch; |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4651 } | 4651 } |
| 4652 | 4652 |
| 4653 | 4653 |
| 4654 | 4654 |
| 4655 void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) { | 4655 void CThrowCountDown(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 4656 ApiTestFuzzer::Fuzz(); | 4656 ApiTestFuzzer::Fuzz(); |
| 4657 CHECK_EQ(4, args.Length()); | 4657 CHECK_EQ(4, args.Length()); |
| 4658 int count = args[0]->Int32Value(); | 4658 int count = args[0]->Int32Value(); |
| 4659 int cInterval = args[2]->Int32Value(); | 4659 int cInterval = args[2]->Int32Value(); |
| 4660 if (count == 0) { | 4660 if (count == 0) { |
| 4661 v8::ThrowException(v8_str("FromC")); | 4661 args.GetIsolate()->ThrowException(v8_str("FromC")); |
| 4662 return; | 4662 return; |
| 4663 } else { | 4663 } else { |
| 4664 Local<v8::Object> global = | 4664 Local<v8::Object> global = |
| 4665 args.GetIsolate()->GetCurrentContext()->Global(); | 4665 args.GetIsolate()->GetCurrentContext()->Global(); |
| 4666 Local<Value> fun = global->Get(v8_str("JSThrowCountDown")); | 4666 Local<Value> fun = global->Get(v8_str("JSThrowCountDown")); |
| 4667 v8::Handle<Value> argv[] = { v8_num(count - 1), | 4667 v8::Handle<Value> argv[] = { v8_num(count - 1), |
| 4668 args[1], | 4668 args[1], |
| 4669 args[2], | 4669 args[2], |
| 4670 args[3] }; | 4670 args[3] }; |
| 4671 if (count % cInterval == 0) { | 4671 if (count % cInterval == 0) { |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4791 | 4791 |
| 4792 // JS[6] C[5] *JS[4] @C[3] JS[2] C[1] JS[0] | 4792 // JS[6] C[5] *JS[4] @C[3] JS[2] C[1] JS[0] |
| 4793 v8::Handle<Value> a5[argc] = { v8_num(6), v8_num(4), v8_num(3), v8_num(3) }; | 4793 v8::Handle<Value> a5[argc] = { v8_num(6), v8_num(4), v8_num(3), v8_num(3) }; |
| 4794 fun->Call(fun, argc, a5); | 4794 fun->Call(fun, argc, a5); |
| 4795 } | 4795 } |
| 4796 | 4796 |
| 4797 | 4797 |
| 4798 void ThrowValue(const v8::FunctionCallbackInfo<v8::Value>& args) { | 4798 void ThrowValue(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 4799 ApiTestFuzzer::Fuzz(); | 4799 ApiTestFuzzer::Fuzz(); |
| 4800 CHECK_EQ(1, args.Length()); | 4800 CHECK_EQ(1, args.Length()); |
| 4801 v8::ThrowException(args[0]); | 4801 args.GetIsolate()->ThrowException(args[0]); |
| 4802 } | 4802 } |
| 4803 | 4803 |
| 4804 | 4804 |
| 4805 THREADED_TEST(ThrowValues) { | 4805 THREADED_TEST(ThrowValues) { |
| 4806 v8::HandleScope scope(CcTest::isolate()); | 4806 v8::HandleScope scope(CcTest::isolate()); |
| 4807 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 4807 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 4808 templ->Set(v8_str("Throw"), v8::FunctionTemplate::New(ThrowValue)); | 4808 templ->Set(v8_str("Throw"), v8::FunctionTemplate::New(ThrowValue)); |
| 4809 LocalContext context(0, templ); | 4809 LocalContext context(0, templ); |
| 4810 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 4810 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
| 4811 "function Run(obj) {" | 4811 "function Run(obj) {" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4889 | 4889 |
| 4890 | 4890 |
| 4891 static void TryCatchNestedHelper(int depth) { | 4891 static void TryCatchNestedHelper(int depth) { |
| 4892 if (depth > 0) { | 4892 if (depth > 0) { |
| 4893 v8::TryCatch try_catch; | 4893 v8::TryCatch try_catch; |
| 4894 try_catch.SetVerbose(true); | 4894 try_catch.SetVerbose(true); |
| 4895 TryCatchNestedHelper(depth - 1); | 4895 TryCatchNestedHelper(depth - 1); |
| 4896 CHECK(try_catch.HasCaught()); | 4896 CHECK(try_catch.HasCaught()); |
| 4897 try_catch.ReThrow(); | 4897 try_catch.ReThrow(); |
| 4898 } else { | 4898 } else { |
| 4899 v8::ThrowException(v8_str("back")); | 4899 CcTest::isolate()->ThrowException(v8_str("back")); |
| 4900 } | 4900 } |
| 4901 } | 4901 } |
| 4902 | 4902 |
| 4903 | 4903 |
| 4904 TEST(TryCatchNested) { | 4904 TEST(TryCatchNested) { |
| 4905 v8::V8::Initialize(); | 4905 v8::V8::Initialize(); |
| 4906 LocalContext context; | 4906 LocalContext context; |
| 4907 v8::HandleScope scope(context->GetIsolate()); | 4907 v8::HandleScope scope(context->GetIsolate()); |
| 4908 v8::TryCatch try_catch; | 4908 v8::TryCatch try_catch; |
| 4909 TryCatchNestedHelper(5); | 4909 TryCatchNestedHelper(5); |
| (...skipping 6342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11252 " for (var i = 1; i <= 30; i++) {" | 11252 " for (var i = 1; i <= 30; i++) {" |
| 11253 " nativeobject.callback();" | 11253 " nativeobject.callback();" |
| 11254 " }" | 11254 " }" |
| 11255 "}" | 11255 "}" |
| 11256 "f();"); | 11256 "f();"); |
| 11257 } | 11257 } |
| 11258 | 11258 |
| 11259 | 11259 |
| 11260 void ThrowingDirectApiCallback( | 11260 void ThrowingDirectApiCallback( |
| 11261 const v8::FunctionCallbackInfo<v8::Value>& args) { | 11261 const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 11262 v8::ThrowException(v8_str("g")); | 11262 args.GetIsolate()->ThrowException(v8_str("g")); |
| 11263 } | 11263 } |
| 11264 | 11264 |
| 11265 | 11265 |
| 11266 THREADED_TEST(CallICFastApi_DirectCall_Throw) { | 11266 THREADED_TEST(CallICFastApi_DirectCall_Throw) { |
| 11267 LocalContext context; | 11267 LocalContext context; |
| 11268 v8::HandleScope scope(context->GetIsolate()); | 11268 v8::HandleScope scope(context->GetIsolate()); |
| 11269 v8::Handle<v8::ObjectTemplate> nativeobject_templ = v8::ObjectTemplate::New(); | 11269 v8::Handle<v8::ObjectTemplate> nativeobject_templ = v8::ObjectTemplate::New(); |
| 11270 nativeobject_templ->Set("callback", | 11270 nativeobject_templ->Set("callback", |
| 11271 v8::FunctionTemplate::New(ThrowingDirectApiCallback)); | 11271 v8::FunctionTemplate::New(ThrowingDirectApiCallback)); |
| 11272 v8::Local<v8::Object> nativeobject_obj = nativeobject_templ->NewInstance(); | 11272 v8::Local<v8::Object> nativeobject_obj = nativeobject_templ->NewInstance(); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11320 | 11320 |
| 11321 | 11321 |
| 11322 THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { | 11322 THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) { |
| 11323 LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); | 11323 LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback); |
| 11324 } | 11324 } |
| 11325 | 11325 |
| 11326 | 11326 |
| 11327 void ThrowingDirectGetterCallback( | 11327 void ThrowingDirectGetterCallback( |
| 11328 Local<String> name, | 11328 Local<String> name, |
| 11329 const v8::PropertyCallbackInfo<v8::Value>& info) { | 11329 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 11330 v8::ThrowException(v8_str("g")); | 11330 info.GetIsolate()->ThrowException(v8_str("g")); |
| 11331 } | 11331 } |
| 11332 | 11332 |
| 11333 | 11333 |
| 11334 THREADED_TEST(LoadICFastApi_DirectCall_Throw) { | 11334 THREADED_TEST(LoadICFastApi_DirectCall_Throw) { |
| 11335 LocalContext context; | 11335 LocalContext context; |
| 11336 v8::HandleScope scope(context->GetIsolate()); | 11336 v8::HandleScope scope(context->GetIsolate()); |
| 11337 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); | 11337 v8::Handle<v8::ObjectTemplate> obj = v8::ObjectTemplate::New(); |
| 11338 obj->SetAccessor(v8_str("p1"), ThrowingDirectGetterCallback); | 11338 obj->SetAccessor(v8_str("p1"), ThrowingDirectGetterCallback); |
| 11339 context->Global()->Set(v8_str("o1"), obj->NewInstance()); | 11339 context->Global()->Set(v8_str("o1"), obj->NewInstance()); |
| 11340 v8::Handle<Value> result = CompileRun( | 11340 v8::Handle<Value> result = CompileRun( |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11931 static int interceptor_ic_exception_get_count = 0; | 11931 static int interceptor_ic_exception_get_count = 0; |
| 11932 | 11932 |
| 11933 static void InterceptorICExceptionGetter( | 11933 static void InterceptorICExceptionGetter( |
| 11934 Local<String> name, | 11934 Local<String> name, |
| 11935 const v8::PropertyCallbackInfo<v8::Value>& info) { | 11935 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 11936 ApiTestFuzzer::Fuzz(); | 11936 ApiTestFuzzer::Fuzz(); |
| 11937 if (v8_str("x")->Equals(name) && ++interceptor_ic_exception_get_count < 20) { | 11937 if (v8_str("x")->Equals(name) && ++interceptor_ic_exception_get_count < 20) { |
| 11938 info.GetReturnValue().Set(call_ic_function3); | 11938 info.GetReturnValue().Set(call_ic_function3); |
| 11939 } | 11939 } |
| 11940 if (interceptor_ic_exception_get_count == 20) { | 11940 if (interceptor_ic_exception_get_count == 20) { |
| 11941 v8::ThrowException(v8_num(42)); | 11941 info.GetIsolate()->ThrowException(v8_num(42)); |
| 11942 return; | 11942 return; |
| 11943 } | 11943 } |
| 11944 } | 11944 } |
| 11945 | 11945 |
| 11946 | 11946 |
| 11947 // Test interceptor load/call IC where the interceptor throws an | 11947 // Test interceptor load/call IC where the interceptor throws an |
| 11948 // exception once in a while. | 11948 // exception once in a while. |
| 11949 THREADED_TEST(InterceptorICGetterExceptions) { | 11949 THREADED_TEST(InterceptorICGetterExceptions) { |
| 11950 interceptor_ic_exception_get_count = 0; | 11950 interceptor_ic_exception_get_count = 0; |
| 11951 v8::HandleScope scope(CcTest::isolate()); | 11951 v8::HandleScope scope(CcTest::isolate()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 11976 | 11976 |
| 11977 | 11977 |
| 11978 static int interceptor_ic_exception_set_count = 0; | 11978 static int interceptor_ic_exception_set_count = 0; |
| 11979 | 11979 |
| 11980 static void InterceptorICExceptionSetter( | 11980 static void InterceptorICExceptionSetter( |
| 11981 Local<String> key, | 11981 Local<String> key, |
| 11982 Local<Value> value, | 11982 Local<Value> value, |
| 11983 const v8::PropertyCallbackInfo<v8::Value>& info) { | 11983 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 11984 ApiTestFuzzer::Fuzz(); | 11984 ApiTestFuzzer::Fuzz(); |
| 11985 if (++interceptor_ic_exception_set_count > 20) { | 11985 if (++interceptor_ic_exception_set_count > 20) { |
| 11986 v8::ThrowException(v8_num(42)); | 11986 info.GetIsolate()->ThrowException(v8_num(42)); |
| 11987 } | 11987 } |
| 11988 } | 11988 } |
| 11989 | 11989 |
| 11990 | 11990 |
| 11991 // Test interceptor store IC where the interceptor throws an exception | 11991 // Test interceptor store IC where the interceptor throws an exception |
| 11992 // once in a while. | 11992 // once in a while. |
| 11993 THREADED_TEST(InterceptorICSetterExceptions) { | 11993 THREADED_TEST(InterceptorICSetterExceptions) { |
| 11994 interceptor_ic_exception_set_count = 0; | 11994 interceptor_ic_exception_set_count = 0; |
| 11995 v8::HandleScope scope(CcTest::isolate()); | 11995 v8::HandleScope scope(CcTest::isolate()); |
| 11996 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); | 11996 v8::Handle<v8::ObjectTemplate> templ = ObjectTemplate::New(); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12048 env->Global()->Set(v8_str("obj"), | 12048 env->Global()->Set(v8_str("obj"), |
| 12049 templ->GetFunction()->NewInstance()); | 12049 templ->GetFunction()->NewInstance()); |
| 12050 ExpectTrue("obj.x === 42"); | 12050 ExpectTrue("obj.x === 42"); |
| 12051 ExpectTrue("!obj.propertyIsEnumerable('x')"); | 12051 ExpectTrue("!obj.propertyIsEnumerable('x')"); |
| 12052 } | 12052 } |
| 12053 | 12053 |
| 12054 | 12054 |
| 12055 static void ThrowingGetter(Local<String> name, | 12055 static void ThrowingGetter(Local<String> name, |
| 12056 const v8::PropertyCallbackInfo<v8::Value>& info) { | 12056 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 12057 ApiTestFuzzer::Fuzz(); | 12057 ApiTestFuzzer::Fuzz(); |
| 12058 ThrowException(Handle<Value>()); | 12058 info.GetIsolate()->ThrowException(Handle<Value>()); |
| 12059 info.GetReturnValue().SetUndefined(); | 12059 info.GetReturnValue().SetUndefined(); |
| 12060 } | 12060 } |
| 12061 | 12061 |
| 12062 | 12062 |
| 12063 THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) { | 12063 THREADED_TEST(VariousGetPropertiesAndThrowingCallbacks) { |
| 12064 LocalContext context; | 12064 LocalContext context; |
| 12065 HandleScope scope(context->GetIsolate()); | 12065 HandleScope scope(context->GetIsolate()); |
| 12066 | 12066 |
| 12067 Local<FunctionTemplate> templ = FunctionTemplate::New(); | 12067 Local<FunctionTemplate> templ = FunctionTemplate::New(); |
| 12068 Local<ObjectTemplate> instance_templ = templ->InstanceTemplate(); | 12068 Local<ObjectTemplate> instance_templ = templ->InstanceTemplate(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12133 TryCatch try_catch; | 12133 TryCatch try_catch; |
| 12134 } | 12134 } |
| 12135 | 12135 |
| 12136 | 12136 |
| 12137 static void ThrowFromJS(Handle<Message> message, Handle<Value> data) { | 12137 static void ThrowFromJS(Handle<Message> message, Handle<Value> data) { |
| 12138 if (--call_depth) CompileRun("throw 'ThrowInJS';"); | 12138 if (--call_depth) CompileRun("throw 'ThrowInJS';"); |
| 12139 } | 12139 } |
| 12140 | 12140 |
| 12141 | 12141 |
| 12142 static void ThrowViaApi(Handle<Message> message, Handle<Value> data) { | 12142 static void ThrowViaApi(Handle<Message> message, Handle<Value> data) { |
| 12143 if (--call_depth) ThrowException(v8_str("ThrowViaApi")); | 12143 if (--call_depth) CcTest::isolate()->ThrowException(v8_str("ThrowViaApi")); |
| 12144 } | 12144 } |
| 12145 | 12145 |
| 12146 | 12146 |
| 12147 static void WebKitLike(Handle<Message> message, Handle<Value> data) { | 12147 static void WebKitLike(Handle<Message> message, Handle<Value> data) { |
| 12148 Handle<String> errorMessageString = message->Get(); | 12148 Handle<String> errorMessageString = message->Get(); |
| 12149 CHECK(!errorMessageString.IsEmpty()); | 12149 CHECK(!errorMessageString.IsEmpty()); |
| 12150 message->GetStackTrace(); | 12150 message->GetStackTrace(); |
| 12151 message->GetScriptResourceName(); | 12151 message->GetScriptResourceName(); |
| 12152 } | 12152 } |
| 12153 | 12153 |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12492 v8::Isolate::Scope scope(CcTest::isolate()); | 12492 v8::Isolate::Scope scope(CcTest::isolate()); |
| 12493 if (kLogThreading) | 12493 if (kLogThreading) |
| 12494 printf("Start test %d\n", test_number_); | 12494 printf("Start test %d\n", test_number_); |
| 12495 CallTestNumber(test_number_); | 12495 CallTestNumber(test_number_); |
| 12496 if (kLogThreading) | 12496 if (kLogThreading) |
| 12497 printf("End test %d\n", test_number_); | 12497 printf("End test %d\n", test_number_); |
| 12498 } | 12498 } |
| 12499 | 12499 |
| 12500 | 12500 |
| 12501 static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { | 12501 static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 12502 CHECK(v8::Locker::IsLocked(CcTest::isolate())); | 12502 CHECK(v8::Locker::IsLocked(args.GetIsolate())); |
| 12503 ApiTestFuzzer::Fuzz(); | 12503 ApiTestFuzzer::Fuzz(); |
| 12504 v8::Unlocker unlocker(CcTest::isolate()); | 12504 v8::Unlocker unlocker(args.GetIsolate()); |
| 12505 const char* code = "throw 7;"; | 12505 const char* code = "throw 7;"; |
| 12506 { | 12506 { |
| 12507 v8::Locker nested_locker(CcTest::isolate()); | 12507 v8::Locker nested_locker(args.GetIsolate()); |
| 12508 v8::HandleScope scope(args.GetIsolate()); | 12508 v8::HandleScope scope(args.GetIsolate()); |
| 12509 v8::Handle<Value> exception; | 12509 v8::Handle<Value> exception; |
| 12510 { v8::TryCatch try_catch; | 12510 { v8::TryCatch try_catch; |
| 12511 v8::Handle<Value> value = CompileRun(code); | 12511 v8::Handle<Value> value = CompileRun(code); |
| 12512 CHECK(value.IsEmpty()); | 12512 CHECK(value.IsEmpty()); |
| 12513 CHECK(try_catch.HasCaught()); | 12513 CHECK(try_catch.HasCaught()); |
| 12514 // Make sure to wrap the exception in a new handle because | 12514 // Make sure to wrap the exception in a new handle because |
| 12515 // the handle returned from the TryCatch is destroyed | 12515 // the handle returned from the TryCatch is destroyed |
| 12516 // when the TryCatch is destroyed. | 12516 // when the TryCatch is destroyed. |
| 12517 exception = Local<Value>::New(try_catch.Exception()); | 12517 exception = Local<Value>::New(try_catch.Exception()); |
| 12518 } | 12518 } |
| 12519 v8::ThrowException(exception); | 12519 args.GetIsolate()->ThrowException(exception); |
| 12520 } | 12520 } |
| 12521 } | 12521 } |
| 12522 | 12522 |
| 12523 | 12523 |
| 12524 static void ThrowInJSNoCatch(const v8::FunctionCallbackInfo<v8::Value>& args) { | 12524 static void ThrowInJSNoCatch(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 12525 CHECK(v8::Locker::IsLocked(CcTest::isolate())); | 12525 CHECK(v8::Locker::IsLocked(CcTest::isolate())); |
| 12526 ApiTestFuzzer::Fuzz(); | 12526 ApiTestFuzzer::Fuzz(); |
| 12527 v8::Unlocker unlocker(CcTest::isolate()); | 12527 v8::Unlocker unlocker(CcTest::isolate()); |
| 12528 const char* code = "throw 7;"; | 12528 const char* code = "throw 7;"; |
| 12529 { | 12529 { |
| (...skipping 7804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20334 bool access_check_fail_thrown = false; | 20334 bool access_check_fail_thrown = false; |
| 20335 bool catch_callback_called = false; | 20335 bool catch_callback_called = false; |
| 20336 | 20336 |
| 20337 | 20337 |
| 20338 // Failed access check callback that performs a GC on each invocation. | 20338 // Failed access check callback that performs a GC on each invocation. |
| 20339 void FailedAccessCheckThrows(Local<v8::Object> target, | 20339 void FailedAccessCheckThrows(Local<v8::Object> target, |
| 20340 v8::AccessType type, | 20340 v8::AccessType type, |
| 20341 Local<v8::Value> data) { | 20341 Local<v8::Value> data) { |
| 20342 access_check_fail_thrown = true; | 20342 access_check_fail_thrown = true; |
| 20343 i::PrintF("Access check failed. Error thrown.\n"); | 20343 i::PrintF("Access check failed. Error thrown.\n"); |
| 20344 v8::ThrowException(v8::Exception::Error(v8_str("cross context"))); | 20344 CcTest::isolate()->ThrowException( |
| 20345 v8::Exception::Error(v8_str("cross context"))); |
| 20345 } | 20346 } |
| 20346 | 20347 |
| 20347 | 20348 |
| 20348 void CatcherCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { | 20349 void CatcherCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { |
| 20349 for (int i = 0; i < args.Length(); i++) { | 20350 for (int i = 0; i < args.Length(); i++) { |
| 20350 i::PrintF("%s\n", *String::Utf8Value(args[i])); | 20351 i::PrintF("%s\n", *String::Utf8Value(args[i])); |
| 20351 } | 20352 } |
| 20352 catch_callback_called = true; | 20353 catch_callback_called = true; |
| 20353 } | 20354 } |
| 20354 | 20355 |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20577 Local<Object> data2 = v8::Object::New(); | 20578 Local<Object> data2 = v8::Object::New(); |
| 20578 function_new_expected_env = data2; | 20579 function_new_expected_env = data2; |
| 20579 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); | 20580 Local<Function> func2 = Function::New(isolate, FunctionNewCallback, data2); |
| 20580 CHECK(!func2->IsNull()); | 20581 CHECK(!func2->IsNull()); |
| 20581 CHECK_NE(func, func2); | 20582 CHECK_NE(func, func2); |
| 20582 env->Global()->Set(v8_str("func2"), func2); | 20583 env->Global()->Set(v8_str("func2"), func2); |
| 20583 Local<Value> result2 = CompileRun("func2();"); | 20584 Local<Value> result2 = CompileRun("func2();"); |
| 20584 CHECK_EQ(v8::Integer::New(17, isolate), result2); | 20585 CHECK_EQ(v8::Integer::New(17, isolate), result2); |
| 20585 } | 20586 } |
| 20586 | 20587 |
| OLD | NEW |