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

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

Issue 608853008: Canvas2D Performance: fix the bottleneck of hasInstance in JS binding -- TypeChecking Interface (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update code according to Jens's suggestions 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 | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_types.py
diff --git a/Source/bindings/scripts/v8_types.py b/Source/bindings/scripts/v8_types.py
index a63a39326c34290d437e66f575a8979d8e177ec1..685bd1dbb5b95698e18e1a35f94b835aa6ff9a9b 100644
--- a/Source/bindings/scripts/v8_types.py
+++ b/Source/bindings/scripts/v8_types.py
@@ -501,7 +501,7 @@ def v8_conversion_is_trivial(idl_type):
IdlType.v8_conversion_is_trivial = property(v8_conversion_is_trivial)
-def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolate):
+def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, needs_type_check, index, isolate):
if idl_type.name == 'void':
return ''
@@ -532,9 +532,12 @@ def v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolat
'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
elif idl_type.is_dictionary:
cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exceptionState)'
- else:
+ elif needs_type_check:
cpp_expression_format = (
'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})')
+ else:
+ cpp_expression_format = (
+ 'V8{idl_type}::toImpl(v8::Handle<v8::Object>::Cast({v8_value}))')
return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_type, v8_value=v8_value, isolate=isolate)
@@ -560,7 +563,7 @@ def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value,
return expression
-def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False):
+def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variable_name, needs_type_check=True, index=None, declare_variable=True, isolate='info.GetIsolate()', used_in_private_script=False, return_promise=False):
"""Returns an expression that converts a V8 value to a C++ value and stores it as a local value."""
# FIXME: Support union type.
@@ -573,7 +576,7 @@ def v8_value_to_local_cpp_value(idl_type, extended_attributes, v8_value, variabl
if idl_type.base_type in ('void', 'object', 'EventHandler', 'EventListener'):
return '/* no V8 -> C++ conversion for IDL type: %s */' % idl_type.name
- cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, index, isolate)
+ cpp_value = v8_value_to_cpp_value(idl_type, extended_attributes, v8_value, needs_type_check, index, isolate)
if idl_type.is_string_type or idl_type.v8_conversion_needs_exception_state:
# Types that need error handling and use one of a group of (C++) macros
# to take care of this.
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/tests/idls/core/TestObject.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698