Changeset 161033 in webkit
- Timestamp:
- Dec 23, 2013, 4:11:25 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/API/JSObjectRef.cpp
r159531 r161033 332 332 jsObject->methodTable()->defineOwnProperty(jsObject, exec, name, desc, false); 333 333 } else { 334 PutPropertySlot slot ;334 PutPropertySlot slot(jsObject); 335 335 jsObject->methodTable()->put(jsObject, exec, name, jsValue, slot); 336 336 } -
trunk/Source/JavaScriptCore/ChangeLog
r161031 r161033 1 2013-12-23 Oliver Hunt <[email protected]> 2 3 Refactor PutPropertySlot to be aware of custom properties 4 https://bugs.webkit.org/show_bug.cgi?id=126187 5 6 Reviewed by msaboff. 7 8 Refactor PutPropertySlot, making the constructor take the thisValue 9 used as a target. This results in a wide range of boilerplate changes 10 to pass the new parameter. 11 12 * API/JSObjectRef.cpp: 13 (JSObjectSetProperty): 14 * dfg/DFGOperations.cpp: 15 (JSC::DFG::operationPutByValInternal): 16 * interpreter/Interpreter.cpp: 17 (JSC::Interpreter::execute): 18 * jit/JITOperations.cpp: 19 * llint/LLIntSlowPaths.cpp: 20 (JSC::LLInt::LLINT_SLOW_PATH_DECL): 21 * runtime/Arguments.cpp: 22 (JSC::Arguments::putByIndex): 23 * runtime/ArrayPrototype.cpp: 24 (JSC::putProperty): 25 (JSC::arrayProtoFuncPush): 26 * runtime/JSCJSValue.cpp: 27 (JSC::JSValue::putToPrimitiveByIndex): 28 * runtime/JSCell.cpp: 29 (JSC::JSCell::putByIndex): 30 * runtime/JSFunction.cpp: 31 (JSC::JSFunction::put): 32 * runtime/JSGenericTypedArrayViewInlines.h: 33 (JSC::JSGenericTypedArrayView<Adaptor>::putByIndex): 34 * runtime/JSONObject.cpp: 35 (JSC::Walker::walk): 36 * runtime/JSObject.cpp: 37 (JSC::JSObject::putByIndex): 38 (JSC::JSObject::putDirectNonIndexAccessor): 39 (JSC::JSObject::deleteProperty): 40 * runtime/JSObject.h: 41 (JSC::JSObject::putDirect): 42 * runtime/Lookup.h: 43 (JSC::putEntry): 44 (JSC::lookupPut): 45 * runtime/PutPropertySlot.h: 46 (JSC::PutPropertySlot::PutPropertySlot): 47 (JSC::PutPropertySlot::setCustomProperty): 48 (JSC::PutPropertySlot::thisValue): 49 (JSC::PutPropertySlot::isCacheable): 50 1 51 2013-12-23 Benjamin Poulain <[email protected]> 2 52 -
trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp
r159798 r161033 111 111 112 112 if (isName(property)) { 113 PutPropertySlot slot( strict);113 PutPropertySlot slot(baseValue, strict); 114 114 if (direct) { 115 115 RELEASE_ASSERT(baseValue.isObject()); … … 123 123 Identifier ident(exec, property.toString(exec)->value(exec)); 124 124 if (!vm->exception()) { 125 PutPropertySlot slot( strict);125 PutPropertySlot slot(baseValue, strict); 126 126 if (direct) { 127 127 RELEASE_ASSERT(baseValue.isObject()); … … 400 400 } 401 401 402 PutPropertySlot slot( true);402 PutPropertySlot slot(array, true); 403 403 array->methodTable()->put( 404 404 array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); … … 415 415 } 416 416 417 PutPropertySlot slot( false);417 PutPropertySlot slot(array, false); 418 418 array->methodTable()->put( 419 419 array, exec, Identifier::from(exec, index), JSValue::decode(encodedValue), slot); … … 432 432 } 433 433 434 PutPropertySlot slot( true);434 PutPropertySlot slot(array, true); 435 435 array->methodTable()->put( 436 436 array, exec, Identifier::from(exec, index), jsValue, slot); … … 449 449 } 450 450 451 PutPropertySlot slot( false);451 PutPropertySlot slot(array, false); 452 452 array->methodTable()->put( 453 453 array, exec, Identifier::from(exec, index), jsValue, slot); … … 495 495 } 496 496 497 PutPropertySlot slot( true);497 PutPropertySlot slot(array, true); 498 498 array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot); 499 499 } … … 509 509 } 510 510 511 PutPropertySlot slot( false);511 PutPropertySlot slot(array, false); 512 512 array->putDirect(exec->vm(), Identifier::from(exec, index), JSValue::decode(encodedValue), slot); 513 513 } -
trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp
r160244 r161033 799 799 if (JSONPPath.size() == 1 && JSONPPath[0].m_type == JSONPPathEntryTypeDeclare) { 800 800 globalObject->addVar(callFrame, JSONPPath[0].m_pathEntryName); 801 PutPropertySlot slot ;801 PutPropertySlot slot(globalObject); 802 802 globalObject->methodTable()->put(globalObject, callFrame, JSONPPath[0].m_pathEntryName, JSONPValue, slot); 803 803 result = jsUndefined(); … … 834 834 } 835 835 } 836 PutPropertySlot slot ;836 PutPropertySlot slot(baseObject); 837 837 switch (JSONPPath.last().m_type) { 838 838 case JSONPPathEntryTypeCall: { … … 1163 1163 const Identifier& ident = codeBlock->variable(i); 1164 1164 if (!variableObject->hasProperty(callFrame, ident)) { 1165 PutPropertySlot slot ;1165 PutPropertySlot slot(variableObject); 1166 1166 variableObject->methodTable()->put(variableObject, callFrame, ident, jsUndefined(), slot); 1167 1167 } … … 1170 1170 for (int i = 0; i < numFunctions; ++i) { 1171 1171 FunctionExecutable* function = codeBlock->functionDecl(i); 1172 PutPropertySlot slot ;1172 PutPropertySlot slot(variableObject); 1173 1173 variableObject->methodTable()->put(variableObject, callFrame, function->name(), JSFunction::create(vm, function, scope), slot); 1174 1174 } -
trunk/Source/JavaScriptCore/jit/JITOperations.cpp
r160796 r161033 240 240 241 241 Identifier ident(vm, uid); 242 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());242 PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext()); 243 243 JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); 244 244 } … … 250 250 251 251 Identifier ident(vm, uid); 252 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());252 PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext()); 253 253 JSValue::decode(encodedBase).put(exec, ident, JSValue::decode(encodedValue), slot); 254 254 } … … 260 260 261 261 Identifier ident(vm, uid); 262 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());262 PutPropertySlot slot(JSValue::decode(encodedBase), true, exec->codeBlock()->putByIdContext()); 263 263 asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 264 264 } … … 270 270 271 271 Identifier ident(vm, uid); 272 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());272 PutPropertySlot slot(JSValue::decode(encodedBase), false, exec->codeBlock()->putByIdContext()); 273 273 asObject(JSValue::decode(encodedBase))->putDirect(exec->vm(), ident, JSValue::decode(encodedValue), slot); 274 274 } … … 284 284 JSValue value = JSValue::decode(encodedValue); 285 285 JSValue baseValue = JSValue::decode(encodedBase); 286 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());286 PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext()); 287 287 288 288 baseValue.put(exec, ident, value, slot); … … 307 307 JSValue value = JSValue::decode(encodedValue); 308 308 JSValue baseValue = JSValue::decode(encodedBase); 309 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());309 PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext()); 310 310 311 311 baseValue.put(exec, ident, value, slot); … … 330 330 JSValue value = JSValue::decode(encodedValue); 331 331 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 332 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());332 PutPropertySlot slot(baseObject, true, exec->codeBlock()->putByIdContext()); 333 333 334 334 baseObject->putDirect(exec->vm(), ident, value, slot); … … 353 353 JSValue value = JSValue::decode(encodedValue); 354 354 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 355 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());355 PutPropertySlot slot(baseObject, false, exec->codeBlock()->putByIdContext()); 356 356 357 357 baseObject->putDirect(exec->vm(), ident, value, slot); … … 376 376 JSValue value = JSValue::decode(encodedValue); 377 377 JSValue baseValue = JSValue::decode(encodedBase); 378 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());378 PutPropertySlot slot(baseValue, true, exec->codeBlock()->putByIdContext()); 379 379 380 380 baseValue.put(exec, ident, value, slot); … … 396 396 JSValue value = JSValue::decode(encodedValue); 397 397 JSValue baseValue = JSValue::decode(encodedBase); 398 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());398 PutPropertySlot slot(baseValue, false, exec->codeBlock()->putByIdContext()); 399 399 400 400 baseValue.put(exec, ident, value, slot); … … 416 416 JSValue value = JSValue::decode(encodedValue); 417 417 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 418 PutPropertySlot slot( true, exec->codeBlock()->putByIdContext());418 PutPropertySlot slot(baseObject, true, exec->codeBlock()->putByIdContext()); 419 419 420 420 baseObject->putDirect(exec->vm(), ident, value, slot); … … 436 436 JSValue value = JSValue::decode(encodedValue); 437 437 JSObject* baseObject = asObject(JSValue::decode(encodedBase)); 438 PutPropertySlot slot( false, exec->codeBlock()->putByIdContext());438 PutPropertySlot slot(baseObject, false, exec->codeBlock()->putByIdContext()); 439 439 440 440 baseObject ->putDirect(exec->vm(), ident, value, slot); … … 470 470 baseValue.putByIndex(callFrame, i, value, callFrame->codeBlock()->isStrictMode()); 471 471 } else if (isName(subscript)) { 472 PutPropertySlot slot( callFrame->codeBlock()->isStrictMode());472 PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode()); 473 473 baseValue.put(callFrame, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 474 474 } else { 475 475 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); 476 476 if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. 477 PutPropertySlot slot( callFrame->codeBlock()->isStrictMode());477 PutPropertySlot slot(baseValue, callFrame->codeBlock()->isStrictMode()); 478 478 baseValue.put(callFrame, property, value, slot); 479 479 } … … 487 487 baseObject->putDirectIndex(callFrame, i, value); 488 488 } else if (isName(subscript)) { 489 PutPropertySlot slot( callFrame->codeBlock()->isStrictMode());489 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode()); 490 490 baseObject->putDirect(callFrame->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 491 491 } else { 492 492 Identifier property(callFrame, subscript.toString(callFrame)->value(callFrame)); 493 493 if (!callFrame->vm().exception()) { // Don't put to an object if toString threw an exception. 494 PutPropertySlot slot( callFrame->codeBlock()->isStrictMode());494 PutPropertySlot slot(baseObject, callFrame->codeBlock()->isStrictMode()); 495 495 baseObject->putDirect(callFrame->vm(), property, value, slot); 496 496 } … … 1669 1669 } 1670 1670 1671 PutPropertySlot slot( codeBlock->isStrictMode());1671 PutPropertySlot slot(scope, codeBlock->isStrictMode()); 1672 1672 scope->methodTable()->put(scope, exec, ident, value, slot); 1673 1673 -
trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
r160244 r161033 579 579 580 580 JSValue baseValue = LLINT_OP_C(1).jsValue(); 581 PutPropertySlot slot( codeBlock->isStrictMode(), codeBlock->putByIdContext());581 PutPropertySlot slot(baseValue, codeBlock->isStrictMode(), codeBlock->putByIdContext()); 582 582 if (pc[8].u.operand) 583 583 asObject(baseValue)->putDirect(vm, ident, LLINT_OP_C(3).jsValue(), slot); … … 735 735 736 736 if (isName(subscript)) { 737 PutPropertySlot slot( exec->codeBlock()->isStrictMode());737 PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode()); 738 738 baseValue.put(exec, jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 739 739 LLINT_END(); … … 742 742 Identifier property(exec, subscript.toString(exec)->value(exec)); 743 743 LLINT_CHECK_EXCEPTION(); 744 PutPropertySlot slot( exec->codeBlock()->isStrictMode());744 PutPropertySlot slot(baseValue, exec->codeBlock()->isStrictMode()); 745 745 baseValue.put(exec, property, value, slot); 746 746 LLINT_END(); … … 760 760 baseObject->putDirectIndex(exec, i, value); 761 761 } else if (isName(subscript)) { 762 PutPropertySlot slot( exec->codeBlock()->isStrictMode());762 PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode()); 763 763 baseObject->putDirect(exec->vm(), jsCast<NameInstance*>(subscript.asCell())->privateName(), value, slot); 764 764 } else { 765 765 Identifier property(exec, subscript.toString(exec)->value(exec)); 766 766 if (!exec->vm().exception()) { // Don't put to an object if toString threw an exception. 767 PutPropertySlot slot( exec->codeBlock()->isStrictMode());767 PutPropertySlot slot(baseObject, exec->codeBlock()->isStrictMode()); 768 768 baseObject->putDirect(exec->vm(), property, value, slot); 769 769 } … … 1369 1369 LLINT_THROW(createUndefinedVariableError(exec, ident)); 1370 1370 1371 PutPropertySlot slot( codeBlock->isStrictMode());1371 PutPropertySlot slot(scope, codeBlock->isStrictMode()); 1372 1372 scope->methodTable()->put(scope, exec, ident, value, slot); 1373 1373 -
trunk/Source/JavaScriptCore/runtime/Arguments.cpp
r158793 r161033 188 188 return; 189 189 190 PutPropertySlot slot( shouldThrow);190 PutPropertySlot slot(thisObject, shouldThrow); 191 191 JSObject::put(thisObject, exec, Identifier::from(exec, i), value, slot); 192 192 } -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r159063 r161033 161 161 static void putProperty(ExecState* exec, JSObject* obj, PropertyName propertyName, JSValue value) 162 162 { 163 PutPropertySlot slot ;163 PutPropertySlot slot(obj); 164 164 obj->methodTable()->put(obj, exec, propertyName, value, slot); 165 165 } … … 502 502 thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->uncheckedArgument(n), true); 503 503 else { 504 PutPropertySlot slot ;504 PutPropertySlot slot(thisObj); 505 505 Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec)); 506 506 thisObj->methodTable()->put(thisObj, exec, propertyName, exec->uncheckedArgument(n), slot); -
trunk/Source/JavaScriptCore/runtime/JSCJSValue.cpp
r157082 r161033 173 173 { 174 174 if (propertyName > MAX_ARRAY_INDEX) { 175 PutPropertySlot slot( shouldThrow);175 PutPropertySlot slot(*this, shouldThrow); 176 176 putToPrimitive(exec, Identifier::from(exec, propertyName), value, slot); 177 177 return; -
trunk/Source/JavaScriptCore/runtime/JSCell.cpp
r155143 r161033 97 97 { 98 98 if (cell->isString()) { 99 PutPropertySlot slot( shouldThrow);99 PutPropertySlot slot(cell, shouldThrow); 100 100 JSValue(cell).putToPrimitive(exec, Identifier::from(exec, identifier), value, slot); 101 101 return; -
trunk/Source/JavaScriptCore/runtime/JSFunction.cpp
r160208 r161033 390 390 thisObject->m_allocationProfileWatchpoint.fireAll(); 391 391 // Don't allow this to be cached, since a [[Put]] must clear m_allocationProfile. 392 PutPropertySlot dontCache ;392 PutPropertySlot dontCache(thisObject); 393 393 Base::put(thisObject, exec, propertyName, value, dontCache); 394 394 return; -
trunk/Source/JavaScriptCore/runtime/JSGenericTypedArrayViewInlines.h
r158583 r161033 384 384 385 385 if (propertyName > MAX_ARRAY_INDEX) { 386 PutPropertySlot slot( shouldThrow);386 PutPropertySlot slot(JSValue(thisObject), shouldThrow); 387 387 thisObject->methodTable()->put( 388 388 thisObject, exec, Identifier::from(exec, propertyName), value, slot); -
trunk/Source/JavaScriptCore/runtime/JSONObject.cpp
r157614 r161033 747 747 JSObject* object = objectStack.peek(); 748 748 Identifier prop = propertyStack.last()[indexStack.last()]; 749 PutPropertySlot slot ;749 PutPropertySlot slot(object); 750 750 JSValue filteredValue = callReviver(object, jsString(m_exec, prop.string()), outValue); 751 751 if (filteredValue.isUndefined()) … … 776 776 } 777 777 JSObject* finalHolder = constructEmptyObject(m_exec); 778 PutPropertySlot slot ;778 PutPropertySlot slot(finalHolder); 779 779 finalHolder->methodTable()->put(finalHolder, m_exec, m_exec->vm().propertyNames->emptyIdentifier, outValue, slot); 780 780 return callReviver(finalHolder, jsEmptyString(m_exec), outValue); -
trunk/Source/JavaScriptCore/runtime/JSObject.cpp
r160347 r161033 412 412 413 413 if (propertyName > MAX_ARRAY_INDEX) { 414 PutPropertySlot slot( shouldThrow);414 PutPropertySlot slot(cell, shouldThrow); 415 415 thisObject->methodTable()->put(thisObject, exec, Identifier::from(exec, propertyName), value, slot); 416 416 return; … … 1216 1216 void JSObject::putDirectNonIndexAccessor(VM& vm, PropertyName propertyName, JSValue value, unsigned attributes) 1217 1217 { 1218 PutPropertySlot slot ;1218 PutPropertySlot slot(this); 1219 1219 putDirectInternal<PutModeDefineOwnProperty>(vm, propertyName, value, attributes, slot, getCallableObject(value)); 1220 1220 … … 1270 1270 return false; // this builtin property can't be deleted 1271 1271 1272 putEntry(exec, entry, propertyName, jsUndefined(), thisObject); 1272 PutPropertySlot slot(thisObject); 1273 putEntry(exec, entry, propertyName, jsUndefined(), slot); 1273 1274 } 1274 1275 -
trunk/Source/JavaScriptCore/runtime/JSObject.h
r160347 r161033 1423 1423 { 1424 1424 ASSERT(!value.isGetterSetter() && !(attributes & Accessor)); 1425 PutPropertySlot slot ;1425 PutPropertySlot slot(this); 1426 1426 putDirectInternal<PutModeDefineOwnProperty>(vm, propertyName, value, attributes, slot, getCallableObject(value)); 1427 1427 } -
trunk/Source/JavaScriptCore/runtime/Lookup.h
r161009 r161033 27 27 #include "JSGlobalObject.h" 28 28 #include "PropertySlot.h" 29 #include "PutPropertySlot.h" 29 30 #include <wtf/Assertions.h> 30 31 … … 42 43 // ie. typedef JSValue (*GetFunction)(ExecState*, JSObject* baseObject) 43 44 typedef PropertySlot::GetValueFunc GetFunction; 44 typedef void (*PutFunction)(ExecState*, EncodedJSValue base, EncodedJSValue value);45 typedef PutPropertySlot::PutValueFunc PutFunction; 45 46 46 47 class HashEntry { … … 291 292 } 292 293 293 template <class ThisImp> 294 inline void putEntry(ExecState* exec, const HashEntry* entry, PropertyName propertyName, JSValue value, ThisImp* thisObj, bool shouldThrow = false) 294 inline void putEntry(ExecState* exec, const HashEntry* entry, PropertyName propertyName, JSValue value, PutPropertySlot& slot) 295 295 { 296 296 // If this is a function put it as an override property. 297 297 if (entry->attributes() & Function) 298 thisObj->putDirect(exec->vm(), propertyName, value); 299 else if (!(entry->attributes() & ReadOnly)) 300 entry->propertyPutter()(exec, JSValue::encode(thisObj), JSValue::encode(value)); 301 else if (shouldThrow) 298 slot.base()->putDirect(exec->vm(), propertyName, value); 299 else if (!(entry->attributes() & ReadOnly)) { 300 entry->propertyPutter()(exec, JSValue::encode(slot.thisValue()), JSValue::encode(value)); 301 slot.setCustomProperty(slot.base(), entry->propertyPutter()); 302 } else if (slot.isStrictMode()) 302 303 throwTypeError(exec, StrictModeReadonlyPropertyWriteError); 303 304 } … … 308 309 * is found it sets the value and returns true, else it returns false. 309 310 */ 310 template <class ThisImp> 311 inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, ThisImp* thisObj, bool shouldThrow = false) 311 inline bool lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, PutPropertySlot& slot) 312 312 { 313 313 const HashEntry* entry = table.entry(exec, propertyName); … … 316 316 return false; 317 317 318 putEntry <ThisImp>(exec, entry, propertyName, value, thisObj, shouldThrow);318 putEntry(exec, entry, propertyName, value, slot); 319 319 return true; 320 320 } … … 329 329 inline void lookupPut(ExecState* exec, PropertyName propertyName, JSValue value, const HashTable& table, ThisImp* thisObj, PutPropertySlot& slot) 330 330 { 331 if (!lookupPut <ThisImp>(exec, propertyName, value, table, thisObj, slot.isStrictMode()))331 if (!lookupPut(exec, propertyName, value, table, slot)) 332 332 ParentImp::put(thisObj, exec, propertyName, value, slot); // not found: forward to parent 333 333 } -
trunk/Source/JavaScriptCore/runtime/PutPropertySlot.h
r154199 r161033 28 28 #define PutPropertySlot_h 29 29 30 #include "JSCJSValue.h" 31 30 32 #include <wtf/Assertions.h> 31 33 … … 37 39 class PutPropertySlot { 38 40 public: 39 enum Type { Uncachable, ExistingProperty, NewProperty };41 enum Type { Uncachable, ExistingProperty, NewProperty, CustomProperty }; 40 42 enum Context { UnknownContext, PutById, PutByIdEval }; 43 typedef void (*PutValueFunc)(ExecState*, EncodedJSValue base, EncodedJSValue value); 41 44 42 PutPropertySlot( bool isStrictMode = false, Context context = UnknownContext)45 PutPropertySlot(JSValue thisValue, bool isStrictMode = false, Context context = UnknownContext) 43 46 : m_type(Uncachable) 44 47 , m_base(0) 48 , m_thisValue(thisValue) 45 49 , m_isStrictMode(isStrictMode) 46 50 , m_context(context) 51 , m_putFunction(nullptr) 47 52 { 48 53 } … … 61 66 m_offset = offset; 62 67 } 68 69 void setCustomProperty(JSObject* base, PutValueFunc function) 70 { 71 m_type = CustomProperty; 72 m_base = base; 73 m_putFunction = function; 74 } 63 75 64 76 Context context() const { return static_cast<Context>(m_context); } … … 66 78 Type type() const { return m_type; } 67 79 JSObject* base() const { return m_base; } 80 JSValue thisValue() const { return m_thisValue; } 68 81 69 82 bool isStrictMode() const { return m_isStrictMode; } 70 bool isCacheable() const { return m_type != Uncachable ; }83 bool isCacheable() const { return m_type != Uncachable && m_type != CustomProperty; } 71 84 PropertyOffset cachedOffset() const 72 85 { … … 78 91 Type m_type; 79 92 JSObject* m_base; 93 JSValue m_thisValue; 80 94 PropertyOffset m_offset; 81 95 bool m_isStrictMode; 82 96 uint8_t m_context; 97 PutValueFunc m_putFunction; 98 83 99 }; 84 100 -
trunk/Source/WebCore/ChangeLog
r161031 r161033 1 2013-12-23 Oliver Hunt <[email protected]> 2 3 Refactor PutPropertySlot to be aware of custom properties 4 https://bugs.webkit.org/show_bug.cgi?id=126187 5 6 Reviewed by msaboff. 7 8 Update the bindings code generation and custom objects 9 to the new function signatures 10 11 * bindings/js/JSDOMWindowCustom.cpp: 12 (WebCore::JSDOMWindow::put): 13 * bindings/objc/WebScriptObject.mm: 14 (-[WebScriptObject setValue:forKey:]): 15 * bindings/scripts/CodeGeneratorJS.pm: 16 (GenerateImplementation): 17 * bindings/scripts/test/JS/JSTestInterface.cpp: 18 (WebCore::JSTestInterface::putByIndex): 19 * bridge/NP_jsobject.cpp: 20 (_NPN_SetProperty): 21 1 22 2013-12-23 Benjamin Poulain <[email protected]> 2 23 -
trunk/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
r160208 r161033 340 340 } 341 341 342 if (lookupPut <JSDOMWindow>(exec, propertyName, value, *s_info.propHashTable(exec), thisObject))342 if (lookupPut(exec, propertyName, value, *s_info.propHashTable(exec), slot)) 343 343 return; 344 344 -
trunk/Source/WebCore/bindings/objc/WebScriptObject.mm
r159605 r161033 377 377 378 378 JSLockHolder lock(exec); 379 380 PutPropertySlot slot ;381 [self _imp]->methodTable()->put([self _imp], exec, Identifier(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot);379 JSObject* object = JSC::jsDynamicCast<JSObject*>([self _imp]); 380 PutPropertySlot slot(object); 381 object->methodTable()->put(object, exec, Identifier(exec, String(key)), convertObjcValueToValue(exec, &value, ObjcObjectType, [self _rootObject]), slot); 382 382 383 383 if (exec->hadException()) { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r161009 r161033 2131 2131 if ($interface->extendedAttributes->{"CustomNamedSetter"}) { 2132 2132 push(@implContent, " PropertyName propertyName = Identifier::from(exec, index);\n"); 2133 push(@implContent, " PutPropertySlot slot( shouldThrow);\n");2133 push(@implContent, " PutPropertySlot slot(thisObject, shouldThrow);\n"); 2134 2134 push(@implContent, " if (thisObject->putDelegate(exec, propertyName, value, slot))\n"); 2135 2135 push(@implContent, " return;\n"); … … 2161 2161 if (!$attribute->isStatic) { 2162 2162 push(@implContent, " ${className}* castedThis = jsDynamicCast<${className}*>(JSValue::decode(thisValue));\n"); 2163 if ($interfaceName eq "DOMWindow") { 2164 push(@implContent, " if (!castedThis) {\n"); 2165 push(@implContent, " if (JSDOMWindowShell* shell = jsDynamicCast<JSDOMWindowShell*>(JSValue::decode(thisValue)))\n"); 2166 push(@implContent, " castedThis = shell->window();\n"); 2167 push(@implContent, " }\n"); 2168 } 2163 2169 push(@implContent, " if (!castedThis) {\n"); 2164 2170 push(@implContent, " throwVMTypeError(exec);\n"); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r161009 r161033 456 456 ASSERT_GC_OBJECT_INHERITS(thisObject, info()); 457 457 PropertyName propertyName = Identifier::from(exec, index); 458 PutPropertySlot slot( shouldThrow);458 PutPropertySlot slot(thisObject, shouldThrow); 459 459 if (thisObject->putDelegate(exec, propertyName, value, slot)) 460 460 return; -
trunk/Source/WebCore/bridge/NP_jsobject.cpp
r154967 r161033 325 325 326 326 if (i->isString()) { 327 PutPropertySlot slot ;327 PutPropertySlot slot(obj->imp); 328 328 obj->imp->methodTable()->put(obj->imp, exec, identifierFromNPIdentifier(exec, i->string()), convertNPVariantToValue(exec, variant, rootObject), slot); 329 329 } else -
trunk/Source/WebKit/mac/ChangeLog
r161003 r161033 1 2013-12-23 Oliver Hunt <[email protected]> 2 3 Refactor PutPropertySlot to be aware of custom properties 4 https://bugs.webkit.org/show_bug.cgi?id=126187 5 6 Reviewed by msaboff. 7 8 Update for new method signatures. 9 10 * Plugins/Hosted/NetscapePluginInstanceProxy.mm: 11 (WebKit::NetscapePluginInstanceProxy::setProperty): 12 1 13 2013-12-23 Lucas Forschler <[email protected]> 2 14 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
r160457 r161033 1061 1061 1062 1062 JSValue value = demarshalValue(exec, valueData, valueLength); 1063 PutPropertySlot slot ;1063 PutPropertySlot slot(object); 1064 1064 object->methodTable()->put(object, exec, propertyName, value, slot); 1065 1065 -
trunk/Source/WebKit2/ChangeLog
r161020 r161033 1 2013-12-23 Oliver Hunt <[email protected]> 2 3 Refactor PutPropertySlot to be aware of custom properties 4 https://bugs.webkit.org/show_bug.cgi?id=126187 5 6 Reviewed by msaboff. 7 8 Update for new method signatures. 9 10 * WebProcess/Plugins/Netscape/NPJSObject.cpp: 11 (WebKit::NPJSObject::setProperty): 12 1 13 2013-12-23 Zan Dobersek <[email protected]> 2 14 -
trunk/Source/WebKit2/WebProcess/Plugins/Netscape/NPJSObject.cpp
r154038 r161033 193 193 JSValue jsValue = m_objectMap->convertNPVariantToJSValue(exec, m_objectMap->globalObject(), *value); 194 194 if (identifierRep->isString()) { 195 PutPropertySlot slot ;195 PutPropertySlot slot(m_jsObject.get()); 196 196 m_jsObject->methodTable()->put(m_jsObject.get(), exec, identifierFromIdentifierRep(exec, identifierRep), jsValue, slot); 197 197 } else
Note:
See TracChangeset
for help on using the changeset viewer.