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

Issue 946973005: IDL: Drop value conversion (V8 -> C++) macros from generated code (Closed)

Created:
5 years, 10 months ago by Jens Widell
Modified:
5 years, 10 months ago
Reviewers:
haraken, yhirano, bashi
CC:
blink-reviews, blink-reviews-bindings_chromium.org, vivekg_samsung, arv+blink, vivekg
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Target Ref:
refs/heads/master
Project:
blink
Visibility:
Public.

Description

IDL: Drop value conversion (V8 -> C++) macros from generated code Instead of using an ever growing set of per-type-and-situation macros to perform the conversion from V8 value to C++ value (e.g. for method arguments and in attribute setters), just generate regular C++ code that does the same job. In many cases, this leads to roughly the same amount of code, and is arguable easier to read unless one is very familiar with all the different macros and their definitions. Technically, the v8_types.v8_value_to_local_cpp_value() function now returns a small template context dictionary instead of a "single- expression" string, and a new template macro is used to generate the multi-line conversion code using this context. All now unused macros in V8BindingMacros.h are removed. The remaining macros are used from custom bindings code, which will be rewritten to not use them too and thus better match the corresponding generated code. (There was already a fair amount of mismatch between the two.) BUG= Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=190816

Patch Set 1 #

Patch Set 2 : #

Total comments: 9

Patch Set 3 : drop macros entirely #

Patch Set 4 : #

Patch Set 5 : minor cleanup #

Total comments: 6

Patch Set 6 : remove (now) unused macros #

Patch Set 7 : remove duplicate variable declaration #

Patch Set 8 : fix indentation glitch #

Patch Set 9 : remove redundant semi-colon #

Patch Set 10 : make ExceptionState.throwException() private again #

Total comments: 4

Patch Set 11 : drop throw_expression, re-add set_expression #

Total comments: 10

Patch Set 12 : address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1518 lines, -653 lines) Patch
M Source/bindings/core/v8/V8BindingMacros.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +6 lines, -83 lines 0 comments Download
M Source/bindings/core/v8/V8StringResource.h View 1 2 1 chunk +6 lines, -0 lines 0 comments Download
M Source/bindings/scripts/v8_attributes.py View 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/scripts/v8_dictionary.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -2 lines 0 comments Download
M Source/bindings/scripts/v8_interface.py View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 3 3 chunks +19 lines, -21 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +42 lines, -39 lines 0 comments Download
M Source/bindings/scripts/v8_union.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M Source/bindings/templates/attributes.cpp View 1 2 3 4 chunks +5 lines, -5 lines 0 comments Download
A Source/bindings/templates/conversions.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +31 lines, -0 lines 0 comments Download
M Source/bindings/templates/dictionary_v8.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +4 lines, -7 lines 0 comments Download
M Source/bindings/templates/interface.cpp View 1 2 3 4 5 6 7 8 4 chunks +10 lines, -4 lines 0 comments Download
M Source/bindings/templates/methods.cpp View 1 2 3 4 5 6 7 8 9 10 11 18 chunks +44 lines, -38 lines 0 comments Download
M Source/bindings/templates/templates.gni View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/templates/templates.gypi View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M Source/bindings/templates/union.cpp View 1 2 3 4 5 6 7 8 9 10 7 chunks +7 lines, -9 lines 0 comments Download
M Source/bindings/tests/results/core/UnionTypesCore.cpp View 1 2 3 4 5 6 7 8 9 10 11 chunks +54 lines, -18 lines 0 comments Download
M Source/bindings/tests/results/core/V8SVGTestInterface.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestDictionary.cpp View 1 2 3 4 5 6 7 8 9 10 13 chunks +39 lines, -13 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestDictionaryDerived.cpp View 1 2 3 4 5 6 7 8 9 10 2 chunks +6 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterface.cpp View 1 2 3 4 5 6 7 8 9 10 37 chunks +119 lines, -40 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterface2.cpp View 1 2 3 4 5 6 7 8 8 chunks +22 lines, -8 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterface3.cpp View 1 2 2 chunks +4 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp View 1 2 2 chunks +6 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 2 6 chunks +39 lines, -13 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp View 1 2 6 chunks +24 lines, -8 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceEventConstructor.cpp View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceEventInit.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceEventInitConstructor.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +6 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp View 1 2 5 chunks +13 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp View 1 2 2 chunks +15 lines, -5 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceNode.cpp View 1 2 3 chunks +9 lines, -3 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestInterfaceWillBeGarbageCollected.cpp View 1 2 2 chunks +6 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestNode.cpp View 1 2 4 chunks +12 lines, -4 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestObject.cpp View 1 2 3 4 5 6 7 8 9 10 256 chunks +823 lines, -270 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 2 7 chunks +24 lines, -8 lines 0 comments Download
M Source/bindings/tests/results/modules/UnionTypesModules.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -1 line 0 comments Download
M Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 2 3 4 5 6 7 8 9 10 15 chunks +52 lines, -18 lines 0 comments Download
M Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp View 1 2 11 chunks +36 lines, -9 lines 0 comments Download

