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

Side by Side Diff: Source/bindings/tests/results/core/V8TestInterfaceConstructor4.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 #include "V8TestInterfaceConstructor4.h" 8 #include "V8TestInterfaceConstructor4.h"
9 9
10 #include "bindings/core/v8/ExceptionState.h" 10 #include "bindings/core/v8/ExceptionState.h"
(...skipping 13 matching lines...) Expand all
24 24
25 const WrapperTypeInfo V8TestInterfaceConstructor4::wrapperTypeInfo = { gin::kEmb edderBlink, V8TestInterfaceConstructor4::domTemplate, V8TestInterfaceConstructor 4::refObject, V8TestInterfaceConstructor4::derefObject, V8TestInterfaceConstruct or4::createPersistentHandle, 0, 0, 0, V8TestInterfaceConstructor4::installCondit ionallyEnabledMethods, V8TestInterfaceConstructor4::installConditionallyEnabledP roperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::Obje ctClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject }; 25 const WrapperTypeInfo V8TestInterfaceConstructor4::wrapperTypeInfo = { gin::kEmb edderBlink, V8TestInterfaceConstructor4::domTemplate, V8TestInterfaceConstructor 4::refObject, V8TestInterfaceConstructor4::derefObject, V8TestInterfaceConstruct or4::createPersistentHandle, 0, 0, 0, V8TestInterfaceConstructor4::installCondit ionallyEnabledMethods, V8TestInterfaceConstructor4::installConditionallyEnabledP roperties, 0, WrapperTypeInfo::WrapperTypeObjectPrototype, WrapperTypeInfo::Obje ctClassId, WrapperTypeInfo::Independent, WrapperTypeInfo::RefCountedObject };
26 26
27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eConstructor4.h. 27 // This static member must be declared by DEFINE_WRAPPERTYPEINFO in TestInterfac eConstructor4.h.
28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in 28 // For details, see the comment of DEFINE_WRAPPERTYPEINFO in
29 // bindings/core/v8/ScriptWrappable.h. 29 // bindings/core/v8/ScriptWrappable.h.
30 const WrapperTypeInfo& TestInterfaceConstructor4::s_wrapperTypeInfo = V8TestInte rfaceConstructor4::wrapperTypeInfo; 30 const WrapperTypeInfo& TestInterfaceConstructor4::s_wrapperTypeInfo = V8TestInte rfaceConstructor4::wrapperTypeInfo;
31 31
32 namespace TestInterfaceConstructor4V8Internal { 32 namespace TestInterfaceConstructor4V8Internal {
33 33
34 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info) 34 static void constructor1(const v8::FunctionCallbackInfo<v8::Value>& info, int ty pe_checked_argument_index)
35 { 35 {
36 TestInterfaceConstructor4* testInterface4Arg; 36 TestInterfaceConstructor4* testInterface4Arg;
37 { 37 {
38 testInterface4Arg = V8TestInterfaceConstructor4::toImplWithTypeCheck(inf o.GetIsolate(), info[0]); 38 if (type_checked_argument_index == 0)
39 testInterface4Arg = V8TestInterfaceConstructor4::toImpl(v8::Handle<v 8::Object>::Cast(info[0]));
40 else
41 testInterface4Arg = V8TestInterfaceConstructor4::toImplWithTypeCheck (info.GetIsolate(), info[0]);
39 } 42 }
40 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(t estInterface4Arg); 43 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(t estInterface4Arg);
41 v8::Handle<v8::Object> wrapper = info.Holder(); 44 v8::Handle<v8::Object> wrapper = info.Holder();
42 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr apper, info.GetIsolate()); 45 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr apper, info.GetIsolate());
43 v8SetReturnValue(info, wrapper); 46 v8SetReturnValue(info, wrapper);
44 } 47 }
45 48
46 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info) 49 static void constructor2(const v8::FunctionCallbackInfo<v8::Value>& info, int ty pe_checked_argument_index)
47 { 50 {
48 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor4", info.Holder(), info.GetIsolate()); 51 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor4", info.Holder(), info.GetIsolate());
49 V8StringResource<> scalarValueStringArg; 52 V8StringResource<> scalarValueStringArg;
50 { 53 {
51 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scalarValueStringArg, toScalarValu eString(info[0], exceptionState), exceptionState); 54 TONATIVE_VOID_EXCEPTIONSTATE_INTERNAL(scalarValueStringArg, toScalarValu eString(info[0], exceptionState), exceptionState);
52 } 55 }
53 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(s calarValueStringArg); 56 RefPtr<TestInterfaceConstructor4> impl = TestInterfaceConstructor4::create(s calarValueStringArg);
54 v8::Handle<v8::Object> wrapper = info.Holder(); 57 v8::Handle<v8::Object> wrapper = info.Holder();
55 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr apper, info.GetIsolate()); 58 impl->associateWithWrapper(&V8TestInterfaceConstructor4::wrapperTypeInfo, wr apper, info.GetIsolate());
56 v8SetReturnValue(info, wrapper); 59 v8SetReturnValue(info, wrapper);
57 } 60 }
58 61
59 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info) 62 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& info)
60 { 63 {
61 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor4", info.Holder(), info.GetIsolate()); 64 ExceptionState exceptionState(ExceptionState::ConstructionContext, "TestInte rfaceConstructor4", info.Holder(), info.GetIsolate());
62 switch (std::min(1, info.Length())) { 65 switch (std::min(1, info.Length())) {
63 case 1: 66 case 1:
64 if (V8TestInterfaceConstructor4::hasInstance(info[0], info.GetIsolate()) ) { 67 if (V8TestInterfaceConstructor4::hasInstance(info[0], info.GetIsolate()) ) {
65 TestInterfaceConstructor4V8Internal::constructor1(info); 68 TestInterfaceConstructor4V8Internal::constructor1(info, 0);
66 return; 69 return;
67 } 70 }
68 if (true) { 71 if (true) {
69 TestInterfaceConstructor4V8Internal::constructor2(info); 72 TestInterfaceConstructor4V8Internal::constructor2(info, -1);
70 return; 73 return;
71 } 74 }
72 break; 75 break;
73 default: 76 default:
74 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length())); 77 exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, i nfo.Length()));
75 exceptionState.throwIfNeeded(); 78 exceptionState.throwIfNeeded();
76 return; 79 return;
77 } 80 }
78 exceptionState.throwTypeError("No matching constructor signature."); 81 exceptionState.throwTypeError("No matching constructor signature.");
79 exceptionState.throwIfNeeded(); 82 exceptionState.throwIfNeeded();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 return 0; 158 return 0;
156 } 159 }
157 160
158 template<> 161 template<>
159 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor4* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate) 162 v8::Handle<v8::Value> toV8NoInline(TestInterfaceConstructor4* impl, v8::Handle<v 8::Object> creationContext, v8::Isolate* isolate)
160 { 163 {
161 return toV8(impl, creationContext, isolate); 164 return toV8(impl, creationContext, isolate);
162 } 165 }
163 166
164 } // namespace blink 167 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698