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

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

Issue 113783002: [POSSIBLE PERFORMANCE IMPACT] Remove UNLIKELY from bindings required arguments check (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove FIXME 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 | Annotate | Revision Log
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 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 static void implementsMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info) 548 static void implementsMethod1MethodCallback(const v8::FunctionCallbackInfo<v8::V alue>& info)
549 { 549 {
550 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 550 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
551 TestInterfaceV8Internal::implementsMethod1Method(info); 551 TestInterfaceV8Internal::implementsMethod1Method(info);
552 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 552 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
553 } 553 }
554 554
555 static void implementsMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo) 555 static void implementsMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& i nfo)
556 { 556 {
557 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM ethod2", "TestInterface", info.Holder(), info.GetIsolate()); 557 ExceptionState exceptionState(ExceptionState::ExecutionContext, "implementsM ethod2", "TestInterface", info.Holder(), info.GetIsolate());
558 if (UNLIKELY(info.Length() < 2)) { 558 if (info.Length() < 2) {
559 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 559 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
560 exceptionState.throwIfNeeded(); 560 exceptionState.throwIfNeeded();
561 return; 561 return;
562 } 562 }
563 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 563 TestInterface* imp = V8TestInterface::toNative(info.Holder());
564 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 564 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
565 if (info.Length() <= 1 || !info[1]->IsFunction()) { 565 if (info.Length() <= 1 || !info[1]->IsFunction()) {
566 throwTypeError(ExceptionMessages::failedToExecute("implementsMethod2", " TestInterface", "The callback provided as parameter 2 is not a function."), info .GetIsolate()); 566 throwTypeError(ExceptionMessages::failedToExecute("implementsMethod2", " TestInterface", "The callback provided as parameter 2 is not a function."), info .GetIsolate());
567 return; 567 return;
568 } 568 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 614 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
615 TestInterfaceV8Internal::supplementalMethod1Method(info); 615 TestInterfaceV8Internal::supplementalMethod1Method(info);
616 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 616 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
617 } 617 }
618 #endif // ENABLE(Condition11) || ENABLE(Condition12) 618 #endif // ENABLE(Condition11) || ENABLE(Condition12)
619 619
620 #if ENABLE(Condition11) || ENABLE(Condition12) 620 #if ENABLE(Condition11) || ENABLE(Condition12)
621 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info) 621 static void supplementalMethod2Method(const v8::FunctionCallbackInfo<v8::Value>& info)
622 { 622 {
623 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate()); 623 ExceptionState exceptionState(ExceptionState::ExecutionContext, "supplementa lMethod2", "TestInterface", info.Holder(), info.GetIsolate());
624 if (UNLIKELY(info.Length() < 2)) { 624 if (info.Length() < 2) {
625 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length())); 625 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, i nfo.Length()));
626 exceptionState.throwIfNeeded(); 626 exceptionState.throwIfNeeded();
627 return; 627 return;
628 } 628 }
629 TestInterface* imp = V8TestInterface::toNative(info.Holder()); 629 TestInterface* imp = V8TestInterface::toNative(info.Holder());
630 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]); 630 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, strArg, info[0]);
631 if (info.Length() <= 1 || !info[1]->IsFunction()) { 631 if (info.Length() <= 1 || !info[1]->IsFunction()) {
632 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2", "TestInterface", "The callback provided as parameter 2 is not a function."), in fo.GetIsolate()); 632 throwTypeError(ExceptionMessages::failedToExecute("supplementalMethod2", "TestInterface", "The callback provided as parameter 2 is not a function."), in fo.GetIsolate());
633 return; 633 return;
634 } 634 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info) 670 static void supplementalMethod4MethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& info)
671 { 671 {
672 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 672 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
673 TestInterfaceV8Internal::supplementalMethod4Method(info); 673 TestInterfaceV8Internal::supplementalMethod4Method(info);
674 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 674 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
675 } 675 }
676 #endif // ENABLE(Condition11) || ENABLE(Condition12) 676 #endif // ENABLE(Condition11) || ENABLE(Condition12)
677 677
678 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 678 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
679 { 679 {
680 if (UNLIKELY(info.Length() < 1)) { 680 if (info.Length() < 1) {
681 throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TestIn terface", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol ate()); 681 throwTypeError(ExceptionMessages::failedToExecute("Constructor", "TestIn terface", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsol ate());
682 return; 682 return;
683 } 683 }
684 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rface", info.Holder(), info.GetIsolate()); 684 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rface", info.Holder(), info.GetIsolate());
685 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, info[0]); 685 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str1, info[0]);
686 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]); 686 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, str2, info[1]);
687 ExecutionContext* context = getExecutionContext(); 687 ExecutionContext* context = getExecutionContext();
688 RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exce ptionState); 688 RefPtr<TestInterface> impl = TestInterface::create(context, str1, str2, exce ptionState);
689 v8::Handle<v8::Object> wrapper = info.Holder(); 689 v8::Handle<v8::Object> wrapper = info.Holder();
690 if (exceptionState.throwIfNeeded()) 690 if (exceptionState.throwIfNeeded())
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 } 980 }
981 981
982 template<> 982 template<>
983 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate) 983 v8::Handle<v8::Value> toV8NoInline(TestInterface* impl, v8::Handle<v8::Object> c reationContext, v8::Isolate* isolate)
984 { 984 {
985 return toV8(impl, creationContext, isolate); 985 return toV8(impl, creationContext, isolate);
986 } 986 }
987 987
988 } // namespace WebCore 988 } // namespace WebCore
989 #endif // ENABLE(Condition1) || ENABLE(Condition2) 989 #endif // ENABLE(Condition1) || ENABLE(Condition2)
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestEventTarget.cpp ('k') | Source/bindings/tests/results/V8TestInterfaceConstructor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698