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

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

Issue 657523002: Skip expensive hasInstance() type-checks in overloads (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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 #if ENABLE(CONDITION) 8 #if ENABLE(CONDITION)
9 #include "V8TestInterface.h" 9 #include "V8TestInterface.h"
10 10
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsol ate()), info.GetIsolate()); 980 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodTestInterfaceEmptyArg", "TestInterface", 1, info.Length(), info.GetIsol ate()), info.GetIsolate());
981 return; 981 return;
982 } 982 }
983 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 983 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
984 TestInterfaceEmpty* testInterfaceEmptyArg; 984 TestInterfaceEmpty* testInterfaceEmptyArg;
985 { 985 {
986 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) { 986 if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], inf o.GetIsolate())) {
987 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate()); 987 V8ThrowException::throwTypeError(ExceptionMessages::failedToExecute( "voidMethodTestInterfaceEmptyArg", "TestInterface", "parameter 1 is not of type 'TestInterfaceEmpty'."), info.GetIsolate());
988 return; 988 return;
989 } 989 }
990 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Obje ct>::Cast(info[0])); 990 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.G etIsolate(), info[0]);
991 } 991 }
992 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); 992 impl->voidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg);
993 } 993 }
994 994
995 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info) 995 static void voidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCall backInfo<v8::Value>& info)
996 { 996 {
997 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 997 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
998 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info); 998 TestInterfaceImplementationV8Internal::voidMethodTestInterfaceEmptyArgMethod (info);
999 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 999 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1000 } 1000 }
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 1222 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1223 V8StringResource<> strArg; 1223 V8StringResource<> strArg;
1224 TestInterfaceEmpty* testInterfaceEmptyArg; 1224 TestInterfaceEmpty* testInterfaceEmptyArg;
1225 { 1225 {
1226 TOSTRING_VOID_INTERNAL(strArg, info[0]); 1226 TOSTRING_VOID_INTERNAL(strArg, info[0]);
1227 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) { 1227 if (info.Length() > 1 && !V8TestInterfaceEmpty::hasInstance(info[1], inf o.GetIsolate())) {
1228 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'."); 1228 exceptionState.throwTypeError("parameter 2 is not of type 'TestInter faceEmpty'.");
1229 exceptionState.throwIfNeeded(); 1229 exceptionState.throwIfNeeded();
1230 return; 1230 return;
1231 } 1231 }
1232 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImpl(v8::Handle<v8::Obje ct>::Cast(info[1])); 1232 testInterfaceEmptyArg = V8TestInterfaceEmpty::toImplWithTypeCheck(info.G etIsolate(), info[1]);
1233 } 1233 }
1234 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ()); 1234 ExecutionContext* executionContext = currentExecutionContext(info.GetIsolate ());
1235 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(executionC ontext, strArg, testInterfaceEmptyArg, exceptionState); 1235 RefPtr<TestInterfaceEmpty> result = impl->implementsComplexMethod(executionC ontext, strArg, testInterfaceEmptyArg, exceptionState);
1236 if (exceptionState.hadException()) { 1236 if (exceptionState.hadException()) {
1237 exceptionState.throwIfNeeded(); 1237 exceptionState.throwIfNeeded();
1238 return; 1238 return;
1239 } 1239 }
1240 v8SetReturnValue(info, result.release()); 1240 v8SetReturnValue(info, result.release());
1241 } 1241 }
1242 1242
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 1435
1436 #if ENABLE(PARTIAL_CONDITION) 1436 #if ENABLE(PARTIAL_CONDITION)
1437 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback (const v8::FunctionCallbackInfo<v8::Value>& info) 1437 static void shortMethodWithShortArgumentImplementedInPrivateScriptMethodCallback (const v8::FunctionCallbackInfo<v8::Value>& info)
1438 { 1438 {
1439 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1439 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1440 TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplement edInPrivateScriptMethod(info); 1440 TestInterfaceImplementationV8Internal::shortMethodWithShortArgumentImplement edInPrivateScriptMethod(info);
1441 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1441 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1442 } 1442 }
1443 #endif // ENABLE(PARTIAL_CONDITION) 1443 #endif // ENABLE(PARTIAL_CONDITION)
1444 1444
1445 static void partial2VoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info) 1445 static void partial2VoidMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info, int type_checked_argument_index)
1446 { 1446 {
1447 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 1447 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1448 TestPartialInterfaceImplementation::partial2VoidMethod(*impl); 1448 TestPartialInterfaceImplementation::partial2VoidMethod(*impl);
1449 } 1449 }
1450 1450
1451 static void partial2StaticVoidMethod1Method(const v8::FunctionCallbackInfo<v8::V alue>& info) 1451 static void partial2StaticVoidMethod1Method(const v8::FunctionCallbackInfo<v8::V alue>& info, int type_checked_argument_index)
1452 { 1452 {
1453 TestPartialInterfaceImplementation::partial2StaticVoidMethod(); 1453 TestPartialInterfaceImplementation::partial2StaticVoidMethod();
1454 } 1454 }
1455 1455
1456 static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info) 1456 static void voidMethodPartialOverloadMethod(const v8::FunctionCallbackInfo<v8::V alue>& info)
1457 { 1457 {
1458 if (UNLIKELY(info.Length() < 1)) { 1458 if (UNLIKELY(info.Length() < 1)) {
1459 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodPartialOverload", "TestInterface", 1, info.Length(), info.GetIsolate()) , info.GetIsolate()); 1459 V8ThrowException::throwException(createMinimumArityTypeErrorForMethod("v oidMethodPartialOverload", "TestInterface", 1, info.Length(), info.GetIsolate()) , info.GetIsolate());
1460 return; 1460 return;
1461 } 1461 }
(...skipping 25 matching lines...) Expand all
1487 TestPartialInterfaceImplementation3::voidMethodPartialOverload(value); 1487 TestPartialInterfaceImplementation3::voidMethodPartialOverload(value);
1488 } 1488 }
1489 1489
1490 static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info) 1490 static void voidMethodPartialOverloadMethodCallback(const v8::FunctionCallbackIn fo<v8::Value>& info)
1491 { 1491 {
1492 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1492 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1493 TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info) ; 1493 TestInterfaceImplementationV8Internal::voidMethodPartialOverloadMethod(info) ;
1494 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1494 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1495 } 1495 }
1496 1496
1497 static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 1497 static void partial2VoidMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info, int type_checked_argument_index)
1498 { 1498 {
1499 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder()); 1499 TestInterfaceImplementation* impl = V8TestInterface::toImpl(info.Holder());
1500 V8StringResource<> value; 1500 V8StringResource<> value;
1501 { 1501 {
1502 TOSTRING_VOID_INTERNAL(value, info[0]); 1502 TOSTRING_VOID_INTERNAL(value, info[0]);
1503 } 1503 }
1504 TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value); 1504 TestPartialInterfaceImplementation3::partial2VoidMethod(*impl, value);
1505 } 1505 }
1506 1506
1507 static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) 1507 static void partial2VoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info)
1508 { 1508 {
1509 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Voi dMethod", "TestInterface", info.Holder(), info.GetIsolate()); 1509 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Voi dMethod", "TestInterface", info.Holder(), info.GetIsolate());
1510 switch (std::min(1, info.Length())) { 1510 switch (std::min(1, info.Length())) {
1511 case 0: 1511 case 0:
1512 if (true) { 1512 if (true) {
1513 partial2VoidMethod1Method(info); 1513 partial2VoidMethod1Method(info, -1);
1514 return; 1514 return;
1515 } 1515 }
1516 break; 1516 break;
1517 case 1: 1517 case 1:
1518 if (true) { 1518 if (true) {
1519 partial2VoidMethod2Method(info); 1519 partial2VoidMethod2Method(info, -1);
1520 return; 1520 return;
1521 } 1521 }
1522 break; 1522 break;
1523 default: 1523 default:
1524 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length())); 1524 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
1525 exceptionState.throwIfNeeded(); 1525 exceptionState.throwIfNeeded();
1526 return; 1526 return;
1527 } 1527 }
1528 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 1528 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
1529 exceptionState.throwIfNeeded(); 1529 exceptionState.throwIfNeeded();
1530 } 1530 }
1531 1531
1532 static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info) 1532 static void partial2VoidMethodMethodCallback(const v8::FunctionCallbackInfo<v8:: Value>& info)
1533 { 1533 {
1534 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod"); 1534 TRACE_EVENT_SET_SAMPLING_STATE("blink", "DOMMethod");
1535 TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info); 1535 TestInterfaceImplementationV8Internal::partial2VoidMethodMethod(info);
1536 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution"); 1536 TRACE_EVENT_SET_SAMPLING_STATE("v8", "V8Execution");
1537 } 1537 }
1538 1538
1539 static void partial2StaticVoidMethod2Method(const v8::FunctionCallbackInfo<v8::V alue>& info) 1539 static void partial2StaticVoidMethod2Method(const v8::FunctionCallbackInfo<v8::V alue>& info, int type_checked_argument_index)
1540 { 1540 {
1541 V8StringResource<> value; 1541 V8StringResource<> value;
1542 { 1542 {
1543 TOSTRING_VOID_INTERNAL(value, info[0]); 1543 TOSTRING_VOID_INTERNAL(value, info[0]);
1544 } 1544 }
1545 TestPartialInterfaceImplementation3::partial2StaticVoidMethod(value); 1545 TestPartialInterfaceImplementation3::partial2StaticVoidMethod(value);
1546 } 1546 }
1547 1547
1548 static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info) 1548 static void partial2StaticVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Va lue>& info)
1549 { 1549 {
1550 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Sta ticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate()); 1550 ExceptionState exceptionState(ExceptionState::ExecutionContext, "partial2Sta ticVoidMethod", "TestInterface", info.Holder(), info.GetIsolate());
1551 switch (std::min(1, info.Length())) { 1551 switch (std::min(1, info.Length())) {
1552 case 0: 1552 case 0:
1553 if (true) { 1553 if (true) {
1554 partial2StaticVoidMethod1Method(info); 1554 partial2StaticVoidMethod1Method(info, -1);
1555 return; 1555 return;
1556 } 1556 }
1557 break; 1557 break;
1558 case 1: 1558 case 1:
1559 if (true) { 1559 if (true) {
1560 partial2StaticVoidMethod2Method(info); 1560 partial2StaticVoidMethod2Method(info, -1);
1561 return; 1561 return;
1562 } 1562 }
1563 break; 1563 break;
1564 default: 1564 default:
1565 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length())); 1565 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(0, i nfo.Length()));
1566 exceptionState.throwIfNeeded(); 1566 exceptionState.throwIfNeeded();
1567 return; 1567 return;
1568 } 1568 }
1569 exceptionState.throwTypeError("No function was found that matched the signat ure provided."); 1569 exceptionState.throwTypeError("No function was found that matched the signat ure provided.");
1570 exceptionState.throwIfNeeded(); 1570 exceptionState.throwIfNeeded();
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
2163 2163
2164 ScriptState::Scope scope(scriptState); 2164 ScriptState::Scope scope(scriptState);
2165 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate()); 2165 v8::Handle<v8::Value> holder = toV8(holderImpl, scriptState->context()->Glob al(), scriptState->isolate());
2166 2166
2167 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate()); 2167 ExceptionState exceptionState(ExceptionState::SetterContext, "stringAttribut e", "TestInterfaceImplementation", scriptState->context()->Global(), scriptState ->isolate());
2168 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestInterfaceImplementation", "stringAttribute", holder, v8String(s criptState->isolate(), cppValue)); 2168 return PrivateScriptRunner::runDOMAttributeSetter(scriptState, scriptStateIn UserScript, "TestInterfaceImplementation", "stringAttribute", holder, v8String(s criptState->isolate(), cppValue));
2169 } 2169 }
2170 2170
2171 } // namespace blink 2171 } // namespace blink
2172 #endif // ENABLE(CONDITION) 2172 #endif // ENABLE(CONDITION)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698