Changeset 196414 in webkit
- Timestamp:
- Feb 10, 2016 8:06:37 PM (8 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 1 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r196409 r196414 1 2016-02-10 Keith Miller <keith_miller@apple.com> 2 3 Symbol.species accessors on builtin constructors should be configurable 4 https://bugs.webkit.org/show_bug.cgi?id=154097 5 6 Reviewed by Benjamin Poulain. 7 8 We did not have the Symbol.species accessors on our builtin constructors 9 marked as configurable. This does not accurately follow the ES6 spec as 10 the ES6 spec states that all default accessors on builtins should be 11 configurable. This means that we need an additional watchpoint on 12 ArrayConstructor to make sure that no users re-configures Symbol.species. 13 14 * runtime/ArrayConstructor.cpp: 15 (JSC::ArrayConstructor::finishCreation): 16 * runtime/ArrayPrototype.cpp: 17 (JSC::speciesConstructArray): 18 (JSC::ArrayPrototype::setConstructor): 19 (JSC::ArrayPrototypeAdaptiveInferredPropertyWatchpoint::handleFire): 20 * runtime/ArrayPrototype.h: 21 (JSC::ArrayPrototype::didChangeConstructorOrSpeciesProperties): 22 (JSC::ArrayPrototype::didChangeConstructorProperty): Deleted. 23 * runtime/JSArrayBufferConstructor.cpp: 24 (JSC::JSArrayBufferConstructor::finishCreation): 25 * runtime/JSPromiseConstructor.cpp: 26 (JSC::JSPromiseConstructor::finishCreation): 27 * runtime/JSTypedArrayViewConstructor.cpp: 28 (JSC::JSTypedArrayViewConstructor::finishCreation): 29 * runtime/MapConstructor.cpp: 30 (JSC::MapConstructor::finishCreation): 31 * runtime/RegExpConstructor.cpp: 32 (JSC::RegExpConstructor::finishCreation): 33 * runtime/SetConstructor.cpp: 34 (JSC::SetConstructor::finishCreation): 35 * tests/stress/array-species-config-array-constructor.js: Added. 36 (A): 37 * tests/stress/symbol-species.js: 38 (testSymbolSpeciesOnConstructor): 39 1 40 2016-02-10 Benjamin Poulain <benjamin@webkit.org> 2 41 -
trunk/Source/JavaScriptCore/runtime/ArrayConstructor.cpp
r195460 r196414 68 68 putDirectWithoutTransition(vm, vm.propertyNames->prototype, arrayPrototype, DontEnum | DontDelete | ReadOnly); 69 69 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 70 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);70 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 71 71 } 72 72 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r196155 r196414 193 193 if (LIKELY(!thisObject->hasCustomProperties() 194 194 && thisObject->globalObject()->arrayPrototype() == thisObject->prototype() 195 && !thisObject->globalObject()->arrayPrototype()->didChangeConstructor Property()))195 && !thisObject->globalObject()->arrayPrototype()->didChangeConstructorOrSpeciesProperties())) 196 196 return std::make_pair(SpeciesConstructResult::FastPath, nullptr); 197 197 … … 1061 1061 putDirectWithoutTransition(vm, vm.propertyNames->constructor, constructorProperty, attributes); 1062 1062 1063 // Do the watchpoint on our constructor property 1063 1064 PropertyOffset offset = this->structure()->get(vm, vm.propertyNames->constructor); 1064 1065 ASSERT(isValidOffset(offset)); … … 1070 1071 m_constructorWatchpoint = std::make_unique<ArrayPrototypeAdaptiveInferredPropertyWatchpoint>(condition, this); 1071 1072 m_constructorWatchpoint->install(); 1073 1074 // Do the watchpoint on the constructor's Symbol.species property 1075 offset = constructorProperty->structure()->get(vm, vm.propertyNames->speciesSymbol); 1076 ASSERT(isValidOffset(offset)); 1077 constructorProperty->structure()->startWatchingPropertyForReplacements(vm, offset); 1078 1079 ASSERT(constructorProperty->getDirect(offset).isGetterSetter()); 1080 condition = ObjectPropertyCondition::equivalence(vm, this, constructorProperty, vm.propertyNames->speciesSymbol.impl(), constructorProperty->getDirect(offset)); 1081 ASSERT(condition.isWatchable()); 1082 1083 m_constructorSpeciesWatchpoint = std::make_unique<ArrayPrototypeAdaptiveInferredPropertyWatchpoint>(condition, this); 1084 m_constructorSpeciesWatchpoint->install(); 1072 1085 } 1073 1086 … … 1085 1098 StringFireDetail stringDetail(out.toCString().data()); 1086 1099 1087 m_arrayPrototype->m_didChangeConstructor Property= true;1100 m_arrayPrototype->m_didChangeConstructorOrSpeciesProperties = true; 1088 1101 } 1089 1102 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.h
r196155 r196414 47 47 void setConstructor(VM&, JSObject* constructorProperty, unsigned attributes); 48 48 49 bool didChangeConstructor Property() const { return m_didChangeConstructorProperty; }49 bool didChangeConstructorOrSpeciesProperties() const { return m_didChangeConstructorOrSpeciesProperties; } 50 50 51 51 static const bool needsDestruction = false; … … 60 60 friend ArrayPrototypeAdaptiveInferredPropertyWatchpoint; 61 61 std::unique_ptr<ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorWatchpoint; 62 bool m_didChangeConstructorProperty = false; 62 std::unique_ptr<ArrayPrototypeAdaptiveInferredPropertyWatchpoint> m_constructorSpeciesWatchpoint; 63 bool m_didChangeConstructorOrSpeciesProperties = false; 63 64 }; 64 65 -
trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp
r195528 r196414 54 54 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 55 55 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly); 56 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);56 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 57 57 58 58 JSGlobalObject* globalObject = this->globalObject(); -
trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp
r195528 r196414 86 86 putDirectWithoutTransition(vm, vm.propertyNames->prototype, promisePrototype, DontEnum | DontDelete | ReadOnly); 87 87 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete); 88 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);88 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 89 89 } 90 90 -
trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp
r195528 r196414 51 51 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 52 52 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(3), DontEnum | DontDelete | ReadOnly); 53 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);53 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 54 54 55 55 JSC_BUILTIN_FUNCTION_WITHOUT_TRANSITION(vm.propertyNames->of, typedArrayConstructorOfCodeGenerator, DontEnum); -
trunk/Source/JavaScriptCore/runtime/MapConstructor.cpp
r195460 r196414 46 46 putDirectWithoutTransition(vm, vm.propertyNames->prototype, mapPrototype, DontEnum | DontDelete | ReadOnly); 47 47 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum | DontDelete); 48 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);48 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 49 49 } 50 50 -
trunk/Source/JavaScriptCore/runtime/RegExpConstructor.cpp
r196331 r196414 103 103 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(2), ReadOnly | DontDelete | DontEnum); 104 104 105 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);105 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 106 106 } 107 107 -
trunk/Source/JavaScriptCore/runtime/SetConstructor.cpp
r195460 r196414 47 47 putDirectWithoutTransition(vm, vm.propertyNames->prototype, setPrototype, DontEnum | DontDelete | ReadOnly); 48 48 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum | DontDelete); 49 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum | DontDelete);49 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 50 50 } 51 51 -
trunk/Source/JavaScriptCore/tests/stress/symbol-species.js
r195460 r196414 7 7 if (constructor[Symbol.species] !== constructor) 8 8 throw "Symbol.species was mutable " + constructor.name; 9 try { 10 Object.defineProperty(constructor, Symbol.species, { value: true }); 11 } catch(e) { 12 return; 13 } 14 throw "Symbol.species was configurable " + constructor.name; 9 10 // Symbol.species should be configurable. 11 Object.defineProperty(constructor, Symbol.species, { value: true }); 15 12 } 16 13
Note: See TracChangeset
for help on using the changeset viewer.