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

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: comments + coding style" 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 (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 # all arguments here of wrapper type are checked by resolution (see above),
757 # they should not be check again for [TypeChecking=interface] methods during
758 # args checking. We mark resolution related arguments as type_checked_alread y
759 # to avoid redundant checking. However, if there are optional argument(s) in
760 # an overloading method, the method will have multiple callers. Resolution
761 # related argument may be not resolved in some callers in this situation.
762 # So, we just mark those resolution associated arguments whose method has
763 # no optional arguments, for safe reason.
Nils Barth (inactive) 2014/10/13 14:36:56 "...for safety."
yunchao 2014/10/14 06:58:49 Done.
764 for argument, method in arguments_methods:
765 if argument['is_wrapper_type'] and method['number_of_required_arguments' ] == method['number_of_arguments']:
Nils Barth (inactive) 2014/10/13 14:36:56 line length Could you use (...) and break, so: if
yunchao 2014/10/14 06:58:49 Acknowledged.
766 argument['type_checked_already'] = True
767
768
756 # 8. Otherwise: if V is any kind of object except for a native Date object, 769 # 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 770 # 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, 771 # following types at position i of its type list,
759 # • an array type 772 # • an array type
760 # • a sequence type 773 # • a sequence type
761 # ... 774 # ...
762 # • a dictionary 775 # • a dictionary
763 # 776 #
764 # FIXME: 777 # FIXME:
765 # We don't strictly follow the algorithm here. The algorithm says "remove 778 # We don't strictly follow the algorithm here. The algorithm says "remove
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 # [ConstructorCallWith=Document] 916 # [ConstructorCallWith=Document]
904 has_extended_attribute_value(interface, 917 has_extended_attribute_value(interface,
905 'ConstructorCallWith', 'Document'), 918 'ConstructorCallWith', 'Document'),
906 'is_call_with_execution_context': 919 'is_call_with_execution_context':
907 # [ConstructorCallWith=ExecutionContext] 920 # [ConstructorCallWith=ExecutionContext]
908 has_extended_attribute_value(interface, 921 has_extended_attribute_value(interface,
909 'ConstructorCallWith', 'ExecutionContext'), 922 'ConstructorCallWith', 'ExecutionContext'),
910 'is_constructor': True, 923 'is_constructor': True,
911 'is_named_constructor': False, 924 'is_named_constructor': False,
912 'is_raises_exception': is_constructor_raises_exception, 925 'is_raises_exception': is_constructor_raises_exception,
926 'number_of_arguments': len(constructor.arguments),
913 'number_of_required_arguments': 927 'number_of_required_arguments':
914 number_of_required_arguments(constructor), 928 number_of_required_arguments(constructor),
915 } 929 }
916 930
917 931
918 # [NamedConstructor] 932 # [NamedConstructor]
919 def named_constructor_context(interface): 933 def named_constructor_context(interface):
920 extended_attributes = interface.extended_attributes 934 extended_attributes = interface.extended_attributes
921 if 'NamedConstructor' not in extended_attributes: 935 if 'NamedConstructor' not in extended_attributes:
922 return None 936 return None
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 deleter = next( 1147 deleter = next(
1134 method 1148 method
1135 for method in interface.operations 1149 for method in interface.operations
1136 if ('deleter' in method.specials and 1150 if ('deleter' in method.specials and
1137 len(method.arguments) == 1 and 1151 len(method.arguments) == 1 and
1138 str(method.arguments[0].idl_type) == 'DOMString')) 1152 str(method.arguments[0].idl_type) == 'DOMString'))
1139 except StopIteration: 1153 except StopIteration:
1140 return None 1154 return None
1141 1155
1142 return property_deleter(deleter) 1156 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | Source/bindings/scripts/v8_methods.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698