summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa
diff options
context:
space:
mode:
authorshess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 19:56:43 +0000
committershess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-03 19:56:43 +0000
commitad3c0f1de336eef69795f1228101cd0486ec0a4c (patch)
tree5060d0c07423e4d7cfb5f412cce02bb3671a3b05 /chrome/browser/cocoa
parent69c666ec258237e6eed0be13e659900adebba1f5 (diff)
downloadchromium_src-ad3c0f1de336eef69795f1228101cd0486ec0a4c.zip
chromium_src-ad3c0f1de336eef69795f1228101cd0486ec0a4c.tar.gz
chromium_src-ad3c0f1de336eef69795f1228101cd0486ec0a4c.tar.bz2
[Mac] Tighten up objc zombie dealloc implementation.
Enabling the zombie code in release causes Perf(2) to regress. Reviewing |ZombieDealloc()|, I notice that object_setClass() is implemented with a memory barrier. The objc runtime doesn't use it in deallocation, so move to direct access. BUG=none TEST=none Review URL: http://codereview.chromium.org/2605004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48857 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r--chrome/browser/cocoa/objc_zombie.mm11
1 files changed, 8 insertions, 3 deletions
diff --git a/chrome/browser/cocoa/objc_zombie.mm b/chrome/browser/cocoa/objc_zombie.mm
index a9d9063..9a7c963 100644
--- a/chrome/browser/cocoa/objc_zombie.mm
+++ b/chrome/browser/cocoa/objc_zombie.mm
@@ -144,12 +144,17 @@ void ZombieDealloc(id self, SEL _cmd) {
memset(self, '!', size);
// If the instance is big enough, make it into a fat zombie and have
- // it remember the old isa. Otherwise make it a regular zombie.
+ // it remember the old |isa|. Otherwise make it a regular zombie.
+ // Setting |isa| rather than using |object_setClass()| because that
+ // function is implemented with a memory barrier. The runtime's
+ // |_internal_object_dispose()| (in objc-class.m) does this, so it
+ // should be safe (messaging free'd objects shouldn't be expected to
+ // be thread-safe in the first place).
if (size >= g_fatZombieSize) {
- object_setClass(self, g_fatZombieClass);
+ self->isa = g_fatZombieClass;
static_cast<CrFatZombie*>(self)->wasa = wasa;
} else {
- object_setClass(self, g_zombieClass);
+ self->isa = g_zombieClass;
}
// The new record to swap into |g_zombies|. If |g_zombieCount| is