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

Unified 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: update code accordingly (w/o redundant type check for overload resolution) 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_interface.py
diff --git a/Source/bindings/scripts/v8_interface.py b/Source/bindings/scripts/v8_interface.py
index 9cb32a59af27c5984346bf23bf7c82a820cc6830..39edb03092eb67187083116c568b9c6092e79c05 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -753,6 +753,18 @@ def resolution_tests_methods(effective_overloads):
test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.format(idl_type=idl_type.base_type, cpp_value=cpp_value)
yield test, method
+ # all arguments here of wrapper type are checked by resolution (see above),
+ # they should not be check again for [TypeChecking=interface] methods during
+ # args checking. We mark resolution related arguments as type_checked_already
+ # to avoid redundant checking. However, if there are optional argument(s) in
+ # an overloading method, the method will have multiple callers. Resolution
+ # related argument may be not resolved in some callers in this situation.
+ # So, we just mark those resolution associated arguments whose method has
+ # no optional arguments, for safety.
+ for argument, method in arguments_methods:
+ argument['type_checked_already'] = (argument['is_wrapper_type'] and
+ method['number_of_required_arguments'] == method['number_of_arguments'])
+
# 8. Otherwise: if V is any kind of object except for a native Date object,
# a native RegExp object, and there is an entry in S that has one of the
# following types at position i of its type list,
@@ -910,6 +922,7 @@ def constructor_context(interface, constructor):
'is_constructor': True,
'is_named_constructor': False,
'is_raises_exception': is_constructor_raises_exception,
+ 'number_of_arguments': len(constructor.arguments),
'number_of_required_arguments':
number_of_required_arguments(constructor),
}
« 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