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

Issue 2966633002: Revert of Make base::WeakPtr::Get() fast (Closed)

Created:
3 years, 5 months ago by hans
Modified:
3 years, 5 months ago
Reviewers:
Nico
CC:
chromium-reviews, danakj+watch_chromium.org, gavinp+memory_chromium.org, vmpstr+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Revert of Make base::WeakPtr::Get() fast (patchset #10 id:180001 of https://codereview.chromium.org/2963623002/ ) Reason for revert: This seems to have broken Cronet tests and Linux TSan. See bugs. Original issue's description: > Make base::WeakPtr::Get() fast > > It was previously calling WeakReference::is_valid() which was an out-of-line > method. That means code like > > if (my_weak_ptr) > my_weak_ptr->foo(); > > would do two calls to is_valid(), plus tests and branching. > > The is_valid() method showed up as one of the most frequently called non-inline > functions during browser start-up on Windows (about 1M calls). > > is_valid() was also inefficient because it had to do a null-pointer check on > flag_, as well as checking if the flag was marked valid. > > This patch removes the null-pointer check by using a sentinel object instead of > a nullptr. And instead of storing a bool in the flag, it stores a pointer-sized > bitmask 0 or ~0, so it can be AND'ed with the pointer value and conveniently > setting EFLAGS so that the code above just becomes a few loads, AND, branch, > and call. (The size of Flag is unchanged; it grows into the padding only.) > > This is expected to reduce the binary size by ~48KB on Android, and increase it > by 79KB on x64 Linux -- something that's paid for by the split-out refactorings > to WeakPtr and WeakPtrFactory. > > Exposing the SequenceChecker calls in inline functions caused the > MessageLoopTestType*.Nesting test to overflow on Win64 dcheck release builds, > which is why this patch also lowers the recursion depth there. > > BUG=728324 > > Review-Url: https://codereview.chromium.org/2963623002 > Cr-Commit-Position: refs/heads/master@{#483427} > Committed: https://chromium.googlesource.com/chromium/src/+/526f714c9ae172c3b16581b7e11eb035fd14274e TBR=thakis@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=728324, 738167, 738183, 738193 Review-Url: https://codereview.chromium.org/2966633002 Cr-Commit-Position: refs/heads/master@{#483509} Committed: https://chromium.googlesource.com/chromium/src/+/24046fd36c1a132243a7ffd279f59734f947d223

Patch Set 1 #

Patch Set 2 : resolve conflict #

Unified diffs Side-by-side diffs Delta from patch set Stats (+33 lines, -84 lines) Patch
M base/memory/weak_ptr.h View 1 4 chunks +6 lines, -54 lines 0 comments Download
M base/memory/weak_ptr.cc View 1 2 chunks +26 lines, -29 lines 0 comments Download
M base/message_loop/message_loop_test.cc View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 7 (4 generated)
hans
Created Revert of Make base::WeakPtr::Get() fast
3 years, 5 months ago (2017-06-29 22:02:48 UTC) #1
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2966633002/100001
3 years, 5 months ago (2017-06-29 22:07:28 UTC) #4
commit-bot: I haz the power
3 years, 5 months ago (2017-06-29 22:08:04 UTC) #7
Message was sent while issue was closed.
Committed patchset #2 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/24046fd36c1a132243a7ffd279f5...

Powered by Google App Engine
This is Rietveld 408576698