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

Side by Side Diff: Source/bindings/tests/results/V8TestInterface.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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 { 553 {
554 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 554 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
555 TestInterfaceV8Internal::implementsMethod1Method(info); 555 TestInterfaceV8Internal::implementsMethod1Method(info);
556 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 556 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
557 } 557 }
558 558
559 static void implementsMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 559 static void implementsMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
560 { 560 {
561 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM ethod2", "TestInterface", info.Holder(), info.GetIsolate()); 561 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM ethod2", "TestInterface", info.Holder(), info.GetIsolate());
562 if (UNLIKELY(info.Length() < 2)) { 562 if (UNLIKELY(info.Length() < 2)) {
563 throwTypeError(ExceptionMessages::failedToExecute("implementsMethod2", " TestInterface", ExceptionMessages::notEnoughArguments(2, info.Length())), info.G etIsolate()); 563 exceptionState.notEnoughArguments(2, info.Length());
564 return; 564 return;
565 } 565 }
566 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 566 TestInterface* imp = V8TestInterface::toNative(info.Holder());
567 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 567 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
568 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0); 568 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0);
569 ExecutionContext* scriptContext = getExecutionContext(); 569 ExecutionContext* scriptContext = getExecutionContext();
570 RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, im p, strArg, objArg, exceptionState); 570 RefPtr<TestObj> result = TestImplements::implementsMethod2(scriptContext, im p, strArg, objArg, exceptionState);
571 if (exceptionState.throwIfNeeded()) 571 if (exceptionState.throwIfNeeded())
572 return; 572 return;
573 v8SetReturnValue(info, result.release()); 573 v8SetReturnValue(info, result.release());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 TestInterfaceV8Internal::supplementalMethod1Method(info); 614 TestInterfaceV8Internal::supplementalMethod1Method(info);
615 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 615 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
616 } 616 }
617 #endif // ENABLE(Condition11) || ENABLE(Condition12) 617 #endif // ENABLE(Condition11) || ENABLE(Condition12)
618 618
619 #if ENABLE(Condition11) || ENABLE(Condition12) 619 #if ENABLE(Condition11) || ENABLE(Condition12)
620 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 620 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
621 { 621 {
622 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate()); 622 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate());
623 if (UNLIKELY(info.Length() < 2)) { 623 if (UNLIKELY(info.Length() < 2)) {
624 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2", "TestInterface", ExceptionMessages::notEnoughArguments(2, info.Length())), info .GetIsolate()); 624 exceptionState.notEnoughArguments(2, info.Length());
625 return; 625 return;
626 } 626 }
627 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 627 TestInterface* imp = V8TestInterface::toNative(info.Holder());
628 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 628 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
629 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0); 629 V8TRYCATCH_VOID(TestObj*, objArg, V8TestObject::hasInstance(info[1], info.Ge tIsolate(), worldType(info.GetIsolate())) ? V8TestObject::toNative(v8::Handle<v8 ::Object>::Cast(info[1])) : 0);
630 ExecutionContext* scriptContext = getExecutionContext(); 630 ExecutionContext* scriptContext = getExecutionContext();
631 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon text, imp, strArg, objArg, exceptionState); 631 RefPtr<TestObj> result = TestPartialInterface::supplementalMethod2(scriptCon text, imp, strArg, objArg, exceptionState);
632 if (exceptionState.throwIfNeeded()) 632 if (exceptionState.throwIfNeeded())
633 return; 633 return;
634 v8SetReturnValue(info, result.release()); 634 v8SetReturnValue(info, result.release());
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 } 988 }
989 989
990 template<> 990 template<>
991 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 991 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
992 { 992 {
993 return toV8(impl, creationContext, isolate); 993 return toV8(impl, creationContext, isolate);
994 } 994 }
995 995
996 } // namespace WebCore 996 } // namespace WebCore
997 #endif // ENABLE(Condition1) || ENABLE(Condition2) 997 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698