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

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

Powered by Google App Engine
This is Rietveld 408576698