Changeset 154113 in webkit for trunk/Source/JavaScriptCore
- Timestamp:
- Aug 15, 2013, 11:49:05 AM (12 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSCallbackObjectFunctions.h
r154038 r154113 152 152 if (exception) { 153 153 throwError(exec, toJS(exec, exception)); 154 slot.setValue( jsUndefined());154 slot.setValue(thisObject, jsUndefined()); 155 155 return true; 156 156 } 157 157 if (value) { 158 slot.setValue(t oJS(exec, value));158 slot.setValue(thisObject, toJS(exec, value)); 159 159 return true; 160 160 } … … 165 165 JSValue value = thisObject->getStaticValue(exec, propertyName); 166 166 if (value) { 167 slot.setValue( value);167 slot.setValue(thisObject, value); 168 168 return true; 169 169 } -
trunk/Source/JavaScriptCore/ChangeLog
r154108 r154113 1 2013-08-15 Gavin Barraclough <[email protected]> 2 3 https://bugs.webkit.org/show_bug.cgi?id=119843 4 PropertySlot::setValue is ambiguous 5 6 Reviewed by Geoff Garen. 7 8 There are three different versions of PropertySlot::setValue, one for cacheable properties, and two that are used interchangeably and inconsistently. 9 The problematic variants are the ones that just take a value, and one that takes a value and also the object containing the property. 10 Unify on always providing the object, and remove the version that just takes a value. 11 This always works except for JSString, where we optimize out the object (logically we should be instantiating a temporary StringObject on every property access). 12 Provide a version of setValue that takes a JSString as the owner of the property. 13 We won't store this, but it makes it clear that this interface should only be used from JSString. 14 15 * API/JSCallbackObjectFunctions.h: 16 (JSC::::getOwnPropertySlot): 17 * JSCTypedArrayStubs.h: 18 * runtime/Arguments.cpp: 19 (JSC::Arguments::getOwnPropertySlotByIndex): 20 (JSC::Arguments::getOwnPropertySlot): 21 * runtime/JSActivation.cpp: 22 (JSC::JSActivation::symbolTableGet): 23 (JSC::JSActivation::getOwnPropertySlot): 24 * runtime/JSArray.cpp: 25 (JSC::JSArray::getOwnPropertySlot): 26 * runtime/JSObject.cpp: 27 (JSC::JSObject::getOwnPropertySlotByIndex): 28 * runtime/JSString.h: 29 (JSC::JSString::getStringPropertySlot): 30 * runtime/JSSymbolTableObject.h: 31 (JSC::symbolTableGet): 32 * runtime/SparseArrayValueMap.cpp: 33 (JSC::SparseArrayEntry::get): 34 - Pass object containing property to PropertySlot::setValue 35 * runtime/PropertySlot.h: 36 (JSC::PropertySlot::setValue): 37 - Logically, the base of a string property access is a temporary StringObject, but we optimize that away. 38 (JSC::PropertySlot::setUndefined): 39 - removed setValue(JSValue), added setValue(JSString*, JSValue) 40 1 41 2013-08-15 Oliver Hunt <[email protected]> 2 42 -
trunk/Source/JavaScriptCore/JSCTypedArrayStubs.h
r154038 r154113 108 108 if (index < thisObject->m_storageLength) {\ 109 109 ASSERT(index != PropertyName::NotAnIndex);\ 110 slot.setValue(thisObject ->getByIndex(exec, index));\110 slot.setValue(thisObject, thisObject->getByIndex(exec, index));\ 111 111 return true;\ 112 112 }\ … … 132 132 ASSERT_GC_OBJECT_INHERITS(thisObject, info());\ 133 133 if (propertyName < thisObject->m_storageLength) {\ 134 slot.setValue(thisObject ->getByIndex(exec, propertyName));\134 slot.setValue(thisObject, thisObject->getByIndex(exec, propertyName));\ 135 135 return true;\ 136 136 }\ -
trunk/Source/JavaScriptCore/runtime/Arguments.cpp
r154038 r154113 95 95 Arguments* thisObject = jsCast<Arguments*>(object); 96 96 if (JSValue value = thisObject->tryGetArgument(i)) { 97 slot.setValue( value);97 slot.setValue(thisObject, value); 98 98 return true; 99 99 } … … 130 130 if (JSValue value = thisObject->tryGetArgument(i)) { 131 131 RELEASE_ASSERT(i < PropertyName::NotAnIndex); 132 slot.setValue( value);132 slot.setValue(thisObject, value); 133 133 return true; 134 134 } 135 135 136 136 if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->m_overrodeLength)) { 137 slot.setValue( jsNumber(thisObject->m_numArguments));137 slot.setValue(thisObject, jsNumber(thisObject->m_numArguments)); 138 138 return true; 139 139 } … … 141 141 if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->m_overrodeCallee)) { 142 142 if (!thisObject->m_isStrictMode) { 143 slot.setValue(thisObject ->m_callee.get());143 slot.setValue(thisObject, thisObject->m_callee.get()); 144 144 return true; 145 145 } -
trunk/Source/JavaScriptCore/runtime/JSActivation.cpp
r154038 r154113 67 67 return false; 68 68 69 slot.setValue( registerAt(entry.getIndex()).get());69 slot.setValue(this, registerAt(entry.getIndex()).get()); 70 70 return true; 71 71 } … … 167 167 168 168 if (JSValue value = thisObject->getDirect(exec->vm(), propertyName)) { 169 slot.setValue( value);169 slot.setValue(thisObject, value); 170 170 return true; 171 171 } -
trunk/Source/JavaScriptCore/runtime/JSArray.cpp
r153532 r154113 182 182 JSArray* thisObject = jsCast<JSArray*>(object); 183 183 if (propertyName == exec->propertyNames().length) { 184 slot.setValue( jsNumber(thisObject->length()));184 slot.setValue(thisObject, jsNumber(thisObject->length())); 185 185 return true; 186 186 } -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r154038 r154113 290 290 JSValue value = butterfly->contiguous()[i].get(); 291 291 if (value) { 292 slot.setValue( value);292 slot.setValue(thisObject, value); 293 293 return true; 294 294 } … … 304 304 double value = butterfly->contiguousDouble()[i]; 305 305 if (value == value) { 306 slot.setValue( JSValue(JSValue::EncodeAsDouble, value));306 slot.setValue(thisObject, JSValue(JSValue::EncodeAsDouble, value)); 307 307 return true; 308 308 } … … 319 319 JSValue value = storage->m_vector[i].get(); 320 320 if (value) { 321 slot.setValue( value);321 slot.setValue(thisObject, value); 322 322 return true; 323 323 } -
trunk/Source/JavaScriptCore/runtime/JSString.h
r154038 r154113 474 474 { 475 475 if (propertyName == exec->propertyNames().length) { 476 slot.setValue( jsNumber(m_length));476 slot.setValue(this, jsNumber(m_length)); 477 477 return true; 478 478 } … … 481 481 if (i < m_length) { 482 482 ASSERT(i != PropertyName::NotAnIndex); // No need for an explicit check, the above test would always fail! 483 slot.setValue( getIndex(exec, i));483 slot.setValue(this, getIndex(exec, i)); 484 484 return true; 485 485 } … … 491 491 { 492 492 if (propertyName < m_length) { 493 slot.setValue( getIndex(exec, propertyName));493 slot.setValue(this, getIndex(exec, propertyName)); 494 494 return true; 495 495 } -
trunk/Source/JavaScriptCore/runtime/JSSymbolTableObject.h
r153170 r154113 80 80 SymbolTableEntry::Fast entry = iter->value; 81 81 ASSERT(!entry.isNull()); 82 slot.setValue(object ->registerAt(entry.getIndex()).get());82 slot.setValue(object, object->registerAt(entry.getIndex()).get()); 83 83 return true; 84 84 } … … 112 112 SymbolTableEntry::Fast entry = iter->value; 113 113 ASSERT(!entry.isNull()); 114 slot.setValue(object ->registerAt(entry.getIndex()).get());114 slot.setValue(object, object->registerAt(entry.getIndex()).get()); 115 115 slotIsWriteable = !entry.isReadOnly(); 116 116 return true; -
trunk/Source/JavaScriptCore/runtime/PropertySlot.h
r153673 r154113 102 102 } 103 103 104 void setValue(JS Value value)104 void setValue(JSString*, JSValue value) 105 105 { 106 106 ASSERT(value); … … 170 170 void setUndefined() 171 171 { 172 setValue(jsUndefined()); 172 m_data.value = JSValue::encode(jsUndefined()); 173 174 m_slotBase = 0; 175 m_propertyType = TypeValue; 176 m_offset = invalidOffset; 173 177 } 174 178 -
trunk/Source/JavaScriptCore/runtime/SparseArrayValueMap.cpp
r154038 r154113 129 129 130 130 if (LIKELY(!value.isGetterSetter())) { 131 slot.setValue( value);131 slot.setValue(thisObject, value); 132 132 return; 133 133 }
Note:
See TracChangeset
for help on using the changeset viewer.