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

Issue 11078014: Fix move.h's to use a concrete RValue carrier object rather than hacking a RValue&. (Closed)

Created:
8 years, 2 months ago by awong
Modified:
8 years, 2 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org, gavinp+memory_chromium.org
Visibility:
Public.

Description

Fix move.h's to use a concrete RValue carrier object rather than hacking a RValue&. For move semantics, we need to create a private "RValue" type that is used to create move constructors and move operators. Previously, we emulated Boost's idea of making the RValue type a subclass of the move-only type that doesn't add any new member fields. We then just reinterpret_cast "this" into a RValue& depending on the fact that RValue is just a type pun for the move-only type. This ends up being undefined behavior though (C++98 5.2.10.7). This change makes use a concrete RValue class that contains a pointer to the move-only type. With -O2 on clang version 3.2 (trunk 163674), this yields identical assembly code to the previous implementation. With -O0, we generate 2 more instructions to allocate and initialize the temporary RValue struct's object field when calling Pass(). This should be acceptable. The snowman says so ☃. BUG=155436 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=161945

Patch Set 1 #

Patch Set 2 : comment fixes #

Patch Set 3 : fix #

Patch Set 4 : adding ☃. #

Total comments: 2

Patch Set 5 : fix error. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+51 lines, -66 lines) Patch
M base/memory/scoped_ptr.h View 1 7 chunks +13 lines, -22 lines 0 comments Download
M base/memory/scoped_vector.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M base/move.h View 1 2 3 5 chunks +30 lines, -34 lines 0 comments Download
M base/win/scoped_handle.h View 1 2 3 4 2 chunks +5 lines, -5 lines 0 comments Download
M chrome/browser/usb/usb_service.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M media/mp4/mp4_stream_parser_unittest.cc View 1 1 chunk +0 lines, -1 line 0 comments Download

Messages

Total messages: 10 (0 generated)
awong
merry xmas! ☃☃☃☃
8 years, 2 months ago (2012-10-12 00:40:18 UTC) #1
Jeffrey Yasskin
lgtm https://codereview.chromium.org/11078014/diff/9001/base/win/scoped_handle.h File base/win/scoped_handle.h (right): https://codereview.chromium.org/11078014/diff/9001/base/win/scoped_handle.h#newcode53 base/win/scoped_handle.h:53: if (this != other.object) { I think this ...
8 years, 2 months ago (2012-10-12 20:34:47 UTC) #2
awong
+willchan for owners. https://codereview.chromium.org/11078014/diff/9001/base/win/scoped_handle.h File base/win/scoped_handle.h (right): https://codereview.chromium.org/11078014/diff/9001/base/win/scoped_handle.h#newcode53 base/win/scoped_handle.h:53: if (this != other.object) { On ...
8 years, 2 months ago (2012-10-12 20:44:12 UTC) #3
willchan no longer on Chromium
lgtm
8 years, 2 months ago (2012-10-12 20:46:31 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/11078014/12001
8 years, 2 months ago (2012-10-12 20:48:33 UTC) #5
commit-bot: I haz the power
Presubmit check for 11078014-12001 failed and returned exit status 1. Running presubmit commit checks ...
8 years, 2 months ago (2012-10-12 20:48:40 UTC) #6
awong
gdk: chrome/browser/usb OWNERS rubber stamp please?
8 years, 2 months ago (2012-10-12 23:49:52 UTC) #7
Garret Kelly
lgtm
8 years, 2 months ago (2012-10-15 14:24:19 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ajwong@chromium.org/11078014/12001
8 years, 2 months ago (2012-10-15 18:17:40 UTC) #9
commit-bot: I haz the power
8 years, 2 months ago (2012-10-15 20:36:06 UTC) #10
Change committed as 161945

Powered by Google App Engine
This is Rietveld 408576698