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

Issue 386613002: FYI: Compile fixes when always using a local for method return value

Created:
6 years, 5 months ago by Jens Widell
Modified:
6 years, 2 months ago
Reviewers:
haraken
CC:
blink-reviews, arv+blink, tzik, nhiroki, abarth-chromium, blink-reviews-bindings_chromium.org, kinuko+fileapi, Daniel Bratell
Base URL:
https://chromium.googlesource.com/chromium/blink.git@idl-nullable-method-return-type
Project:
blink
Visibility:
Public.

Description

FYI: Compile fixes when always using a local for method return value By always storing the return value in a local, we tend to narrow the range of acceptable return values on the C++ side, compared to when passing the return value directly as an argument to a v8SetReturnValue() function or similar (since those are often overloaded or templates accepting a multitude of types.)

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -86 lines) Patch
M Source/bindings/scripts/v8_methods.py View 1 chunk +1 line, -7 lines 0 comments Download
M Source/bindings/scripts/v8_types.py View 1 chunk +11 lines, -4 lines 0 comments Download
M Source/bindings/tests/results/V8TestException.cpp View 1 chunk +2 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestInterface.cpp View 1 chunk +2 lines, -1 line 0 comments Download
M Source/bindings/tests/results/V8TestInterface2.cpp View 2 chunks +4 lines, -2 lines 0 comments Download
M Source/bindings/tests/results/V8TestInterfaceNode.cpp View 5 chunks +14 lines, -7 lines 0 comments Download
M Source/bindings/tests/results/V8TestObject.cpp View 50 chunks +106 lines, -53 lines 3 comments Download
M Source/bindings/tests/results/V8TestTypedefs.cpp View 3 chunks +6 lines, -3 lines 0 comments Download
M Source/core/testing/Internals.h View 2 chunks +2 lines, -2 lines 0 comments Download
M Source/core/testing/Internals.cpp View 2 chunks +6 lines, -4 lines 0 comments Download
M Source/modules/filesystem/EntrySync.h View 1 chunk +1 line, -1 line 0 comments Download
M Source/modules/filesystem/EntrySync.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 6 (0 generated)
Jens Widell
Just a FYI These changes were needed to compile (on 64-bit Linux) if a local ...
6 years, 5 months ago (2014-07-10 16:10:17 UTC) #1
Jens Widell
On 2014/07/10 16:10:17, Jens Lindström wrote: > Just a FYI > > These changes were ...
6 years, 5 months ago (2014-07-10 16:22:12 UTC) #2
haraken
The change looks reasonable to me. > Performance-wise, on a micro-benchmark measuring Document.getElementById(), > there ...
6 years, 5 months ago (2014-07-11 01:14:03 UTC) #3
Jens Widell
On 2014/07/11 01:14:03, haraken wrote: > The change looks reasonable to me. > > > ...
6 years, 5 months ago (2014-07-11 06:24:50 UTC) #4
Daniel Bratell
It's just a FYI so I don't know how serious this is, but it looks ...
6 years, 5 months ago (2014-07-11 12:29:39 UTC) #5
Jens Widell
6 years, 5 months ago (2014-07-11 12:50:04 UTC) #6
On 2014/07/11 12:29:39, Daniel Bratell wrote:
> It's just a FYI so I don't know how serious this is, but it looks like the
code
> will sometimes become less efficient. Would a static_cast accomplish the same
> positive effects as the local variable?

That the code sometimes becomes less efficient is the main worry, yes. I was
thinking mostly about ref-counting churn introduced by an explicit RefPtr<>
local, but clearly, vector copying due to introducing vector locals might be
even worse.

The point of using the local variable is that we sometimes need to have it
anyway, so if we always have it, the code generator becomes simpler. Currently
the code generator has logic for figuring out whether to have a local or not,
and then multiple code paths in multiple places handling the two alternatives.

Powered by Google App Engine
This is Rietveld 408576698