Changeset 55002 in webkit for trunk/JavaScriptCore/runtime
- Timestamp:
- Feb 18, 2010, 10:23:25 PM (15 years ago)
- Location:
- trunk/JavaScriptCore/runtime
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSObject.cpp
r53170 r55002 517 517 NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location) 518 518 { 519 if (JSObject* getterFunction = asGetterSetter(*location)->getter()) 520 slot.setGetterSlot(getterFunction); 521 else 519 if (JSObject* getterFunction = asGetterSetter(*location)->getter()) { 520 if (!structure()->isDictionary()) 521 slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location)); 522 else 523 slot.setGetterSlot(getterFunction); 524 } else 522 525 slot.setUndefined(); 523 526 } -
trunk/JavaScriptCore/runtime/PropertySlot.cpp
r47236 r55002 36 36 CallType callType = slot.m_data.getterFunc->getCallData(callData); 37 37 if (callType == CallTypeHost) 38 return callData.native.function(exec, slot.m_data.getterFunc, slot. slotBase(), exec->emptyList());38 return callData.native.function(exec, slot.m_data.getterFunc, slot.thisValue(), exec->emptyList()); 39 39 ASSERT(callType == CallTypeJS); 40 40 // FIXME: Can this be done more efficiently using the callData? 41 return asFunction(slot.m_data.getterFunc)->call(exec, slot. slotBase(), exec->emptyList());41 return asFunction(slot.m_data.getterFunc)->call(exec, slot.thisValue(), exec->emptyList()); 42 42 } 43 43 -
trunk/JavaScriptCore/runtime/PropertySlot.h
r46598 r55002 72 72 } 73 73 74 bool isCacheable() const { return m_offset != WTF::notFound; } 74 bool isGetter() const { return m_isGetter; } 75 bool isCacheable() const { return m_isCacheable; } 76 bool isCacheableValue() const { return m_isCacheable && !m_isGetter; } 75 77 size_t cachedOffset() const 76 78 { … … 103 105 m_data.valueSlot = valueSlot; 104 106 m_offset = offset; 107 m_isCacheable = true; 108 m_isGetter = false; 105 109 } 106 110 … … 140 144 m_data.index = index; 141 145 } 142 146 143 147 void setGetterSlot(JSObject* getterFunc) 148 { 149 ASSERT(getterFunc); 150 m_thisValue = m_slotBase; 151 m_getValue = functionGetter; 152 m_data.getterFunc = getterFunc; 153 m_isGetter = true; 154 } 155 156 void setCacheableGetterSlot(JSValue slotBase, JSObject* getterFunc, unsigned offset) 144 157 { 145 158 ASSERT(getterFunc); 146 159 m_getValue = functionGetter; 160 m_thisValue = m_slotBase; 161 m_slotBase = slotBase; 147 162 m_data.getterFunc = getterFunc; 148 } 149 163 m_offset = offset; 164 m_isCacheable = true; 165 m_isGetter = true; 166 } 167 150 168 void setUndefined() 151 169 { … … 183 201 // Clear offset even in release builds, in case this PropertySlot has been used before. 184 202 // (For other data members, we don't need to clear anything because reuse would meaningfully overwrite them.) 185 m_offset = WTF::notFound; 203 m_offset = 0; 204 m_isCacheable = false; 205 m_isGetter = false; 186 206 } 187 207 188 208 unsigned index() const { return m_data.index; } 189 209 210 JSValue thisValue() const { return m_thisValue; } 190 211 private: 191 212 static JSValue functionGetter(ExecState*, const Identifier&, const PropertySlot&); … … 202 223 203 224 JSValue m_value; 225 JSValue m_thisValue; 204 226 205 227 size_t m_offset; 228 bool m_isCacheable : 1; 229 bool m_isGetter : 1; 206 230 }; 207 231
Note:
See TracChangeset
for help on using the changeset viewer.