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

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

Issue 608853008: Canvas2D Performance: fix the bottleneck of hasInstance in JS binding -- TypeChecking Interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: still call toImplWithTypeCheck for undefined arguments + test cases in TestObject.idl Created 6 years, 2 months 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY! 5 // This file has been auto-generated by code_generator_v8.py. DO NOT MODIFY!
6 6
7 #include "config.h" 7 #include "config.h"
8 #include "V8TestObject.h" 8 #include "V8TestObject.h"
9 9
10 #include "bindings/core/v8/BindingSecurity.h" 10 #include "bindings/core/v8/BindingSecurity.h"
(...skipping 9642 matching lines...) Expand 10 before | Expand all | Expand 10 after
9653 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("t ypeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", "TestObject", 1, info.Leng th(), info.GetIsolate()), info.GetIsolate()); 9653 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("t ypeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", "TestObject", 1, info.Leng th(), info.GetIsolate()), info.GetIsolate());
9654 return; 9654 return;
9655 } 9655 }
9656 TestObject* impl = V8TestObject::toImpl(info.Holder()); 9656 TestObject* impl = V8TestObject::toImpl(info.Holder());
9657 TestInterfaceEmpty* testInterfaceEmptyArg; 9657 TestInterfaceEmpty* testInterfaceEmptyArg;
9658 { 9658 {
9659 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) { 9659 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
9660 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", "TestObject", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); 9660 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg", "TestObject", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
9661 return; 9661 return;
9662 } 9662 }
9663 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.G etIsolate(), info[0]); 9663 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Obje ct>::Cast(info[0]));
9664 } 9664 }
9665 impl->typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg(testInterfaceEmpt yArg); 9665 impl->typeCheckingInterfaceVoidMethodTestInterfaceEmptyArg(testInterfaceEmpt yArg);
9666 } 9666 }
9667 9667
9668 static void typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMethodCallback(c onst v8::FunctionCallbackInfo<v8::Value>& info) 9668 static void typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMethodCallback(c onst v8::FunctionCallbackInfo<v8::Value>& info)
9669 { 9669 {
9670 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 9670 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
9671 TestObjectV8Internal::typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMe thod(info); 9671 TestObjectV8Internal::typeCheckingInterfaceVoidMethodTestInterfaceEmptyArgMe thod(info);
9672 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 9672 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
9673 } 9673 }
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
9992 v8SetReturnValueInt(info, impl->methodImplementedInCPPForPrivateScriptOnly(v alue1, value2)); 9992 v8SetReturnValueInt(info, impl->methodImplementedInCPPForPrivateScriptOnly(v alue1, value2));
9993 } 9993 }
9994 9994
9995 static void methodImplementedInCPPForPrivateScriptOnlyMethodCallback(const v8::F unctionCallbackInfo<v8::Value>& info) 9995 static void methodImplementedInCPPForPrivateScriptOnlyMethodCallback(const v8::F unctionCallbackInfo<v8::Value>& info)
9996 { 9996 {
9997 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 9997 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
9998 TestObjectV8Internal::methodImplementedInCPPForPrivateScriptOnlyMethod(info) ; 9998 TestObjectV8Internal::methodImplementedInCPPForPrivateScriptOnlyMethod(info) ;
9999 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 9999 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
10000 } 10000 }
10001 10001
10002 static void useToImpl4ArgumentsCheckingIfPossibleWithOptionalArgMethod(const v8: :FunctionCallbackInfo<v8::Value>& info)
10003 {
10004 if (UNLIKELY(info.Length() < 1)) {
10005 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("u seToImpl4ArgumentsCheckingIfPossibleWithOptionalArg", "TestObject", 1, info.Leng th(), info.GetIsolate()), info.GetIsolate());
10006 return;
10007 }
10008 TestObject* impl = V8TestObject::toImpl(info.Holder());
10009 Node* node1;
10010 Node* node2;
10011 {
10012 if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate() )) {
10013 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg", "TestObject", "parameter 1 is not of type 'Node'."), info.GetIsolate());
10014 return;
10015 }
10016 node1 = V8Node::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
10017 if (UNLIKELY(info.Length() <= 1)) {
10018 impl->useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg(node1);
10019 return;
10020 }
10021 if (info.Length() > 1 && !V8Node::hasInstance(info[1], info.GetIsolate() )) {
10022 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg", "TestObject", "parameter 2 is not of type 'Node'."), info.GetIsolate());
10023 return;
10024 }
10025 node2 = V8Node::toImpl(v8::Handle<v8::Object>::Cast(info[1]));
10026 }
10027 impl->useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg(node1, node2);
10028 }
10029
10030 static void useToImpl4ArgumentsCheckingIfPossibleWithOptionalArgMethodCallback(c onst v8::FunctionCallbackInfo<v8::Value>& info)
10031 {
10032 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
10033 TestObjectV8Internal::useToImpl4ArgumentsCheckingIfPossibleWithOptionalArgMe thod(info);
10034 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
10035 }
10036
10037 static void useToImpl4ArgumentsCheckingIfPossibleWithNullableArgMethod(const v8: :FunctionCallbackInfo<v8::Value>& info)
10038 {
10039 if (UNLIKELY(info.Length() < 2)) {
10040 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("u seToImpl4ArgumentsCheckingIfPossibleWithNullableArg", "TestObject", 2, info.Leng th(), info.GetIsolate()), info.GetIsolate());
10041 return;
10042 }
10043 TestObject* impl = V8TestObject::toImpl(info.Holder());
10044 Node* node1;
10045 Node* node2;
10046 {
10047 if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate() )) {
10048 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithNullableArg", "TestObject", "parameter 1 is not of type 'Node'."), info.GetIsolate());
10049 return;
10050 }
10051 node1 = V8Node::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
10052 if (info.Length() > 1 && !isUndefinedOrNull(info[1]) && !V8Node::hasInst ance(info[1], info.GetIsolate())) {
10053 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithNullableArg", "TestObject", "parameter 2 is not of type 'Node'."), info.GetIsolate());
10054 return;
10055 }
10056 node2 = V8Node::toImplWithTypeCheck(info.GetIsolate(), info[1]);
10057 }
10058 impl->useToImpl4ArgumentsCheckingIfPossibleWithNullableArg(node1, node2);
10059 }
10060
10061 static void useToImpl4ArgumentsCheckingIfPossibleWithNullableArgMethodCallback(c onst v8::FunctionCallbackInfo<v8::Value>& info)
10062 {
10063 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
10064 TestObjectV8Internal::useToImpl4ArgumentsCheckingIfPossibleWithNullableArgMe thod(info);
10065 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
10066 }
10067
10068 static void useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArgMethod(const v8 ::FunctionCallbackInfo<v8::Value>& info)
10069 {
10070 if (UNLIKELY(info.Length() < 1)) {
10071 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("u seToImpl4ArgumentsCheckingIfPossibleWithUndefinedArg", "TestObject", 1, info.Len gth(), info.GetIsolate()), info.GetIsolate());
10072 return;
10073 }
10074 TestObject* impl = V8TestObject::toImpl(info.Holder());
10075 Node* node1;
10076 Node* node2;
10077 {
10078 if (info.Length() > 0 && !V8Node::hasInstance(info[0], info.GetIsolate() )) {
10079 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArg", "TestObject", "paramete r 1 is not of type 'Node'."), info.GetIsolate());
10080 return;
10081 }
10082 node1 = V8Node::toImpl(v8::Handle<v8::Object>::Cast(info[0]));
10083 if (info.Length() > 1 && !V8Node::hasInstance(info[1], info.GetIsolate() )) {
10084 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArg", "TestObject", "paramete r 2 is not of type 'Node'."), info.GetIsolate());
10085 return;
10086 }
10087 node2 = V8Node::toImplWithTypeCheck(info.GetIsolate(), info[1]);
10088 }
10089 impl->useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArg(node1, node2);
10090 }
10091
10092 static void useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArgMethodCallback( const v8::FunctionCallbackInfo<v8::Value>& info)
10093 {
10094 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
10095 TestObjectV8Internal::useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArgM ethod(info);
10096 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
10097 }
10098
10002 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 10099 static void toStringMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
10003 { 10100 {
10004 TestObject* impl = V8TestObject::toImpl(info.Holder()); 10101 TestObject* impl = V8TestObject::toImpl(info.Holder());
10005 v8SetReturnValueString(info, impl->stringifierAttribute(), info.GetIsolate() ); 10102 v8SetReturnValueString(info, impl->stringifierAttribute(), info.GetIsolate() );
10006 } 10103 }
10007 10104
10008 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo) 10105 static void toStringMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& in fo)
10009 { 10106 {
10010 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 10107 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
10011 TestObjectV8Internal::toStringMethod(info); 10108 TestObjectV8Internal::toStringMethod(info);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
10377 {"voidMethodTestInterfaceGarbageCollectedArrayArg", TestObjectV8Internal::vo idMethodTestInterfaceGarbageCollectedArrayArgMethodCallback, 0, 1, V8DOMConfigur ation::ExposedToAllScripts}, 10474 {"voidMethodTestInterfaceGarbageCollectedArrayArg", TestObjectV8Internal::vo idMethodTestInterfaceGarbageCollectedArrayArgMethodCallback, 0, 1, V8DOMConfigur ation::ExposedToAllScripts},
10378 {"voidMethodTestInterfaceWillBeGarbageCollectedSequenceArg", TestObjectV8Int ernal::voidMethodTestInterfaceWillBeGarbageCollectedSequenceArgMethodCallback, 0 , 1, V8DOMConfiguration::ExposedToAllScripts}, 10475 {"voidMethodTestInterfaceWillBeGarbageCollectedSequenceArg", TestObjectV8Int ernal::voidMethodTestInterfaceWillBeGarbageCollectedSequenceArgMethodCallback, 0 , 1, V8DOMConfiguration::ExposedToAllScripts},
10379 {"voidMethodTestInterfaceWillBeGarbageCollectedArrayArg", TestObjectV8Intern al::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback, 0, 1, V 8DOMConfiguration::ExposedToAllScripts}, 10476 {"voidMethodTestInterfaceWillBeGarbageCollectedArrayArg", TestObjectV8Intern al::voidMethodTestInterfaceWillBeGarbageCollectedArrayArgMethodCallback, 0, 1, V 8DOMConfiguration::ExposedToAllScripts},
10380 {"voidMethodImplementedInPrivateScript", TestObjectV8Internal::voidMethodImp lementedInPrivateScriptMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScr ipts}, 10477 {"voidMethodImplementedInPrivateScript", TestObjectV8Internal::voidMethodImp lementedInPrivateScriptMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllScr ipts},
10381 {"shortMethodImplementedInPrivateScript", TestObjectV8Internal::shortMethodI mplementedInPrivateScriptMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllS cripts}, 10478 {"shortMethodImplementedInPrivateScript", TestObjectV8Internal::shortMethodI mplementedInPrivateScriptMethodCallback, 0, 0, V8DOMConfiguration::ExposedToAllS cripts},
10382 {"shortMethodWithShortArgumentImplementedInPrivateScript", TestObjectV8Inter nal::shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts}, 10479 {"shortMethodWithShortArgumentImplementedInPrivateScript", TestObjectV8Inter nal::shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback, 0, 1, V8DOMConfiguration::ExposedToAllScripts},
10383 {"stringMethodWithStringArgumentImplementedInPrivateScript", TestObjectV8Int ernal::stringMethodWithStringArgumentImplementedInPrivateScriptMethodCallback, 0 , 1, V8DOMConfiguration::ExposedToAllScripts}, 10480 {"stringMethodWithStringArgumentImplementedInPrivateScript", TestObjectV8Int ernal::stringMethodWithStringArgumentImplementedInPrivateScriptMethodCallback, 0 , 1, V8DOMConfiguration::ExposedToAllScripts},
10384 {"nodeMethodWithNodeArgumentImplementedInPrivateScript", TestObjectV8Interna l::nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodCallback, 0, 1, V8D OMConfiguration::ExposedToAllScripts}, 10481 {"nodeMethodWithNodeArgumentImplementedInPrivateScript", TestObjectV8Interna l::nodeMethodWithNodeArgumentImplementedInPrivateScriptMethodCallback, 0, 1, V8D OMConfiguration::ExposedToAllScripts},
10385 {"nodeMethodWithVariousArgumentsImplementedInPrivateScript", TestObjectV8Int ernal::nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodCallback, 0 , 5, V8DOMConfiguration::ExposedToAllScripts}, 10482 {"nodeMethodWithVariousArgumentsImplementedInPrivateScript", TestObjectV8Int ernal::nodeMethodWithVariousArgumentsImplementedInPrivateScriptMethodCallback, 0 , 5, V8DOMConfiguration::ExposedToAllScripts},
10386 {"methodImplementedInCPPForPrivateScriptOnly", TestObjectV8Internal::methodI mplementedInCPPForPrivateScriptOnlyMethodCallback, 0, 2, V8DOMConfiguration::Onl yExposedToPrivateScript}, 10483 {"methodImplementedInCPPForPrivateScriptOnly", TestObjectV8Internal::methodI mplementedInCPPForPrivateScriptOnlyMethodCallback, 0, 2, V8DOMConfiguration::Onl yExposedToPrivateScript},
10484 {"useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg", TestObjectV8Interna l::useToImpl4ArgumentsCheckingIfPossibleWithOptionalArgMethodCallback, 0, 1, V8D OMConfiguration::ExposedToAllScripts},
10485 {"useToImpl4ArgumentsCheckingIfPossibleWithNullableArg", TestObjectV8Interna l::useToImpl4ArgumentsCheckingIfPossibleWithNullableArgMethodCallback, 0, 2, V8D OMConfiguration::ExposedToAllScripts},
10486 {"useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArg", TestObjectV8Intern al::useToImpl4ArgumentsCheckingIfPossibleWithUndefinedArgMethodCallback, 0, 1, V 8DOMConfiguration::ExposedToAllScripts},
10387 {"toString", TestObjectV8Internal::toStringMethodCallback, 0, 0, V8DOMConfig uration::ExposedToAllScripts}, 10487 {"toString", TestObjectV8Internal::toStringMethodCallback, 0, 0, V8DOMConfig uration::ExposedToAllScripts},
10388 }; 10488 };
10389 10489
10390 static void installV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate) 10490 static void installV8TestObjectTemplate(v8::Handle<v8::FunctionTemplate> functio nTemplate, v8::Isolate* isolate)
10391 { 10491 {
10392 functionTemplate->ReadOnlyPrototype(); 10492 functionTemplate->ReadOnlyPrototype();
10393 10493
10394 v8::Local<v8::Signature> defaultSignature; 10494 v8::Local<v8::Signature> defaultSignature;
10395 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObject", v8::Local<v8::FunctionTemplate>(), V8TestObject::internalFiel dCount, 10495 defaultSignature = V8DOMConfiguration::installDOMClassTemplate(functionTempl ate, "TestObject", v8::Local<v8::FunctionTemplate>(), V8TestObject::internalFiel dCount,
10396 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes), 10496 V8TestObjectAttributes, WTF_ARRAY_LENGTH(V8TestObjectAttributes),
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
11051 return false; 11151 return false;
11052 11152
11053 ScriptState::Scope scope(scriptState); 11153 ScriptState::Scope scope(scriptState);
11054 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); 11154 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
11055 11155
11056 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ; 11156 ExceptionState exceptionState(ExceptionState::SetterContext, "enumForPrivate Script", "TestObject", scriptState->context()->Global(), scriptState->isolate()) ;
11057 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue)); 11157 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestObject", "enumForPrivateScript", holder, v8String(scriptState-> isolate(), cppValue));
11058 } 11158 }
11059 11159
11060 } // namespace blink 11160 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698