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

Issue 265293004: Create fewer local v8::TryCatch objects in generated bindings code (Closed)

Created:
6 years, 7 months ago by Jens Widell
Modified:
6 years, 7 months ago
CC:
blink-reviews, arv+blink, jsbell+bindings_chromium.org, sof, kouhei+bindings_chromium.org, abarth-chromium, marja+watch_chromium.org, blink-reviews-bindings_chromium.org, Nate Chapin
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Create fewer local v8::TryCatch objects in generated bindings code When converting constructor and method arguments, switch from generating the equivalent of float x; {   v8::TryCatch block;   x = ...;   if (UNLIKELY(block.HasCaught()) {     block.ReThrow();     return;   } } float y; {   v8::TryCatch block;   y = ...;   /* check result again, same as above */ } to generating the equivalent of float x; float y; {   v8::TryCatch block;   x = ...;   if (UNLIKELY(block.HasCaught()) {     block.ReThrow();     return;   }   y = ...;   /* check result again, same as above */ } in order to avoid creating and destroying one v8::TryCatch object for each argument. This reduces the size of the final binary by about 20 kB (64-bit Linux) and improves performance by up to 30 % on favorable micro-benchmarks (repeatedly calling some DOM function that takes many primitive-typed arguments.) R=haraken, nbarth Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=174546

Patch Set 1 #

Total comments: 22

Patch Set 2 : address most comments #

Patch Set 3 : rebased #

Patch Set 4 : avoid some unused v8::TryCatch objects #

Total comments: 17

Patch Set 5 : address nits #

Patch Set 6 : simplify 'cpp_type' generation #

Total comments: 1

Patch Set 7 : unwrap line #

Patch Set 8 : rebased #

Patch Set 9 : call block.ReThrow() when throwing exceptions #

Total comments: 1

Patch Set 10 : rebased #

Patch Set 11 : add another missing ReThrow() #

Patch Set 12 : rebased #

Total comments: 4

Patch Set 13 : added comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1156 lines, -414 lines) Patch
M Source/bindings/scripts/v8_interface.py View 1 2 3 4 5 6 7 8 9 10 1 chunk +5 lines, -1 line 0 comments Download
M Source/bindings/scripts/v8_methods.py View 1 2 3 4 5 6 7 8 9 10 6 chunks +31 lines, -10 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +21 lines, -4 lines 0 comments Download
M Source/bindings/templates/methods.cpp View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +57 lines, -22 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface.cpp View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +54 lines, -23 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterface2.cpp View 1 2 3 4 5 6 7 8 9 10 6 chunks +31 lines, -8 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +30 lines, -17 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor2.cpp View 1 2 3 4 5 6 7 8 9 10 3 chunks +40 lines, -22 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceConstructor3.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceGarbageCollected.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor.cpp View 1 2 3 4 5 6 7 8 9 10 1 chunk +21 lines, -12 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNamedConstructor2.cpp View 1 2 3 4 5 6 7 8 9 1 chunk +4 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNode.cpp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +16 lines, -8 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceWillBeGarbageCollected.cpp View 1 2 3 4 5 6 7 8 9 2 chunks +9 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 1 2 3 4 5 6 7 8 9 10 11 114 chunks +737 lines, -251 lines 0 comments Download
M Source/bindings/tests/results/V8TestSpecialOperations.cpp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +4 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestTypedefs.cpp View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +41 lines, -14 lines 0 comments Download
M Source/bindings/v8/V8BindingMacros.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +32 lines, -14 lines 0 comments Download
M Source/bindings/v8/V8StringResource.h View 1 2 3 4 5 6 7 1 chunk +10 lines, -1 line 0 comments Download

Messages

Total messages: 53 (0 generated)
Jens Widell
Please have a look, when convenient. Background: Was looking at the generated code, trying to ...
6 years, 7 months ago (2014-05-05 15:00:30 UTC) #1
haraken
The idea looks great to me. nbarth@, would you mind taking a first look?
6 years, 7 months ago (2014-05-05 15:10:01 UTC) #2
Jens Widell
On 2014/05/05 15:00:30, Jens Lindström wrote: > Please have a look, when convenient. And, while ...
6 years, 7 months ago (2014-05-06 09:15:16 UTC) #3
Nils Barth (inactive)
Thanks Jens, idea and most code seems great! haraken: performance impact likely to be more ...
6 years, 7 months ago (2014-05-07 03:02:19 UTC) #4
haraken
> haraken: performance impact likely to be more significant in future with more > type ...
6 years, 7 months ago (2014-05-07 03:06:14 UTC) #5
Nils Barth (inactive)
On 2014/05/06 09:15:16, Jens Lindström wrote: > And, while you're here, maybe answer a question: ...
6 years, 7 months ago (2014-05-07 03:20:15 UTC) #6
Daniel Bratell
On 2014/05/05 15:00:30, Jens Lindström wrote: > Please have a look, when convenient. > > ...
6 years, 7 months ago (2014-05-07 09:06:52 UTC) #7
Jens Widell
Thanks for reviewing, Nils! I've uploaded three new patch sets. The first addresses most of ...
6 years, 7 months ago (2014-05-07 10:34:46 UTC) #8
Nils Barth (inactive)
LGTM CG-wise, with nits! Jens, could you summarize benefits (code size and performance) in the ...
6 years, 7 months ago (2014-05-08 00:55:13 UTC) #9
haraken
This is great CL. LGTM with comments. https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py#newcode48 Source/bindings/scripts/v8_methods.py:48: argument['is_variadic_wrapper_type']): I ...
6 years, 7 months ago (2014-05-08 03:45:05 UTC) #10
Jens Widell
https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py#newcode48 Source/bindings/scripts/v8_methods.py:48: argument['is_variadic_wrapper_type']): On 2014/05/08 03:45:06, haraken wrote: > > I ...
6 years, 7 months ago (2014-05-08 06:22:05 UTC) #11
Nils Barth (inactive)
https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py#newcode53 Source/bindings/scripts/v8_methods.py:53: if argument['v8_value_to_local_cpp_value'].startswith('TOSTRING_'): On 2014/05/08 06:22:06, Jens Lindström wrote: > ...
6 years, 7 months ago (2014-05-08 06:25:15 UTC) #12
Jens Widell
https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py#newcode43 Source/bindings/scripts/v8_methods.py:43: def argument_needs_try_catch(argument): On 2014/05/08 00:55:13, Nils Barth wrote: > ...
6 years, 7 months ago (2014-05-08 07:00:15 UTC) #13
Jens Widell
https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py#newcode43 Source/bindings/scripts/v8_methods.py:43: def argument_needs_try_catch(argument): On 2014/05/08 07:00:15, Jens Lindström wrote: > ...
6 years, 7 months ago (2014-05-08 16:38:05 UTC) #14
Jens Widell
PTAL. The change in latest patch set is a bit non-trivial. https://codereview.chromium.org/265293004/diff/100001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): ...
6 years, 7 months ago (2014-05-08 16:53:05 UTC) #15
Nils Barth (inactive)
CG LGTM - revised logic is v. logical. https://codereview.chromium.org/265293004/diff/140001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/140001/Source/bindings/scripts/v8_methods.py#newcode275 Source/bindings/scripts/v8_methods.py:275: index=index) ...
6 years, 7 months ago (2014-05-09 00:46:07 UTC) #16
haraken
LGTM. Looks nicer!
6 years, 7 months ago (2014-05-09 00:53:57 UTC) #17
Jens Widell
The CQ bit was checked by jl@opera.com
6 years, 7 months ago (2014-05-09 06:55:45 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jl@opera.com/265293004/180001
6 years, 7 months ago (2014-05-09 06:58:03 UTC) #19
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-09 08:21:21 UTC) #20
Jens Widell
On 2014/05/09 08:21:21, I haz the power (commit-bot) wrote: > FYI, CQ is re-trying this ...
6 years, 7 months ago (2014-05-09 08:36:56 UTC) #21
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-09 08:43:02 UTC) #22
commit-bot: I haz the power
Try jobs failed on following builders: mac_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/mac_blink_rel/builds/6298)
6 years, 7 months ago (2014-05-09 08:43:02 UTC) #23
Jens Widell
On 2014/05/09 08:36:56, Jens Lindström wrote: > Failure is, if I'm not mistaken, due to ...
6 years, 7 months ago (2014-05-09 10:42:31 UTC) #24
Jens Widell
On 2014/05/09 10:42:31, Jens Lindström wrote: > What am I missing? Alright, it seems the ...
6 years, 7 months ago (2014-05-09 11:55:30 UTC) #25
Jens Widell
haraken, nbarth: would you mind having yet another look at this? Very sorry about the ...
6 years, 7 months ago (2014-05-09 12:01:22 UTC) #26
Nils Barth (inactive)
On 2014/05/09 11:55:30, Jens Lindström wrote: > I'm assuming the correct thing to do is ...
6 years, 7 months ago (2014-05-09 12:07:01 UTC) #27
Nils Barth (inactive)
On 2014/05/09 12:01:22, Jens Lindström wrote: > haraken, nbarth: would you mind having yet another ...
6 years, 7 months ago (2014-05-09 12:07:42 UTC) #28
Jens Widell
On 2014/05/09 12:07:01, Nils Barth wrote: > Also, would it be possible for you to ...
6 years, 7 months ago (2014-05-09 13:18:14 UTC) #29
Jens Widell
The ReThrow() issues I was seeing seem related to https://code.google.com/p/chromium/issues/detail?id=362388. https://codereview.chromium.org/265293004/diff/200001/Source/bindings/v8/V8BindingMacros.h File Source/bindings/v8/V8BindingMacros.h (right): https://codereview.chromium.org/265293004/diff/200001/Source/bindings/v8/V8BindingMacros.h#newcode110 ...
6 years, 7 months ago (2014-05-09 13:42:09 UTC) #30
haraken
I'm sorry I haven't caught up the discussion, but v8::TryCatch is not nestable due to ...
6 years, 7 months ago (2014-05-09 14:07:43 UTC) #31
Jens Widell
On 2014/05/09 14:07:43, haraken wrote: > I'm sorry I haven't caught up the discussion, but ...
6 years, 7 months ago (2014-05-09 14:18:12 UTC) #32
haraken
On 2014/05/09 14:18:12, Jens Lindström wrote: > On 2014/05/09 14:07:43, haraken wrote: > > I'm ...
6 years, 7 months ago (2014-05-09 14:20:31 UTC) #33
Jens Widell
On 2014/05/09 14:20:31, haraken wrote: > I'll be in Munich next week, so I'll chat ...
6 years, 7 months ago (2014-05-09 14:28:32 UTC) #34
haraken
On 2014/05/09 14:28:32, Jens Lindström wrote: > On 2014/05/09 14:20:31, haraken wrote: > > I'll ...
6 years, 7 months ago (2014-05-09 14:33:52 UTC) #35
Jens Widell
Patch rebased (PS10, no conflicts) and then updated (PS11) to call block.ReThrow() after V8StringResource::prepare() when ...
6 years, 7 months ago (2014-05-19 10:41:12 UTC) #36
haraken
On 2014/05/19 10:41:12, Jens Lindström wrote: > Patch rebased (PS10, no conflicts) and then updated ...
6 years, 7 months ago (2014-05-20 06:46:06 UTC) #37
Jens Widell
On 2014/05/20 06:46:06, haraken wrote: > Yeah, in terms of programmability, we want to always ...
6 years, 7 months ago (2014-05-20 06:55:28 UTC) #38
Jens Widell
On 2014/05/20 06:55:28, Jens Lindström wrote: > On 2014/05/20 06:46:06, haraken wrote: > > Yeah, ...
6 years, 7 months ago (2014-05-21 13:41:43 UTC) #39
haraken
On 2014/05/21 13:41:43, Jens Lindström wrote: > On 2014/05/20 06:55:28, Jens Lindström wrote: > > ...
6 years, 7 months ago (2014-05-21 14:00:02 UTC) #40
Jens Widell
On 2014/05/21 14:00:02, haraken wrote: > In my understanding, if you land your CL to ...
6 years, 7 months ago (2014-05-21 14:15:28 UTC) #41
haraken
On 2014/05/21 14:15:28, Jens Lindström wrote: > On 2014/05/21 14:00:02, haraken wrote: > > In ...
6 years, 7 months ago (2014-05-21 14:47:06 UTC) #42
haraken
LGTM https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py#newcode56 Source/bindings/scripts/v8_methods.py:56: (base_type == 'DOMString' and not argument.is_variadic)) I'm a ...
6 years, 7 months ago (2014-05-21 14:56:44 UTC) #43
Jens Widell
https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py File Source/bindings/scripts/v8_methods.py (right): https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py#newcode56 Source/bindings/scripts/v8_methods.py:56: (base_type == 'DOMString' and not argument.is_variadic)) On 2014/05/21 14:56:45, ...
6 years, 7 months ago (2014-05-21 15:07:01 UTC) #44
haraken
On 2014/05/21 15:07:01, Jens Lindström wrote: > https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py > File Source/bindings/scripts/v8_methods.py (right): > > https://codereview.chromium.org/265293004/diff/260001/Source/bindings/scripts/v8_methods.py#newcode56 ...
6 years, 7 months ago (2014-05-21 15:33:53 UTC) #45
Jens Widell
The CQ bit was checked by jl@opera.com
6 years, 7 months ago (2014-05-21 15:47:26 UTC) #46
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jl@opera.com/265293004/280001
6 years, 7 months ago (2014-05-21 17:48:52 UTC) #47
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). Please consider checking whether the failures are ...
6 years, 7 months ago (2014-05-22 00:55:46 UTC) #48
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 7 months ago (2014-05-22 06:57:07 UTC) #49
commit-bot: I haz the power
Try jobs failed on following builders: linux_blink_dbg on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_dbg/builds/9171) linux_blink_rel on tryserver.blink (http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/8985)
6 years, 7 months ago (2014-05-22 06:57:08 UTC) #50
Jens Widell
The CQ bit was checked by jl@opera.com
6 years, 7 months ago (2014-05-22 09:55:26 UTC) #51
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/jl@opera.com/265293004/280001
6 years, 7 months ago (2014-05-22 09:55:53 UTC) #52
commit-bot: I haz the power
6 years, 7 months ago (2014-05-22 11:30:34 UTC) #53
Message was sent while issue was closed.
Change committed as 174546

Powered by Google App Engine
This is Rietveld 408576698