Messages

Total messages: 33 (3 generated)
Jens Widell
PTAL Sorry about the big CL. Context: https://codereview.chromium.org/938733003/#msg3 (total complexity might be unchanged, but the ...
5 years, 10 months ago (2015-02-23 16:51:11 UTC) #2
Jens Widell
On 2015/02/23 16:51:11, Jens Widell wrote: > Context: https://codereview.chromium.org/938733003/#msg3 (total complexity might > be unchanged, ...
5 years, 10 months ago (2015-02-23 16:52:59 UTC) #3
haraken
On 2015/02/23 16:52:59, Jens Widell wrote: > On 2015/02/23 16:51:11, Jens Widell wrote: > > ...
5 years, 10 months ago (2015-02-23 17:20:59 UTC) #4
bashi
I think this is a nice cleanup. Thank you for working on this! https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/V8Binding.h File ...
5 years, 10 months ago (2015-02-23 23:44:06 UTC) #5
yhirano
https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h File Source/bindings/core/v8/ExceptionState.h (right): https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h#newcode99 Source/bindings/core/v8/ExceptionState.h:99: void throwException(); Can you tell me why you want ...
5 years, 10 months ago (2015-02-24 03:51:24 UTC) #6
Jens Widell
https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h File Source/bindings/core/v8/ExceptionState.h (right): https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h#newcode99 Source/bindings/core/v8/ExceptionState.h:99: void throwException(); On 2015/02/24 03:51:24, yhirano wrote: > Can ...
5 years, 10 months ago (2015-02-24 07:31:43 UTC) #7
haraken
I think this is a right way to go overall, so we might want to ...
5 years, 10 months ago (2015-02-24 07:56:16 UTC) #8
Jens Widell
PS#3 drops the macros entirely and instead emits multi-line code from the Python scripts (i.e. ...
5 years, 10 months ago (2015-02-24 07:58:54 UTC) #9
Jens Widell
PS#4 rewrites the patch again so that v8_types.py:v8_value_to_local_cpp_value() returns a small Jinja context object which ...
5 years, 10 months ago (2015-02-24 11:56:17 UTC) #10
haraken
I cannot find TONATIVE_* and TOSTRING_* in patch set 5. Where did they go? https://codereview.chromium.org/946973005/diff/80001/Source/bindings/templates/conversions.cpp ...
5 years, 10 months ago (2015-02-24 12:44:57 UTC) #11
Jens Widell
On 2015/02/24 12:44:57, haraken wrote: > I cannot find TONATIVE_* and TOSTRING_* in patch set ...
5 years, 10 months ago (2015-02-24 13:36:08 UTC) #12
haraken
> > I cannot find TONATIVE_* and TOSTRING_* in patch set 5. Where did they ...
5 years, 10 months ago (2015-02-24 14:05:41 UTC) #13
Jens Widell
On 2015/02/24 14:05:41, haraken wrote: > > > I cannot find TONATIVE_* and TOSTRING_* in ...
5 years, 10 months ago (2015-02-24 14:13:00 UTC) #14
haraken
On 2015/02/24 14:13:00, Jens Widell wrote: > On 2015/02/24 14:05:41, haraken wrote: > > > ...
5 years, 10 months ago (2015-02-24 14:15:49 UTC) #15
Jens Widell
On 2015/02/24 14:15:49, haraken wrote: > On 2015/02/24 14:13:00, Jens Widell wrote: > > On ...
5 years, 10 months ago (2015-02-24 14:21:16 UTC) #16
haraken
On 2015/02/24 14:21:16, Jens Widell wrote: > On 2015/02/24 14:15:49, haraken wrote: > > On ...
5 years, 10 months ago (2015-02-24 15:20:50 UTC) #17
Jens Widell
On 2015/02/24 15:20:50, haraken wrote: > On 2015/02/24 14:21:16, Jens Widell wrote: > > On ...
5 years, 10 months ago (2015-02-24 15:30:35 UTC) #18
Jens Widell
https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h File Source/bindings/core/v8/ExceptionState.h (right): https://codereview.chromium.org/946973005/diff/20001/Source/bindings/core/v8/ExceptionState.h#newcode99 Source/bindings/core/v8/ExceptionState.h:99: void throwException(); On 2015/02/24 07:31:43, Jens Widell wrote: > ...
5 years, 10 months ago (2015-02-24 15:34:57 UTC) #19
haraken
On 2015/02/24 15:30:35, Jens Widell wrote: > On 2015/02/24 15:20:50, haraken wrote: > > On ...
5 years, 10 months ago (2015-02-24 15:46:49 UTC) #20
haraken
LGTM https://codereview.chromium.org/946973005/diff/180001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/946973005/diff/180001/Source/bindings/scripts/v8_methods.py#newcode359 Source/bindings/scripts/v8_methods.py:359: check_expression = 'exceptionState.throwIfNeeded()' I'm a bit confused about ...
5 years, 10 months ago (2015-02-24 15:59:39 UTC) #21
Jens Widell
https://codereview.chromium.org/946973005/diff/180001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/946973005/diff/180001/Source/bindings/scripts/v8_methods.py#newcode359 Source/bindings/scripts/v8_methods.py:359: check_expression = 'exceptionState.throwIfNeeded()' On 2015/02/24 15:59:38, haraken wrote: > ...
5 years, 10 months ago (2015-02-24 16:15:59 UTC) #22
Jens Widell
On 2015/02/24 16:15:59, Jens Widell wrote: > Now that you brought it up, I'm inclined ...
5 years, 10 months ago (2015-02-24 16:48:34 UTC) #23
haraken
LGTM https://codereview.chromium.org/946973005/diff/200001/Source/bindings/scripts/v8_types.py File Source/bindings/scripts/v8_types.py (right): https://codereview.chromium.org/946973005/diff/200001/Source/bindings/scripts/v8_types.py#newcode645 Source/bindings/scripts/v8_types.py:645: Although your CL is an improvement, the above ...
5 years, 10 months ago (2015-02-24 17:28:13 UTC) #24
yhirano
https://codereview.chromium.org/946973005/diff/200001/Source/bindings/templates/methods.cpp File Source/bindings/templates/methods.cpp (right): https://codereview.chromium.org/946973005/diff/200001/Source/bindings/templates/methods.cpp#newcode309 Source/bindings/templates/methods.cpp:309: {% macro throw_from_exception_state(method_or_overloads) %} You changed this macro's meaning ...
5 years, 10 months ago (2015-02-25 04:00:11 UTC) #25
bashi
https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h File Source/bindings/core/v8/V8BindingMacros.h (right): https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h#newcode53 Source/bindings/core/v8/V8BindingMacros.h:53: v8::TryCatch block; \ BTW, should we use V8RethrowTryCatchScope here ...
5 years, 10 months ago (2015-02-25 04:44:35 UTC) #26
Jens Widell
https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h File Source/bindings/core/v8/V8BindingMacros.h (right): https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h#newcode53 Source/bindings/core/v8/V8BindingMacros.h:53: v8::TryCatch block; \ On 2015/02/25 04:44:35, bashi1 wrote: > ...
5 years, 10 months ago (2015-02-25 07:37:11 UTC) #27
Jens Widell
https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h File Source/bindings/core/v8/V8BindingMacros.h (right): https://codereview.chromium.org/946973005/diff/200001/Source/bindings/core/v8/V8BindingMacros.h#newcode53 Source/bindings/core/v8/V8BindingMacros.h:53: v8::TryCatch block; \ On 2015/02/25 07:37:10, Jens Widell wrote: ...
5 years, 10 months ago (2015-02-25 07:49:43 UTC) #28
yhirano
lgtm
5 years, 10 months ago (2015-02-25 07:50:51 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/946973005/210001
5 years, 10 months ago (2015-02-25 09:35:03 UTC) #32
commit-bot: I haz the power
5 years, 10 months ago (2015-02-25 09:40:02 UTC) #33
Message was sent while issue was closed.
Committed patchset #12 (id:210001) as
https://src.chromium.org/viewvc/blink?view=rev&revision=190816

Powered by Google App Engine
This is Rietveld 408576698