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

Side by Side Diff: Source/bindings/scripts/v8_interface.py

Issue 611953003: Canvas2D Performance: fix the bottleneck of hasInstance during JS binding -- overloading (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: remove typecheck for overloads if no optional argument + change toImplWithTypeCheck -> toImpl if th… 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
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
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 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 # • an interface type that V implements 746 # • an interface type that V implements
747 # (Unlike most of these tests, this can return multiple methods, since we 747 # (Unlike most of these tests, this can return multiple methods, since we
748 # test if it implements an interface. Thus we need a for loop, not a next.) 748 # test if it implements an interface. Thus we need a for loop, not a next.)
749 # (We distinguish wrapper types from built-in interface types.) 749 # (We distinguish wrapper types from built-in interface types.)
750 for idl_type, method in ((idl_type, method) 750 for idl_type, method in ((idl_type, method)
751 for idl_type, method in idl_types_methods 751 for idl_type, method in idl_types_methods
752 if idl_type.is_wrapper_type): 752 if idl_type.is_wrapper_type):
753 test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.forma t(idl_type=idl_type.base_type, cpp_value=cpp_value) 753 test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.forma t(idl_type=idl_type.base_type, cpp_value=cpp_value)
754 yield test, method 754 yield test, method
755 755
756 for argument, method in arguments_methods:
757 if argument['idl_type_object'].is_wrapper_type and method['number_of_req uired_arguments'] == method['number_of_arguments']:
yunchao 2014/10/02 10:51:56 both number_of_required_arguments and number_of_ar
758 argument['type_checked_already'] = True
759
760
756 # 8. Otherwise: if V is any kind of object except for a native Date object, 761 # 8. Otherwise: if V is any kind of object except for a native Date object,
757 # a native RegExp object, and there is an entry in S that has one of the 762 # a native RegExp object, and there is an entry in S that has one of the
758 # following types at position i of its type list, 763 # following types at position i of its type list,
759 # • an array type 764 # • an array type
760 # • a sequence type 765 # • a sequence type
761 # ... 766 # ...
762 # • a dictionary 767 # • a dictionary
763 # 768 #
764 # FIXME: 769 # FIXME:
765 # We don't strictly follow the algorithm here. The algorithm says "remove 770 # We don't strictly follow the algorithm here. The algorithm says "remove
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 deleter = next( 1138 deleter = next(
1134 method 1139 method
1135 for method in interface.operations 1140 for method in interface.operations
1136 if ('deleter' in method.specials and 1141 if ('deleter' in method.specials and
1137 len(method.arguments) == 1 and 1142 len(method.arguments) == 1 and
1138 str(method.arguments[0].idl_type) == 'DOMString')) 1143 str(method.arguments[0].idl_type) == 'DOMString'))
1139 except StopIteration: 1144 except StopIteration:
1140 return None 1145 return None
1141 1146
1142 return property_deleter(deleter) 1147 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698