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

Unified Diff: Source/bindings/scripts/v8_interface.py

Issue 657523002: Skip expensive hasInstance() type-checks in overloads (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor updates 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..50e9bc12c07c415613f8cc72efb7120997f29489 100644
--- a/Source/bindings/scripts/v8_interface.py
+++ b/Source/bindings/scripts/v8_interface.py
@@ -688,7 +688,7 @@ def resolution_tests_methods(effective_overloads):
for effective_overload in effective_overloads]
if len(methods) == 1:
# If only one method with a given length, no test needed
- yield 'true', methods[0]
+ yield 'true', methods[0], -1
return
# 6. If there is more than one entry in S, then set d to be the
@@ -710,6 +710,9 @@ def resolution_tests_methods(effective_overloads):
idl_types = [argument['idl_type_object'] for argument in arguments]
idl_types_methods = zip(idl_types, methods)
+ for argument in arguments:
+ argument['is_ever_distinguishing_argument'] = True
+
# We can’t do a single loop through all methods or simply sort them, because
# a method may be listed in multiple steps of the resolution algorithm, and
# which test to apply differs depending on the step.
@@ -725,7 +728,7 @@ def resolution_tests_methods(effective_overloads):
method = next(method for argument, method in arguments_methods
if argument['is_optional'])
test = '%s->IsUndefined()' % cpp_value
- yield test, method
+ yield test, method, -1
except StopIteration:
pass
@@ -736,7 +739,7 @@ def resolution_tests_methods(effective_overloads):
method = next(method for idl_type, method in idl_types_methods
if idl_type.is_nullable)
test = 'isUndefinedOrNull(%s)' % cpp_value
- yield test, method
+ yield test, method, -1
except StopIteration:
pass
@@ -751,7 +754,7 @@ def resolution_tests_methods(effective_overloads):
for idl_type, method in idl_types_methods
if idl_type.is_wrapper_type):
test = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate())'.format(idl_type=idl_type.base_type, cpp_value=cpp_value)
- yield test, method
+ yield test, method, index
# 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
@@ -773,13 +776,13 @@ def resolution_tests_methods(effective_overloads):
# (We test for Array instead of generic Object to type-check.)
# FIXME: test for Object during resolution, then have type check for
# Array in overloaded method: http://crbug.com/262383
- yield '%s->IsArray()' % cpp_value, method
+ yield '%s->IsArray()' % cpp_value, method, index
for idl_type, method in idl_types_methods:
if idl_type.is_dictionary or idl_type.name == 'Dictionary':
# FIXME: should be '{1}->IsObject() && !{1}->IsDate() && !{1}->IsRegExp()'.format(cpp_value)
# FIXME: the IsDate and IsRegExp checks can be skipped if we've
# already generated tests for them.
- yield '%s->IsObject()' % cpp_value, method
+ yield '%s->IsObject()' % cpp_value, method, index
# (Check for exact type matches before performing automatic type conversion;
# only needed if distinguishing between primitive types.)
@@ -795,7 +798,7 @@ def resolution_tests_methods(effective_overloads):
method = next(method for idl_type, method in idl_types_methods
if idl_type.is_numeric_type)
test = '%s->IsNumber()' % cpp_value
- yield test, method
+ yield test, method, index
except StopIteration:
pass
@@ -813,7 +816,7 @@ def resolution_tests_methods(effective_overloads):
try:
method = next(method for idl_type, method in idl_types_methods
if idl_type.is_string_type or idl_type.is_enum)
- yield 'true', method
+ yield 'true', method, -1
except StopIteration:
pass
@@ -823,7 +826,7 @@ def resolution_tests_methods(effective_overloads):
try:
method = next(method for idl_type, method in idl_types_methods
if idl_type.is_numeric_type)
- yield 'true', method
+ yield 'true', method, -1
except StopIteration:
pass
« 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