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

Side by Side Diff: Source/bindings/scripts/v8_types.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: 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 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 if base_idl_type in V8_VALUE_TO_CPP_VALUE: 527 if base_idl_type in V8_VALUE_TO_CPP_VALUE:
528 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type] 528 cpp_expression_format = V8_VALUE_TO_CPP_VALUE[base_idl_type]
529 elif idl_type.is_typed_array_element_type: 529 elif idl_type.is_typed_array_element_type:
530 cpp_expression_format = ( 530 cpp_expression_format = (
531 '{v8_value}->Is{idl_type}() ? ' 531 '{v8_value}->Is{idl_type}() ? '
532 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0') 532 'V8{idl_type}::toImpl(v8::Handle<v8::{idl_type}>::Cast({v8_value})) : 0')
533 elif idl_type.is_dictionary: 533 elif idl_type.is_dictionary:
534 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exc eptionState)' 534 cpp_expression_format = 'V8{idl_type}::toImpl({isolate}, {v8_value}, exc eptionState)'
535 else: 535 else:
536 cpp_expression_format = ( 536 cpp_expression_format = (
537 'V8{idl_type}::toImplWithTypeCheck({isolate}, {v8_value})') 537 'V8{idl_type}::toImpl(v8::Handle<v8::Object>::Cast({v8_value}))')
Jens Widell 2014/09/29 10:04:46 So what you did here is remove the only type-check
538 538
539 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, isolate=isolate) 539 return cpp_expression_format.format(arguments=arguments, idl_type=base_idl_t ype, v8_value=v8_value, isolate=isolate)
540 540
541 541
542 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value, index, isolate='info.GetIsolate()'): 542 def v8_value_to_cpp_value_array_or_sequence(native_array_element_type, v8_value, index, isolate='info.GetIsolate()'):
543 # Index is None for setters, index (starting at 0) for method arguments, 543 # Index is None for setters, index (starting at 0) for method arguments,
544 # and is used to provide a human-readable exception message 544 # and is used to provide a human-readable exception message
545 if index is None: 545 if index is None:
546 index = 0 # special case, meaning "setter" 546 index = 0 # special case, meaning "setter"
547 else: 547 else:
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 864
865 865
866 def is_explicit_nullable(idl_type): 866 def is_explicit_nullable(idl_type):
867 # Nullable type that isn't implicit nullable (see above.) For such types, 867 # Nullable type that isn't implicit nullable (see above.) For such types,
868 # we use Nullable<T> or similar explicit ways to represent a null value. 868 # we use Nullable<T> or similar explicit ways to represent a null value.
869 return idl_type.is_nullable and not idl_type.is_implicit_nullable 869 return idl_type.is_nullable and not idl_type.is_implicit_nullable
870 870
871 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable) 871 IdlTypeBase.is_implicit_nullable = property(is_implicit_nullable)
872 IdlUnionType.is_implicit_nullable = False 872 IdlUnionType.is_implicit_nullable = False
873 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable) 873 IdlTypeBase.is_explicit_nullable = property(is_explicit_nullable)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698