Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: Source/bindings/tests/results/V8TestObject.cpp

Issue 105693002: Generate a bit less code to handle failed arity checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 3055 matching lines...) Expand 10 before | Expand all | Expand 10 after
3066 { 3066 {
3067 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3067 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3068 TestObjV8Internal::methodWithEnumArgMethod(info); 3068 TestObjV8Internal::methodWithEnumArgMethod(info);
3069 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3069 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3070 } 3070 }
3071 3071
3072 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info) 3072 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
3073 { 3073 {
3074 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate()); 3074 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate());
3075 if (UNLIKELY(info.Length() < 2)) { 3075 if (UNLIKELY(info.Length() < 2)) {
3076 throwTypeError(ExceptionMessages::failedToExecute("methodThatRequiresAll ArgsAndThrows", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Leng th())), info.GetIsolate()); 3076 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
3077 exceptionState.throwIfNeeded();
3077 return; 3078 return;
3078 } 3079 }
3079 TestObj* imp = V8TestObject::toNative(info.Holder()); 3080 TestObj* imp = V8TestObject::toNative(info.Holder());
3080 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 3081 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
3081 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0); 3082 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0);
3082 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState); 3083 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState);
3083 if (exceptionState.throwIfNeeded()) 3084 if (exceptionState.throwIfNeeded())
3084 return; 3085 return;
3085 v8SetReturnValue(info, result.release()); 3086 v8SetReturnValue(info, result.release());
3086 } 3087 }
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3991 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 3992 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate());
3992 return; 3993 return;
3993 } 3994 }
3994 TestObj* imp = V8TestObject::toNative(info.Holder()); 3995 TestObj* imp = V8TestObject::toNative(info.Holder());
3995 V8TRYCATCH_VOID(Vector<unsigned>, sequenceArg, toNativeArray<unsigned>(info[ 0], 1, info.GetIsolate())); 3996 V8TRYCATCH_VOID(Vector<unsigned>, sequenceArg, toNativeArray<unsigned>(info[ 0], 1, info.GetIsolate()));
3996 imp->overloadedMethod(sequenceArg); 3997 imp->overloadedMethod(sequenceArg);
3997 } 3998 }
3998 3999
3999 static void overloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo) 4000 static void overloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo)
4000 { 4001 {
4002 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethod", "TestObject", info.Holder(), info.GetIsolate());
4001 if (((info.Length() == 1))) { 4003 if (((info.Length() == 1))) {
4002 overloadedMethod1Method(info); 4004 overloadedMethod1Method(info);
4003 return; 4005 return;
4004 } 4006 }
4005 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsFunction()))) { 4007 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsFunction()))) {
4006 overloadedMethod2Method(info); 4008 overloadedMethod2Method(info);
4007 return; 4009 return;
4008 } 4010 }
4009 if (((info.Length() == 1) && (V8TestObject::hasInstance(info[0], info.GetIso late(), worldType(info.GetIsolate()))))) { 4011 if (((info.Length() == 1) && (V8TestObject::hasInstance(info[0], info.GetIso late(), worldType(info.GetIsolate()))))) {
4010 overloadedMethod3Method(info); 4012 overloadedMethod3Method(info);
4011 return; 4013 return;
4012 } 4014 }
4013 if (((info.Length() == 1) && (info[0]->IsArray()))) { 4015 if (((info.Length() == 1) && (info[0]->IsArray()))) {
4014 overloadedMethod4Method(info); 4016 overloadedMethod4Method(info);
4015 return; 4017 return;
4016 } 4018 }
4017 if (((info.Length() == 1) && (info[0]->IsArray()))) { 4019 if (((info.Length() == 1) && (info[0]->IsArray()))) {
4018 overloadedMethod5Method(info); 4020 overloadedMethod5Method(info);
4019 return; 4021 return;
4020 } 4022 }
4021 if (UNLIKELY(info.Length() < 1)) { 4023 if (UNLIKELY(info.Length() < 1)) {
4022 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 4024 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4025 exceptionState.throwIfNeeded();
4023 return; 4026 return;
4024 } 4027 }
4025 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestO bject", "No function was found that matched the signature provided."), info.GetI solate()); 4028 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4029 exceptionState.throwIfNeeded();
4026 } 4030 }
4027 4031
4028 static void overloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 4032 static void overloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
4029 { 4033 {
4030 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4034 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4031 TestObjV8Internal::overloadedMethodMethod(info); 4035 TestObjV8Internal::overloadedMethodMethod(info);
4032 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4036 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4033 } 4037 }
4034 4038
4035 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4039 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 19 matching lines...) Expand all
4055 return; 4059 return;
4056 } 4060 }
4057 TestObj* imp = V8TestObject::toNative(info.Holder()); 4061 TestObj* imp = V8TestObject::toNative(info.Holder());
4058 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[0])) : 0); 4062 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[0])) : 0);
4059 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 4063 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
4060 imp->overloadedMethodA(objArg, strArg); 4064 imp->overloadedMethodA(objArg, strArg);
4061 } 4065 }
4062 4066
4063 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4067 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4064 { 4068 {
4069 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodA", "TestObject", info.Holder(), info.GetIsolate());
4065 if (((info.Length() == 1) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate())))) || ((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance(info[0], info.GetIsolat e(), worldType(info.GetIsolate()))))) { 4070 if (((info.Length() == 1) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate())))) || ((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance(info[0], info.GetIsolat e(), worldType(info.GetIsolate()))))) {
4066 overloadedMethodA1Method(info); 4071 overloadedMethodA1Method(info);
4067 return; 4072 return;
4068 } 4073 }
4069 if (((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate()))))) { 4074 if (((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate()))))) {
4070 overloadedMethodA2Method(info); 4075 overloadedMethodA2Method(info);
4071 return; 4076 return;
4072 } 4077 }
4073 if (UNLIKELY(info.Length() < 1)) { 4078 if (UNLIKELY(info.Length() < 1)) {
4074 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4079 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4080 exceptionState.throwIfNeeded();
4075 return; 4081 return;
4076 } 4082 }
4077 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", "Test Object", "No function was found that matched the signature provided."), info.Get Isolate()); 4083 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4084 exceptionState.throwIfNeeded();
4078 } 4085 }
4079 4086
4080 static void overloadedMethodAMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 4087 static void overloadedMethodAMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
4081 { 4088 {
4082 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4089 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4083 TestObjV8Internal::overloadedMethodAMethod(info); 4090 TestObjV8Internal::overloadedMethodAMethod(info);
4084 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4091 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4085 } 4092 }
4086 4093
4087 static void overloadedMethodB1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4094 static void overloadedMethodB1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 13 matching lines...) Expand all
4101 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4108 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate());
4102 return; 4109 return;
4103 } 4110 }
4104 TestObj* imp = V8TestObject::toNative(info.Holder()); 4111 TestObj* imp = V8TestObject::toNative(info.Holder());
4105 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4112 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4106 imp->overloadedMethodB(strArg); 4113 imp->overloadedMethodB(strArg);
4107 } 4114 }
4108 4115
4109 static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4116 static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4110 { 4117 {
4118 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodB", "TestObject", info.Holder(), info.GetIsolate());
4111 if (((info.Length() == 1))) { 4119 if (((info.Length() == 1))) {
4112 overloadedMethodB1Method(info); 4120 overloadedMethodB1Method(info);
4113 return; 4121 return;
4114 } 4122 }
4115 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsUndefined() || info[0]->IsString() || info[0]->IsObject()))) { 4123 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsUndefined() || info[0]->IsString() || info[0]->IsObject()))) {
4116 overloadedMethodB2Method(info); 4124 overloadedMethodB2Method(info);
4117 return; 4125 return;
4118 } 4126 }
4119 if (UNLIKELY(info.Length() < 1)) { 4127 if (UNLIKELY(info.Length() < 1)) {
4120 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4128 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4129 exceptionState.throwIfNeeded();
4121 return; 4130 return;
4122 } 4131 }
4123 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", "Test Object", "No function was found that matched the signature provided."), info.Get Isolate()); 4132 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4133 exceptionState.throwIfNeeded();
4124 } 4134 }
4125 4135
4126 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 4136 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
4127 { 4137 {
4128 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4129 TestObjV8Internal::overloadedMethodBMethod(info); 4139 TestObjV8Internal::overloadedMethodBMethod(info);
4130 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4131 } 4141 }
4132 4142
4133 static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 4143 static void classMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4242 { 4252 {
4243 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4253 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4244 TestObjV8Internal::methodWithUnsignedLongSequenceMethod(info); 4254 TestObjV8Internal::methodWithUnsignedLongSequenceMethod(info);
4245 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4255 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4246 } 4256 }
4247 4257
4248 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 4258 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
4249 { 4259 {
4250 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestObject", info.Holder(), info.GetIsolate()); 4260 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestObject", info.Holder(), info.GetIsolate());
4251 if (UNLIKELY(info.Length() < 1)) { 4261 if (UNLIKELY(info.Length() < 1)) {
4252 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Ge tIsolate()); 4262 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4263 exceptionState.throwIfNeeded();
4253 return; 4264 return;
4254 } 4265 }
4255 TestObj* imp = V8TestObject::toNative(info.Holder()); 4266 TestObj* imp = V8TestObject::toNative(info.Holder());
4256 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 4267 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
4257 Vector<String> result = imp->stringArrayFunction(values, exceptionState); 4268 Vector<String> result = imp->stringArrayFunction(values, exceptionState);
4258 if (exceptionState.throwIfNeeded()) 4269 if (exceptionState.throwIfNeeded())
4259 return; 4270 return;
4260 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); 4271 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
4261 } 4272 }
4262 4273
4263 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 4274 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
4264 { 4275 {
4265 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4276 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4266 TestObjV8Internal::stringArrayFunctionMethod(info); 4277 TestObjV8Internal::stringArrayFunctionMethod(info);
4267 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4278 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4268 } 4279 }
4269 4280
4270 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info) 4281 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
4271 { 4282 {
4272 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate()); 4283 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate());
4273 if (UNLIKELY(info.Length() < 1)) { 4284 if (UNLIKELY(info.Length() < 1)) {
4274 throwTypeError(ExceptionMessages::failedToExecute("domStringListFunction ", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate()); 4285 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4286 exceptionState.throwIfNeeded();
4275 return; 4287 return;
4276 } 4288 }
4277 TestObj* imp = V8TestObject::toNative(info.Holder()); 4289 TestObj* imp = V8TestObject::toNative(info.Holder());
4278 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0); 4290 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0);
4279 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate); 4291 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate);
4280 if (exceptionState.throwIfNeeded()) 4292 if (exceptionState.throwIfNeeded())
4281 return; 4293 return;
4282 v8SetReturnValue(info, result.release()); 4294 v8SetReturnValue(info, result.release());
4283 } 4295 }
4284 4296
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4393 { 4405 {
4394 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4406 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4395 TestObjV8Internal::svgPointMethodMethod(info); 4407 TestObjV8Internal::svgPointMethodMethod(info);
4396 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4408 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4397 } 4409 }
4398 4410
4399 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info) 4411 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info)
4400 { 4412 {
4401 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictSVGPo intMethod", "TestObject", info.Holder(), info.GetIsolate()); 4413 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictSVGPo intMethod", "TestObject", info.Holder(), info.GetIsolate());
4402 if (UNLIKELY(info.Length() < 2)) { 4414 if (UNLIKELY(info.Length() < 2)) {
4403 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.G etIsolate()); 4415 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
4416 exceptionState.throwIfNeeded();
4404 return; 4417 return;
4405 } 4418 }
4406 TestObj* imp = V8TestObject::toNative(info.Holder()); 4419 TestObj* imp = V8TestObject::toNative(info.Holder());
4407 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) { 4420 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) {
4408 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate()); 4421 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate());
4409 return; 4422 return;
4410 } 4423 }
4411 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, item, V8SVGPoint::has Instance(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint: :toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0); 4424 V8TRYCATCH_VOID(RefPtr<SVGPropertyTearOff<SVGPoint> >, item, V8SVGPoint::has Instance(info[0], info.GetIsolate(), worldType(info.GetIsolate())) ? V8SVGPoint: :toNative(v8::Handle<v8::Object>::Cast(info[0])) : 0);
4412 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1])); 4425 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1]));
4413 if (!item) { 4426 if (!item) {
(...skipping 23 matching lines...) Expand all
4437 { 4450 {
4438 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4451 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4439 TestObjV8Internal::orangeMethod(info); 4452 TestObjV8Internal::orangeMethod(info);
4440 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4453 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4441 } 4454 }
4442 4455
4443 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 4456 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
4444 { 4457 {
4445 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictFunct ion", "TestObject", info.Holder(), info.GetIsolate()); 4458 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictFunct ion", "TestObject", info.Holder(), info.GetIsolate());
4446 if (UNLIKELY(info.Length() < 3)) { 4459 if (UNLIKELY(info.Length() < 3)) {
4447 throwTypeError(ExceptionMessages::failedToExecute("strictFunction", "Tes tObject", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsol ate()); 4460 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(3, i nfo.Length()));
4461 exceptionState.throwIfNeeded();
4448 return; 4462 return;
4449 } 4463 }
4450 TestObj* imp = V8TestObject::toNative(info.Holder()); 4464 TestObj* imp = V8TestObject::toNative(info.Holder());
4451 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); 4465 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]);
4452 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue())); 4466 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue()));
4453 V8TRYCATCH_VOID(int, b, toInt32(info[2])); 4467 V8TRYCATCH_VOID(int, b, toInt32(info[2]));
4454 bool result = imp->strictFunction(str, a, b, exceptionState); 4468 bool result = imp->strictFunction(str, a, b, exceptionState);
4455 if (exceptionState.throwIfNeeded()) 4469 if (exceptionState.throwIfNeeded())
4456 return; 4470 return;
4457 v8SetReturnValueBool(info, result); 4471 v8SetReturnValueBool(info, result);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4612 return; 4626 return;
4613 } 4627 }
4614 TestObj* imp = V8TestObject::toNative(info.Holder()); 4628 TestObj* imp = V8TestObject::toNative(info.Holder());
4615 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4629 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4616 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4630 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4617 imp->overloadedPerWorldMethod(strArg, longArg); 4631 imp->overloadedPerWorldMethod(strArg, longArg);
4618 } 4632 }
4619 4633
4620 static void overloadedPerWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 4634 static void overloadedPerWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
4621 { 4635 {
4636 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedP erWorldMethod", "TestObject", info.Holder(), info.GetIsolate());
4622 if (((info.Length() == 1))) { 4637 if (((info.Length() == 1))) {
4623 overloadedPerWorldMethod1Method(info); 4638 overloadedPerWorldMethod1Method(info);
4624 return; 4639 return;
4625 } 4640 }
4626 if (((info.Length() == 2))) { 4641 if (((info.Length() == 2))) {
4627 overloadedPerWorldMethod2Method(info); 4642 overloadedPerWorldMethod2Method(info);
4628 return; 4643 return;
4629 } 4644 }
4630 if (UNLIKELY(info.Length() < 1)) { 4645 if (UNLIKELY(info.Length() < 1)) {
4631 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), in fo.GetIsolate()); 4646 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4647 exceptionState.throwIfNeeded();
4632 return; 4648 return;
4633 } 4649 }
4634 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMethod" , "TestObject", "No function was found that matched the signature provided."), i nfo.GetIsolate()); 4650 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4651 exceptionState.throwIfNeeded();
4635 } 4652 }
4636 4653
4637 static void overloadedPerWorldMethodMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info) 4654 static void overloadedPerWorldMethodMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
4638 { 4655 {
4639 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4656 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4640 TestObjV8Internal::overloadedPerWorldMethodMethod(info); 4657 TestObjV8Internal::overloadedPerWorldMethodMethod(info);
4641 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4658 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4642 } 4659 }
4643 4660
4644 static void overloadedPerWorldMethod2MethodForMainWorld(const v8::FunctionCallba ckInfo<v8::Value>& info) 4661 static void overloadedPerWorldMethod2MethodForMainWorld(const v8::FunctionCallba ckInfo<v8::Value>& info)
4645 { 4662 {
4646 if (UNLIKELY(info.Length() < 2)) { 4663 if (UNLIKELY(info.Length() < 2)) {
4647 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), in fo.GetIsolate()); 4664 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), in fo.GetIsolate());
4648 return; 4665 return;
4649 } 4666 }
4650 TestObj* imp = V8TestObject::toNative(info.Holder()); 4667 TestObj* imp = V8TestObject::toNative(info.Holder());
4651 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4668 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4652 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4669 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4653 imp->overloadedPerWorldMethod(strArg, longArg); 4670 imp->overloadedPerWorldMethod(strArg, longArg);
4654 } 4671 }
4655 4672
4656 static void overloadedPerWorldMethodMethodForMainWorld(const v8::FunctionCallbac kInfo<v8::Value>& info) 4673 static void overloadedPerWorldMethodMethodForMainWorld(const v8::FunctionCallbac kInfo<v8::Value>& info)
4657 { 4674 {
4675 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedP erWorldMethod", "TestObject", info.Holder(), info.GetIsolate());
4658 if (((info.Length() == 1))) { 4676 if (((info.Length() == 1))) {
4659 overloadedPerWorldMethod1MethodForMainWorld(info); 4677 overloadedPerWorldMethod1MethodForMainWorld(info);
4660 return; 4678 return;
4661 } 4679 }
4662 if (((info.Length() == 2))) { 4680 if (((info.Length() == 2))) {
4663 overloadedPerWorldMethod2MethodForMainWorld(info); 4681 overloadedPerWorldMethod2MethodForMainWorld(info);
4664 return; 4682 return;
4665 } 4683 }
4666 if (UNLIKELY(info.Length() < 1)) { 4684 if (UNLIKELY(info.Length() < 1)) {
4667 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), in fo.GetIsolate()); 4685 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4686 exceptionState.throwIfNeeded();
4668 return; 4687 return;
4669 } 4688 }
4670 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMethod" , "TestObject", "No function was found that matched the signature provided."), i nfo.GetIsolate()); 4689 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4690 exceptionState.throwIfNeeded();
4671 } 4691 }
4672 4692
4673 static void overloadedPerWorldMethodMethodCallbackForMainWorld(const v8::Functio nCallbackInfo<v8::Value>& info) 4693 static void overloadedPerWorldMethodMethodCallbackForMainWorld(const v8::Functio nCallbackInfo<v8::Value>& info)
4674 { 4694 {
4675 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4695 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4676 TestObjV8Internal::overloadedPerWorldMethodMethodForMainWorld(info); 4696 TestObjV8Internal::overloadedPerWorldMethodMethodForMainWorld(info);
4677 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4697 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4678 } 4698 }
4679 4699
4680 static void activityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value >& info) 4700 static void activityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value >& info)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4816 return; 4836 return;
4817 } 4837 }
4818 TestObj* imp = V8TestObject::toNative(info.Holder()); 4838 TestObj* imp = V8TestObject::toNative(info.Holder());
4819 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4839 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4820 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4840 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4821 imp->overloadedActivityLoggedMethod(strArg, longArg); 4841 imp->overloadedActivityLoggedMethod(strArg, longArg);
4822 } 4842 }
4823 4843
4824 static void overloadedActivityLoggedMethodMethod(const v8::FunctionCallbackInfo< v8::Value>& info) 4844 static void overloadedActivityLoggedMethodMethod(const v8::FunctionCallbackInfo< v8::Value>& info)
4825 { 4845 {
4846 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedA ctivityLoggedMethod", "TestObject", info.Holder(), info.GetIsolate());
4826 if (((info.Length() == 1))) { 4847 if (((info.Length() == 1))) {
4827 overloadedActivityLoggedMethod1Method(info); 4848 overloadedActivityLoggedMethod1Method(info);
4828 return; 4849 return;
4829 } 4850 }
4830 if (((info.Length() == 2))) { 4851 if (((info.Length() == 2))) {
4831 overloadedActivityLoggedMethod2Method(info); 4852 overloadedActivityLoggedMethod2Method(info);
4832 return; 4853 return;
4833 } 4854 }
4834 if (UNLIKELY(info.Length() < 1)) { 4855 if (UNLIKELY(info.Length() < 1)) {
4835 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length() )), info.GetIsolate()); 4856 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4857 exceptionState.throwIfNeeded();
4836 return; 4858 return;
4837 } 4859 }
4838 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLoggedM ethod", "TestObject", "No function was found that matched the signature provided ."), info.GetIsolate()); 4860 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4861 exceptionState.throwIfNeeded();
4839 } 4862 }
4840 4863
4841 static void overloadedActivityLoggedMethodMethodCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 4864 static void overloadedActivityLoggedMethodMethodCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
4842 { 4865 {
4843 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4866 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4844 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 4867 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
4845 if (contextData && contextData->activityLogger()) { 4868 if (contextData && contextData->activityLogger()) {
4846 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); 4869 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0);
4847 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method"); 4870 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method");
4848 } 4871 }
4849 TestObjV8Internal::overloadedActivityLoggedMethodMethod(info); 4872 TestObjV8Internal::overloadedActivityLoggedMethodMethod(info);
4850 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4873 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4851 } 4874 }
4852 4875
4853 static void overloadedActivityLoggedMethod2MethodForMainWorld(const v8::Function CallbackInfo<v8::Value>& info) 4876 static void overloadedActivityLoggedMethod2MethodForMainWorld(const v8::Function CallbackInfo<v8::Value>& info)
4854 { 4877 {
4855 if (UNLIKELY(info.Length() < 2)) { 4878 if (UNLIKELY(info.Length() < 2)) {
4856 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length() )), info.GetIsolate()); 4879 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length() )), info.GetIsolate());
4857 return; 4880 return;
4858 } 4881 }
4859 TestObj* imp = V8TestObject::toNative(info.Holder()); 4882 TestObj* imp = V8TestObject::toNative(info.Holder());
4860 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4883 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4861 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4884 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4862 imp->overloadedActivityLoggedMethod(strArg, longArg); 4885 imp->overloadedActivityLoggedMethod(strArg, longArg);
4863 } 4886 }
4864 4887
4865 static void overloadedActivityLoggedMethodMethodForMainWorld(const v8::FunctionC allbackInfo<v8::Value>& info) 4888 static void overloadedActivityLoggedMethodMethodForMainWorld(const v8::FunctionC allbackInfo<v8::Value>& info)
4866 { 4889 {
4890 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedA ctivityLoggedMethod", "TestObject", info.Holder(), info.GetIsolate());
4867 if (((info.Length() == 1))) { 4891 if (((info.Length() == 1))) {
4868 overloadedActivityLoggedMethod1MethodForMainWorld(info); 4892 overloadedActivityLoggedMethod1MethodForMainWorld(info);
4869 return; 4893 return;
4870 } 4894 }
4871 if (((info.Length() == 2))) { 4895 if (((info.Length() == 2))) {
4872 overloadedActivityLoggedMethod2MethodForMainWorld(info); 4896 overloadedActivityLoggedMethod2MethodForMainWorld(info);
4873 return; 4897 return;
4874 } 4898 }
4875 if (UNLIKELY(info.Length() < 1)) { 4899 if (UNLIKELY(info.Length() < 1)) {
4876 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length() )), info.GetIsolate()); 4900 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
4901 exceptionState.throwIfNeeded();
4877 return; 4902 return;
4878 } 4903 }
4879 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLoggedM ethod", "TestObject", "No function was found that matched the signature provided ."), info.GetIsolate()); 4904 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4905 exceptionState.throwIfNeeded();
4880 } 4906 }
4881 4907
4882 static void overloadedActivityLoggedMethodMethodCallbackForMainWorld(const v8::F unctionCallbackInfo<v8::Value>& info) 4908 static void overloadedActivityLoggedMethodMethodCallbackForMainWorld(const v8::F unctionCallbackInfo<v8::Value>& info)
4883 { 4909 {
4884 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4910 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4885 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 4911 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
4886 if (contextData && contextData->activityLogger()) { 4912 if (contextData && contextData->activityLogger()) {
4887 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); 4913 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0);
4888 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method"); 4914 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method");
4889 } 4915 }
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
5404 fromInternalPointer(object)->deref(); 5430 fromInternalPointer(object)->deref();
5405 } 5431 }
5406 5432
5407 template<> 5433 template<>
5408 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5434 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5409 { 5435 {
5410 return toV8(impl, creationContext, isolate); 5436 return toV8(impl, creationContext, isolate);
5411 } 5437 }
5412 5438
5413 } // namespace WebCore 5439 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestNamedConstructor.cpp ('k') | Source/bindings/tests/results/V8TestObjectPython.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698