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

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: 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 3059 matching lines...) Expand 10 before | Expand all | Expand 10 after
3070 { 3070 {
3071 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 3071 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
3072 TestObjV8Internal::methodWithEnumArgMethod(info); 3072 TestObjV8Internal::methodWithEnumArgMethod(info);
3073 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 3073 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
3074 } 3074 }
3075 3075
3076 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info) 3076 static void methodThatRequiresAllArgsAndThrowsMethod(const v8::FunctionCallbackI nfo<v8::Value>& info)
3077 { 3077 {
3078 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate()); 3078 ExceptionState exceptionState(ExceptionState::ExecutionContext, "methodThatR equiresAllArgsAndThrows", "TestObject", info.Holder(), info.GetIsolate());
3079 if (UNLIKELY(info.Length() < 2)) { 3079 if (UNLIKELY(info.Length() < 2)) {
3080 throwTypeError(ExceptionMessages::failedToExecute("methodThatRequiresAll ArgsAndThrows", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Leng th())), info.GetIsolate()); 3080 exceptionState.notEnoughArguments(2, info.Length());
3081 return; 3081 return;
3082 } 3082 }
3083 TestObj* imp = V8TestObject::toNative(info.Holder()); 3083 TestObj* imp = V8TestObject::toNative(info.Holder());
3084 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 3084 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
3085 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0); 3085 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0);
3086 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState); 3086 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, obj Arg, exceptionState);
3087 if (exceptionState.throwIfNeeded()) 3087 if (exceptionState.throwIfNeeded())
3088 return; 3088 return;
3089 v8SetReturnValue(info, result.release()); 3089 v8SetReturnValue(info, result.release());
3090 } 3090 }
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after
3995 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 3995 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate());
3996 return; 3996 return;
3997 } 3997 }
3998 TestObj* imp = V8TestObject::toNative(info.Holder()); 3998 TestObj* imp = V8TestObject::toNative(info.Holder());
3999 V8TRYCATCH_VOID(Vector<unsigned>, sequenceArg, toNativeArray<unsigned>(info[ 0], 1, info.GetIsolate())); 3999 V8TRYCATCH_VOID(Vector<unsigned>, sequenceArg, toNativeArray<unsigned>(info[ 0], 1, info.GetIsolate()));
4000 imp->overloadedMethod(sequenceArg); 4000 imp->overloadedMethod(sequenceArg);
4001 } 4001 }
4002 4002
4003 static void overloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo) 4003 static void overloadedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& in fo)
4004 { 4004 {
4005 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethod", "TestObject", info.Holder(), info.GetIsolate());
4005 if (((info.Length() == 1))) { 4006 if (((info.Length() == 1))) {
4006 overloadedMethod1Method(info); 4007 overloadedMethod1Method(info);
4007 return; 4008 return;
4008 } 4009 }
4009 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsFunction()))) { 4010 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsFunction()))) {
4010 overloadedMethod2Method(info); 4011 overloadedMethod2Method(info);
4011 return; 4012 return;
4012 } 4013 }
4013 if (((info.Length() == 1) && (V8TestObject::hasInstance(info[0], info.GetIso late(), worldType(info.GetIsolate()))))) { 4014 if (((info.Length() == 1) && (V8TestObject::hasInstance(info[0], info.GetIso late(), worldType(info.GetIsolate()))))) {
4014 overloadedMethod3Method(info); 4015 overloadedMethod3Method(info);
4015 return; 4016 return;
4016 } 4017 }
4017 if (((info.Length() == 1) && (info[0]->IsArray()))) { 4018 if (((info.Length() == 1) && (info[0]->IsArray()))) {
4018 overloadedMethod4Method(info); 4019 overloadedMethod4Method(info);
4019 return; 4020 return;
4020 } 4021 }
4021 if (((info.Length() == 1) && (info[0]->IsArray()))) { 4022 if (((info.Length() == 1) && (info[0]->IsArray()))) {
4022 overloadedMethod5Method(info); 4023 overloadedMethod5Method(info);
4023 return; 4024 return;
4024 } 4025 }
4025 if (UNLIKELY(info.Length() < 1)) { 4026 if (UNLIKELY(info.Length() < 1)) {
4026 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "T estObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIs olate()); 4027 exceptionState.notEnoughArguments(1, info.Length());
4027 return; 4028 return;
4028 } 4029 }
4029 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethod", "TestO bject", "No function was found that matched the signature provided."), info.GetI solate()); 4030 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4031 exceptionState.throwIfNeeded();
4030 } 4032 }
4031 4033
4032 static void overloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info) 4034 static void overloadedMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& info)
4033 { 4035 {
4034 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4036 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4035 TestObjV8Internal::overloadedMethodMethod(info); 4037 TestObjV8Internal::overloadedMethodMethod(info);
4036 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4038 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4037 } 4039 }
4038 4040
4039 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4041 static void overloadedMethodA1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 19 matching lines...) Expand all
4059 return; 4061 return;
4060 } 4062 }
4061 TestObj* imp = V8TestObject::toNative(info.Holder()); 4063 TestObj* imp = V8TestObject::toNative(info.Holder());
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); 4064 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[0], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[0])) : 0);
4063 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]); 4065 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[1]);
4064 imp->overloadedMethodA(objArg, strArg); 4066 imp->overloadedMethodA(objArg, strArg);
4065 } 4067 }
4066 4068
4067 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4069 static void overloadedMethodAMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4068 { 4070 {
4071 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodA", "TestObject", info.Holder(), info.GetIsolate());
4069 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()))))) { 4072 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 overloadedMethodA1Method(info); 4073 overloadedMethodA1Method(info);
4071 return; 4074 return;
4072 } 4075 }
4073 if (((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate()))))) { 4076 if (((info.Length() == 2) && (info[0]->IsNull() || V8TestObject::hasInstance (info[0], info.GetIsolate(), worldType(info.GetIsolate()))))) {
4074 overloadedMethodA2Method(info); 4077 overloadedMethodA2Method(info);
4075 return; 4078 return;
4076 } 4079 }
4077 if (UNLIKELY(info.Length() < 1)) { 4080 if (UNLIKELY(info.Length() < 1)) {
4078 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4081 exceptionState.notEnoughArguments(1, info.Length());
4079 return; 4082 return;
4080 } 4083 }
4081 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodA", "Test Object", "No function was found that matched the signature provided."), info.Get Isolate()); 4084 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4085 exceptionState.throwIfNeeded();
4082 } 4086 }
4083 4087
4084 static void overloadedMethodAMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 4088 static void overloadedMethodAMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
4085 { 4089 {
4086 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4090 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4087 TestObjV8Internal::overloadedMethodAMethod(info); 4091 TestObjV8Internal::overloadedMethodAMethod(info);
4088 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4092 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4089 } 4093 }
4090 4094
4091 static void overloadedMethodB1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 4095 static void overloadedMethodB1Method(const v8::FunctionCallbackInfo<v8::Value>& info)
(...skipping 13 matching lines...) Expand all
4105 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4109 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate());
4106 return; 4110 return;
4107 } 4111 }
4108 TestObj* imp = V8TestObject::toNative(info.Holder()); 4112 TestObj* imp = V8TestObject::toNative(info.Holder());
4109 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4113 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4110 imp->overloadedMethodB(strArg); 4114 imp->overloadedMethodB(strArg);
4111 } 4115 }
4112 4116
4113 static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 4117 static void overloadedMethodBMethod(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
4114 { 4118 {
4119 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedM ethodB", "TestObject", info.Holder(), info.GetIsolate());
4115 if (((info.Length() == 1))) { 4120 if (((info.Length() == 1))) {
4116 overloadedMethodB1Method(info); 4121 overloadedMethodB1Method(info);
4117 return; 4122 return;
4118 } 4123 }
4119 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsUndefined() || info[0]->IsString() || info[0]->IsObject()))) { 4124 if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsUndefined() || info[0]->IsString() || info[0]->IsObject()))) {
4120 overloadedMethodB2Method(info); 4125 overloadedMethodB2Method(info);
4121 return; 4126 return;
4122 } 4127 }
4123 if (UNLIKELY(info.Length() < 1)) { 4128 if (UNLIKELY(info.Length() < 1)) {
4124 throwTypeError(ExceptionMessages::failedToExecute("overloadedMethodB", " TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetI solate()); 4129 exceptionState.notEnoughArguments(1, info.Length());
4125 return; 4130 return;
4126 } 4131 }
4127 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();
4128 } 4134 }
4129 4135
4130 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 4136 static void overloadedMethodBMethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
4131 { 4137 {
4132 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4138 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4133 TestObjV8Internal::overloadedMethodBMethod(info); 4139 TestObjV8Internal::overloadedMethodBMethod(info);
4134 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4140 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4135 } 4141 }
4136 4142
4137 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
4246 { 4252 {
4247 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4253 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4248 TestObjV8Internal::methodWithUnsignedLongSequenceMethod(info); 4254 TestObjV8Internal::methodWithUnsignedLongSequenceMethod(info);
4249 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4255 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4250 } 4256 }
4251 4257
4252 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 4258 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
4253 { 4259 {
4254 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestObject", info.Holder(), info.GetIsolate()); 4260 ExceptionState exceptionState(ExceptionState::ExecutionContext, "stringArray Function", "TestObject", info.Holder(), info.GetIsolate());
4255 if (UNLIKELY(info.Length() < 1)) { 4261 if (UNLIKELY(info.Length() < 1)) {
4256 throwTypeError(ExceptionMessages::failedToExecute("stringArrayFunction", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info.Ge tIsolate()); 4262 exceptionState.notEnoughArguments(1, info.Length());
4257 return; 4263 return;
4258 } 4264 }
4259 TestObj* imp = V8TestObject::toNative(info.Holder()); 4265 TestObj* imp = V8TestObject::toNative(info.Holder());
4260 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate())); 4266 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(info[0], 1, in fo.GetIsolate()));
4261 Vector<String> result = imp->stringArrayFunction(values, exceptionState); 4267 Vector<String> result = imp->stringArrayFunction(values, exceptionState);
4262 if (exceptionState.throwIfNeeded()) 4268 if (exceptionState.throwIfNeeded())
4263 return; 4269 return;
4264 v8SetReturnValue(info, v8Array(result, info.GetIsolate())); 4270 v8SetReturnValue(info, v8Array(result, info.GetIsolate()));
4265 } 4271 }
4266 4272
4267 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 4273 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
4268 { 4274 {
4269 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4275 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4270 TestObjV8Internal::stringArrayFunctionMethod(info); 4276 TestObjV8Internal::stringArrayFunctionMethod(info);
4271 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4277 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4272 } 4278 }
4273 4279
4274 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info) 4280 static void domStringListFunctionMethod(const v8::FunctionCallbackInfo<v8::Value >& info)
4275 { 4281 {
4276 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate()); 4282 ExceptionState exceptionState(ExceptionState::ExecutionContext, "domStringLi stFunction", "TestObject", info.Holder(), info.GetIsolate());
4277 if (UNLIKELY(info.Length() < 1)) { 4283 if (UNLIKELY(info.Length() < 1)) {
4278 throwTypeError(ExceptionMessages::failedToExecute("domStringListFunction ", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), info. GetIsolate()); 4284 exceptionState.notEnoughArguments(1, info.Length());
4279 return; 4285 return;
4280 } 4286 }
4281 TestObj* imp = V8TestObject::toNative(info.Holder()); 4287 TestObj* imp = V8TestObject::toNative(info.Holder());
4282 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0); 4288 V8TRYCATCH_VOID(DOMStringList*, values, V8DOMStringList::hasInstance(info[0] , info.GetIsolate(), worldType(info.GetIsolate())) ? V8DOMStringList::toNative(v 8::Handle<v8::Object>::Cast(info[0])) : 0);
4283 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate); 4289 RefPtr<DOMStringList> result = imp->domStringListFunction(values, exceptionS tate);
4284 if (exceptionState.throwIfNeeded()) 4290 if (exceptionState.throwIfNeeded())
4285 return; 4291 return;
4286 v8SetReturnValue(info, result.release()); 4292 v8SetReturnValue(info, result.release());
4287 } 4293 }
4288 4294
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
4397 { 4403 {
4398 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4404 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4399 TestObjV8Internal::svgPointMethodMethod(info); 4405 TestObjV8Internal::svgPointMethodMethod(info);
4400 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4406 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4401 } 4407 }
4402 4408
4403 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info) 4409 static void strictSVGPointMethodMethod(const v8::FunctionCallbackInfo<v8::Value> & info)
4404 { 4410 {
4405 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictSVGPo intMethod", "TestObject", info.Holder(), info.GetIsolate()); 4411 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictSVGPo intMethod", "TestObject", info.Holder(), info.GetIsolate());
4406 if (UNLIKELY(info.Length() < 2)) { 4412 if (UNLIKELY(info.Length() < 2)) {
4407 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), info.G etIsolate()); 4413 exceptionState.notEnoughArguments(2, info.Length());
4408 return; 4414 return;
4409 } 4415 }
4410 TestObj* imp = V8TestObject::toNative(info.Holder()); 4416 TestObj* imp = V8TestObject::toNative(info.Holder());
4411 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) { 4417 if (info.Length() > 0 && !isUndefinedOrNull(info[0]) && !V8SVGPoint::hasInst ance(info[0], info.GetIsolate(), worldType(info.GetIsolate()))) {
4412 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate()); 4418 throwTypeError(ExceptionMessages::failedToExecute("strictSVGPointMethod" , "TestObject", "parameter 1 is not of type 'SVGPoint'."), info.GetIsolate());
4413 return; 4419 return;
4414 } 4420 }
4415 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); 4421 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);
4416 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1])); 4422 V8TRYCATCH_VOID(unsigned, index, toUInt32(info[1]));
4417 if (!item) { 4423 if (!item) {
(...skipping 23 matching lines...) Expand all
4441 { 4447 {
4442 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4448 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4443 TestObjV8Internal::orangeMethod(info); 4449 TestObjV8Internal::orangeMethod(info);
4444 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4450 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4445 } 4451 }
4446 4452
4447 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info ) 4453 static void strictFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& info )
4448 { 4454 {
4449 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictFunct ion", "TestObject", info.Holder(), info.GetIsolate()); 4455 ExceptionState exceptionState(ExceptionState::ExecutionContext, "strictFunct ion", "TestObject", info.Holder(), info.GetIsolate());
4450 if (UNLIKELY(info.Length() < 3)) { 4456 if (UNLIKELY(info.Length() < 3)) {
4451 throwTypeError(ExceptionMessages::failedToExecute("strictFunction", "Tes tObject", ExceptionMessages::notEnoughArguments(3, info.Length())), info.GetIsol ate()); 4457 exceptionState.notEnoughArguments(3, info.Length());
4452 return; 4458 return;
4453 } 4459 }
4454 TestObj* imp = V8TestObject::toNative(info.Holder()); 4460 TestObj* imp = V8TestObject::toNative(info.Holder());
4455 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]); 4461 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str, info[0]);
4456 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue())); 4462 V8TRYCATCH_VOID(float, a, static_cast<float>(info[1]->NumberValue()));
4457 V8TRYCATCH_VOID(int, b, toInt32(info[2])); 4463 V8TRYCATCH_VOID(int, b, toInt32(info[2]));
4458 bool result = imp->strictFunction(str, a, b, exceptionState); 4464 bool result = imp->strictFunction(str, a, b, exceptionState);
4459 if (exceptionState.throwIfNeeded()) 4465 if (exceptionState.throwIfNeeded())
4460 return; 4466 return;
4461 v8SetReturnValueBool(info, result); 4467 v8SetReturnValueBool(info, result);
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
4616 return; 4622 return;
4617 } 4623 }
4618 TestObj* imp = V8TestObject::toNative(info.Holder()); 4624 TestObj* imp = V8TestObject::toNative(info.Holder());
4619 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4625 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4620 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4626 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4621 imp->overloadedPerWorldMethod(strArg, longArg); 4627 imp->overloadedPerWorldMethod(strArg, longArg);
4622 } 4628 }
4623 4629
4624 static void overloadedPerWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 4630 static void overloadedPerWorldMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
4625 { 4631 {
4632 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedP erWorldMethod", "TestObject", info.Holder(), info.GetIsolate());
4626 if (((info.Length() == 1))) { 4633 if (((info.Length() == 1))) {
4627 overloadedPerWorldMethod1Method(info); 4634 overloadedPerWorldMethod1Method(info);
4628 return; 4635 return;
4629 } 4636 }
4630 if (((info.Length() == 2))) { 4637 if (((info.Length() == 2))) {
4631 overloadedPerWorldMethod2Method(info); 4638 overloadedPerWorldMethod2Method(info);
4632 return; 4639 return;
4633 } 4640 }
4634 if (UNLIKELY(info.Length() < 1)) { 4641 if (UNLIKELY(info.Length() < 1)) {
4635 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), in fo.GetIsolate()); 4642 exceptionState.notEnoughArguments(1, info.Length());
4636 return; 4643 return;
4637 } 4644 }
4638 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMethod" , "TestObject", "No function was found that matched the signature provided."), i nfo.GetIsolate()); 4645 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4646 exceptionState.throwIfNeeded();
4639 } 4647 }
4640 4648
4641 static void overloadedPerWorldMethodMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info) 4649 static void overloadedPerWorldMethodMethodCallback(const v8::FunctionCallbackInf o<v8::Value>& info)
4642 { 4650 {
4643 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4651 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4644 TestObjV8Internal::overloadedPerWorldMethodMethod(info); 4652 TestObjV8Internal::overloadedPerWorldMethodMethod(info);
4645 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4653 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4646 } 4654 }
4647 4655
4648 static void overloadedPerWorldMethod2MethodForMainWorld(const v8::FunctionCallba ckInfo<v8::Value>& info) 4656 static void overloadedPerWorldMethod2MethodForMainWorld(const v8::FunctionCallba ckInfo<v8::Value>& info)
4649 { 4657 {
4650 if (UNLIKELY(info.Length() < 2)) { 4658 if (UNLIKELY(info.Length() < 2)) {
4651 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), in fo.GetIsolate()); 4659 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length())), in fo.GetIsolate());
4652 return; 4660 return;
4653 } 4661 }
4654 TestObj* imp = V8TestObject::toNative(info.Holder()); 4662 TestObj* imp = V8TestObject::toNative(info.Holder());
4655 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4663 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4656 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4664 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4657 imp->overloadedPerWorldMethod(strArg, longArg); 4665 imp->overloadedPerWorldMethod(strArg, longArg);
4658 } 4666 }
4659 4667
4660 static void overloadedPerWorldMethodMethodForMainWorld(const v8::FunctionCallbac kInfo<v8::Value>& info) 4668 static void overloadedPerWorldMethodMethodForMainWorld(const v8::FunctionCallbac kInfo<v8::Value>& info)
4661 { 4669 {
4670 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedP erWorldMethod", "TestObject", info.Holder(), info.GetIsolate());
4662 if (((info.Length() == 1))) { 4671 if (((info.Length() == 1))) {
4663 overloadedPerWorldMethod1MethodForMainWorld(info); 4672 overloadedPerWorldMethod1MethodForMainWorld(info);
4664 return; 4673 return;
4665 } 4674 }
4666 if (((info.Length() == 2))) { 4675 if (((info.Length() == 2))) {
4667 overloadedPerWorldMethod2MethodForMainWorld(info); 4676 overloadedPerWorldMethod2MethodForMainWorld(info);
4668 return; 4677 return;
4669 } 4678 }
4670 if (UNLIKELY(info.Length() < 1)) { 4679 if (UNLIKELY(info.Length() < 1)) {
4671 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMet hod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length())), in fo.GetIsolate()); 4680 exceptionState.notEnoughArguments(1, info.Length());
4672 return; 4681 return;
4673 } 4682 }
4674 throwTypeError(ExceptionMessages::failedToExecute("overloadedPerWorldMethod" , "TestObject", "No function was found that matched the signature provided."), i nfo.GetIsolate()); 4683 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4684 exceptionState.throwIfNeeded();
4675 } 4685 }
4676 4686
4677 static void overloadedPerWorldMethodMethodCallbackForMainWorld(const v8::Functio nCallbackInfo<v8::Value>& info) 4687 static void overloadedPerWorldMethodMethodCallbackForMainWorld(const v8::Functio nCallbackInfo<v8::Value>& info)
4678 { 4688 {
4679 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4689 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4680 TestObjV8Internal::overloadedPerWorldMethodMethodForMainWorld(info); 4690 TestObjV8Internal::overloadedPerWorldMethodMethodForMainWorld(info);
4681 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4691 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4682 } 4692 }
4683 4693
4684 static void activityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value >& info) 4694 static void activityLoggedMethod1Method(const v8::FunctionCallbackInfo<v8::Value >& info)
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4820 return; 4830 return;
4821 } 4831 }
4822 TestObj* imp = V8TestObject::toNative(info.Holder()); 4832 TestObj* imp = V8TestObject::toNative(info.Holder());
4823 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4833 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4824 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4834 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4825 imp->overloadedActivityLoggedMethod(strArg, longArg); 4835 imp->overloadedActivityLoggedMethod(strArg, longArg);
4826 } 4836 }
4827 4837
4828 static void overloadedActivityLoggedMethodMethod(const v8::FunctionCallbackInfo< v8::Value>& info) 4838 static void overloadedActivityLoggedMethodMethod(const v8::FunctionCallbackInfo< v8::Value>& info)
4829 { 4839 {
4840 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedA ctivityLoggedMethod", "TestObject", info.Holder(), info.GetIsolate());
4830 if (((info.Length() == 1))) { 4841 if (((info.Length() == 1))) {
4831 overloadedActivityLoggedMethod1Method(info); 4842 overloadedActivityLoggedMethod1Method(info);
4832 return; 4843 return;
4833 } 4844 }
4834 if (((info.Length() == 2))) { 4845 if (((info.Length() == 2))) {
4835 overloadedActivityLoggedMethod2Method(info); 4846 overloadedActivityLoggedMethod2Method(info);
4836 return; 4847 return;
4837 } 4848 }
4838 if (UNLIKELY(info.Length() < 1)) { 4849 if (UNLIKELY(info.Length() < 1)) {
4839 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length() )), info.GetIsolate()); 4850 exceptionState.notEnoughArguments(1, info.Length());
4840 return; 4851 return;
4841 } 4852 }
4842 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLoggedM ethod", "TestObject", "No function was found that matched the signature provided ."), info.GetIsolate()); 4853 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4854 exceptionState.throwIfNeeded();
4843 } 4855 }
4844 4856
4845 static void overloadedActivityLoggedMethodMethodCallback(const v8::FunctionCallb ackInfo<v8::Value>& info) 4857 static void overloadedActivityLoggedMethodMethodCallback(const v8::FunctionCallb ackInfo<v8::Value>& info)
4846 { 4858 {
4847 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4859 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4848 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 4860 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
4849 if (contextData && contextData->activityLogger()) { 4861 if (contextData && contextData->activityLogger()) {
4850 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); 4862 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0);
4851 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method"); 4863 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method");
4852 } 4864 }
4853 TestObjV8Internal::overloadedActivityLoggedMethodMethod(info); 4865 TestObjV8Internal::overloadedActivityLoggedMethodMethod(info);
4854 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 4866 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
4855 } 4867 }
4856 4868
4857 static void overloadedActivityLoggedMethod2MethodForMainWorld(const v8::Function CallbackInfo<v8::Value>& info) 4869 static void overloadedActivityLoggedMethod2MethodForMainWorld(const v8::Function CallbackInfo<v8::Value>& info)
4858 { 4870 {
4859 if (UNLIKELY(info.Length() < 2)) { 4871 if (UNLIKELY(info.Length() < 2)) {
4860 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length() )), info.GetIsolate()); 4872 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(2, info.Length() )), info.GetIsolate());
4861 return; 4873 return;
4862 } 4874 }
4863 TestObj* imp = V8TestObject::toNative(info.Holder()); 4875 TestObj* imp = V8TestObject::toNative(info.Holder());
4864 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 4876 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
4865 V8TRYCATCH_VOID(int, longArg, toInt32(info[1])); 4877 V8TRYCATCH_VOID(int, longArg, toInt32(info[1]));
4866 imp->overloadedActivityLoggedMethod(strArg, longArg); 4878 imp->overloadedActivityLoggedMethod(strArg, longArg);
4867 } 4879 }
4868 4880
4869 static void overloadedActivityLoggedMethodMethodForMainWorld(const v8::FunctionC allbackInfo<v8::Value>& info) 4881 static void overloadedActivityLoggedMethodMethodForMainWorld(const v8::FunctionC allbackInfo<v8::Value>& info)
4870 { 4882 {
4883 ExceptionState exceptionState(ExceptionState::ExecutionContext, "overloadedA ctivityLoggedMethod", "TestObject", info.Holder(), info.GetIsolate());
4871 if (((info.Length() == 1))) { 4884 if (((info.Length() == 1))) {
4872 overloadedActivityLoggedMethod1MethodForMainWorld(info); 4885 overloadedActivityLoggedMethod1MethodForMainWorld(info);
4873 return; 4886 return;
4874 } 4887 }
4875 if (((info.Length() == 2))) { 4888 if (((info.Length() == 2))) {
4876 overloadedActivityLoggedMethod2MethodForMainWorld(info); 4889 overloadedActivityLoggedMethod2MethodForMainWorld(info);
4877 return; 4890 return;
4878 } 4891 }
4879 if (UNLIKELY(info.Length() < 1)) { 4892 if (UNLIKELY(info.Length() < 1)) {
4880 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLog gedMethod", "TestObject", ExceptionMessages::notEnoughArguments(1, info.Length() )), info.GetIsolate()); 4893 exceptionState.notEnoughArguments(1, info.Length());
4881 return; 4894 return;
4882 } 4895 }
4883 throwTypeError(ExceptionMessages::failedToExecute("overloadedActivityLoggedM ethod", "TestObject", "No function was found that matched the signature provided ."), info.GetIsolate()); 4896 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
4897 exceptionState.throwIfNeeded();
4884 } 4898 }
4885 4899
4886 static void overloadedActivityLoggedMethodMethodCallbackForMainWorld(const v8::F unctionCallbackInfo<v8::Value>& info) 4900 static void overloadedActivityLoggedMethodMethodCallbackForMainWorld(const v8::F unctionCallbackInfo<v8::Value>& info)
4887 { 4901 {
4888 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 4902 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
4889 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext()); 4903 V8PerContextData* contextData = V8PerContextData::from(info.GetIsolate()->Ge tCurrentContext());
4890 if (contextData && contextData->activityLogger()) { 4904 if (contextData && contextData->activityLogger()) {
4891 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0); 4905 Vector<v8::Handle<v8::Value> > loggerArgs = toNativeArguments<v8::Handle <v8::Value> >(info, 0);
4892 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method"); 4906 contextData->activityLogger()->log("TestObject.overloadedActivityLoggedM ethod", info.Length(), loggerArgs.data(), "Method");
4893 } 4907 }
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
5409 fromInternalPointer(object)->deref(); 5423 fromInternalPointer(object)->deref();
5410 } 5424 }
5411 5425
5412 template<> 5426 template<>
5413 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate) 5427 v8::Handle<v8::Value> toV8NoInline(TestObj* impl, v8::Handle<v8::Object> creatio nContext, v8::Isolate* isolate)
5414 { 5428 {
5415 return toV8(impl, creationContext, isolate); 5429 return toV8(impl, creationContext, isolate);
5416 } 5430 }
5417 5431
5418 } // namespace WebCore 5432 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698