Changeset 92058 in webkit
- Timestamp:
- Jul 30, 2011 4:10:19 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r92050 r92058 1 2011-07-30 Oliver Hunt <oliver@apple.com> 2 3 Reduce the size of JSGlobalObject slightly 4 https://bugs.webkit.org/show_bug.cgi?id=65417 5 6 Reviewed by Dan Bernstein. 7 8 Push a few members that either aren't commonly used, 9 or aren't frequently accessed into a separate struct. 10 11 * runtime/JSGlobalObject.cpp: 12 (JSC::JSGlobalObject::init): 13 (JSC::JSGlobalObject::WeakMapsFinalizer::finalize): 14 * runtime/JSGlobalObject.h: 15 (JSC::JSGlobalObject::JSGlobalObjectRareData::JSGlobalObjectRareData): 16 (JSC::JSGlobalObject::createRareDataIfNeeded): 17 (JSC::JSGlobalObject::setProfileGroup): 18 (JSC::JSGlobalObject::profileGroup): 19 (JSC::JSGlobalObject::registerWeakMap): 20 (JSC::JSGlobalObject::deregisterWeakMap): 21 1 22 2011-07-30 Balazs Kelemen <kbalazs@webkit.org> 2 23 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r91194 r92058 131 131 m_debugger = 0; 132 132 133 m_profileGroup = 0;134 135 133 reset(prototype()); 136 134 } … … 428 426 { 429 427 JSGlobalObject* globalObject = asGlobalObject(handle.get()); 430 globalObject->m_ weakMaps.clear();428 globalObject->m_rareData.clear(); 431 429 } 432 430 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r91903 r92058 55 55 56 56 class JSGlobalObject : public JSVariableObject { 57 private: 58 typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet; 59 60 class WeakMapsFinalizer : public WeakHandleOwner { 61 public: 62 virtual void finalize(Handle<Unknown>, void* context); 63 }; 64 65 struct JSGlobalObjectRareData { 66 JSGlobalObjectRareData() 67 : profileGroup(0) 68 { 69 } 70 71 WeakMapSet weakMaps; 72 unsigned profileGroup; 73 Weak<JSGlobalObject> weakMapsFinalizer; 74 }; 75 57 76 protected: 58 typedef HashSet<RefPtr<OpaqueJSWeakObjectMap> > WeakMapSet;59 77 60 78 RefPtr<JSGlobalData> m_globalData; … … 105 123 WriteBarrier<Structure> m_internalFunctionStructure; 106 124 107 unsigned m_profileGroup;108 125 Debugger* m_debugger; 109 126 110 WeakMapSet m_weakMaps; 111 Weak<JSGlobalObject> m_weakMapsFinalizer; 112 class WeakMapsFinalizer : public WeakHandleOwner { 113 public: 114 virtual void finalize(Handle<Unknown>, void* context); 115 }; 127 OwnPtr<JSGlobalObjectRareData> m_rareData; 116 128 static WeakMapsFinalizer* weakMapsFinalizer(); 117 129 … … 122 134 bool m_evalEnabled; 123 135 136 void createRareDataIfNeeded() 137 { 138 if (!m_rareData) 139 m_rareData = adoptPtr(new JSGlobalObjectRareData); 140 } 141 124 142 public: 125 143 static JSGlobalObject* create(JSGlobalData& globalData, Structure* structure) … … 218 236 Structure* stringObjectStructure() const { return m_stringObjectStructure.get(); } 219 237 220 void setProfileGroup(unsigned value) { m_profileGroup = value; } 221 unsigned profileGroup() const { return m_profileGroup; } 238 void setProfileGroup(unsigned value) { createRareDataIfNeeded(); m_rareData->profileGroup = value; } 239 unsigned profileGroup() const 240 { 241 if (!m_rareData) 242 return 0; 243 return m_rareData->profileGroup; 244 } 222 245 223 246 Debugger* debugger() const { return m_debugger; } … … 255 278 void registerWeakMap(OpaqueJSWeakObjectMap* map) 256 279 { 257 if (!m_weakMapsFinalizer) 258 m_weakMapsFinalizer.set(globalData(), this, weakMapsFinalizer()); 259 m_weakMaps.add(map); 280 createRareDataIfNeeded(); 281 if (!m_rareData->weakMapsFinalizer) 282 m_rareData->weakMapsFinalizer.set(globalData(), this, weakMapsFinalizer()); 283 m_rareData->weakMaps.add(map); 260 284 } 261 285 262 286 void deregisterWeakMap(OpaqueJSWeakObjectMap* map) 263 287 { 264 m_weakMaps.remove(map); 288 if (m_rareData) 289 m_rareData->weakMaps.remove(map); 265 290 } 266 291
Note: See TracChangeset
for help on using the changeset viewer.