Changeset 153556 in webkit for trunk/Source/JavaScriptCore/runtime/PropertySlot.h
- Timestamp:
- Jul 31, 2013, 6:09:25 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r153532 r153556 50 50 } 51 51 52 explicit PropertySlot(const JSValue base) 53 : m_slotBase(base) 54 , m_propertyType(TypeUnset) 52 explicit PropertySlot(const JSValue thisValue) 53 : m_propertyType(TypeUnset) 55 54 , m_offset(invalidOffset) 55 , m_thisValue(thisValue) 56 56 { 57 57 } … … 60 60 typedef JSValue (*GetIndexValueFunc)(ExecState*, JSValue slotBase, unsigned); 61 61 62 JSValue getValue(ExecState* exec, PropertyName propertyName) const 63 { 64 if (m_propertyType == TypeValue) 65 return JSValue::decode(m_data.value); 66 if (m_propertyType == TypeCustomIndex) 67 return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index); 68 if (m_propertyType == TypeGetter) 69 return functionGetter(exec); 70 return m_data.custom.getValue(exec, slotBase(), propertyName); 71 } 72 73 JSValue getValue(ExecState* exec, unsigned propertyName) const 74 { 75 if (m_propertyType == TypeValue) 76 return JSValue::decode(m_data.value); 77 if (m_propertyType == TypeCustomIndex) 78 return m_data.customIndex.getIndexValue(exec, slotBase(), m_data.customIndex.index); 79 if (m_propertyType == TypeGetter) 80 return functionGetter(exec); 81 return m_data.custom.getValue(exec, slotBase(), Identifier::from(exec, propertyName)); 82 } 62 JSValue getValue(ExecState*, PropertyName) const; 63 JSValue getValue(ExecState*, unsigned propertyName) const; 83 64 84 65 bool isCacheable() const { return m_offset != invalidOffset; } … … 99 80 } 100 81 101 void setValue(JSValue slotBase, JSValue value) 82 JSObject* slotBase() const 83 { 84 ASSERT(m_propertyType != TypeUnset); 85 return m_slotBase; 86 } 87 88 void setValue(JSObject* slotBase, JSValue value) 102 89 { 103 90 ASSERT(value); … … 110 97 } 111 98 112 void setValue(JS ValueslotBase, JSValue value, PropertyOffset offset)99 void setValue(JSObject* slotBase, JSValue value, PropertyOffset offset) 113 100 { 114 101 ASSERT(value); … … 126 113 m_data.value = JSValue::encode(value); 127 114 128 m_slotBase = JSValue();115 m_slotBase = 0; 129 116 m_propertyType = TypeValue; 130 117 m_offset = invalidOffset; 131 118 } 132 119 133 void setCustom(JS ValueslotBase, GetValueFunc getValue)120 void setCustom(JSObject* slotBase, GetValueFunc getValue) 134 121 { 135 122 ASSERT(getValue); … … 142 129 } 143 130 144 void setCacheableCustom(JS ValueslotBase, GetValueFunc getValue)131 void setCacheableCustom(JSObject* slotBase, GetValueFunc getValue) 145 132 { 146 133 ASSERT(getValue); … … 153 140 } 154 141 155 void setCustomIndex(JS ValueslotBase, unsigned index, GetIndexValueFunc getIndexValue)142 void setCustomIndex(JSObject* slotBase, unsigned index, GetIndexValueFunc getIndexValue) 156 143 { 157 144 ASSERT(getIndexValue); … … 165 152 } 166 153 167 void setGetterSlot( GetterSetter* getterSetter)154 void setGetterSlot(JSObject* slotBase, GetterSetter* getterSetter) 168 155 { 169 156 ASSERT(getterSetter); 170 m_data.getter.thisValue = JSValue::encode(m_slotBase);171 157 m_data.getter.getterSetter = getterSetter; 172 158 159 ASSERT(slotBase); 160 m_slotBase = slotBase; 173 161 m_propertyType = TypeGetter; 174 162 m_offset = invalidOffset; 175 163 } 176 164 177 void setCacheableGetterSlot(JS ValueslotBase, GetterSetter* getterSetter, PropertyOffset offset)165 void setCacheableGetterSlot(JSObject* slotBase, GetterSetter* getterSetter, PropertyOffset offset) 178 166 { 179 167 ASSERT(getterSetter); 180 m_data.getter.thisValue = JSValue::encode(m_slotBase);181 168 m_data.getter.getterSetter = getterSetter; 182 169 … … 190 177 { 191 178 setValue(jsUndefined()); 192 }193 194 JSValue slotBase() const195 {196 return m_slotBase;197 179 } 198 180 … … 203 185 EncodedJSValue value; 204 186 struct { 205 EncodedJSValue thisValue;206 187 GetterSetter* getterSetter; 207 188 } getter; … … 215 196 } m_data; 216 197 217 JSValue m_slotBase;218 198 PropertyType m_propertyType; 219 199 PropertyOffset m_offset; 200 JSValue m_thisValue; 201 JSObject* m_slotBase; 220 202 }; 221 203
Note:
See TracChangeset
for help on using the changeset viewer.