Changeset 198023 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Mar 11, 2016, 9:28:46 AM (9 years ago)
- Author:
- Yusuke Suzuki
- Message:
-
[ES6] Implement Reflect.set without receiver support
https://bugs.webkit.org/show_bug.cgi?id=155024
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
This patch implements Reflect.set.
The challenge in this patch is Reflect.set requires boolean result of Set,
this is not propagated in the previous JSC put implementation.
This patch changes the put and putByIndex signature from
void put(...)
andvoid putByIndex(...)
tobool put(...)
andbool putByIndex(...)
,
more consistent style to the ECMA262 spec's Set.
This patch modifies so many part of WebKit. But almost all the changes are mechanical ones.
Currently, this patch does not support receiver modification support.
This will be supported in the subsequent patch[1].
[1]: https://bugs.webkit.org/show_bug.cgi?id=155294
- API/JSCallbackObject.h:
- API/JSCallbackObjectFunctions.h:
(JSC::JSCallbackObject<Parent>::put):
(JSC::JSCallbackObject<Parent>::putByIndex):
- debugger/DebuggerScope.cpp:
(JSC::DebuggerScope::put):
- debugger/DebuggerScope.h:
- jsc.cpp:
(WTF::RuntimeArray::put):
- runtime/ClassInfo.h:
- runtime/ClonedArguments.cpp:
(JSC::ClonedArguments::put):
- runtime/ClonedArguments.h:
- runtime/CustomGetterSetter.cpp:
(JSC::callCustomSetter):
- runtime/CustomGetterSetter.h:
- runtime/GenericArguments.h:
- runtime/GenericArgumentsInlines.h:
(JSC::GenericArguments<Type>::put):
(JSC::GenericArguments<Type>::putByIndex):
- runtime/GetterSetter.cpp:
(JSC::callSetter):
- runtime/GetterSetter.h:
- runtime/JSArray.cpp:
(JSC::JSArray::defineOwnProperty):
(JSC::JSArray::put):
(JSC::JSArray::push):
- runtime/JSArray.h:
- runtime/JSArrayBuffer.cpp:
(JSC::JSArrayBuffer::put):
- runtime/JSArrayBuffer.h:
- runtime/JSArrayBufferView.cpp:
(JSC::JSArrayBufferView::put):
- runtime/JSArrayBufferView.h:
- runtime/JSCJSValue.cpp:
(JSC::JSValue::putToPrimitive):
(JSC::JSValue::putToPrimitiveByIndex):
- runtime/JSCJSValue.h:
- runtime/JSCJSValueInlines.h:
(JSC::JSValue::put):
(JSC::JSValue::putInline):
(JSC::JSValue::putByIndex):
- runtime/JSCell.cpp:
(JSC::JSCell::put):
(JSC::JSCell::putByIndex):
- runtime/JSCell.h:
- runtime/JSDataView.cpp:
(JSC::JSDataView::put):
- runtime/JSDataView.h:
- runtime/JSFunction.cpp:
(JSC::JSFunction::put):
(JSC::JSFunction::defineOwnProperty):
- runtime/JSFunction.h:
- runtime/JSGenericTypedArrayView.h:
- runtime/JSGenericTypedArrayViewInlines.h:
(JSC::JSGenericTypedArrayView<Adaptor>::put):
(JSC::JSGenericTypedArrayView<Adaptor>::putByIndex):
- runtime/JSGlobalLexicalEnvironment.cpp:
(JSC::JSGlobalLexicalEnvironment::put):
- runtime/JSGlobalLexicalEnvironment.h:
- runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::put):
- runtime/JSGlobalObject.h:
- runtime/JSLexicalEnvironment.cpp:
(JSC::JSLexicalEnvironment::put):
- runtime/JSLexicalEnvironment.h:
- runtime/JSModuleEnvironment.cpp:
(JSC::JSModuleEnvironment::put):
- runtime/JSModuleEnvironment.h:
- runtime/JSModuleNamespaceObject.cpp:
(JSC::JSModuleNamespaceObject::put):
(JSC::JSModuleNamespaceObject::putByIndex):
- runtime/JSModuleNamespaceObject.h:
- runtime/JSModuleRecord.cpp:
(JSC::JSModuleRecord::instantiateDeclarations):
- runtime/JSObject.cpp:
(JSC::JSObject::put):
(JSC::JSObject::putInlineSlow):
(JSC::JSObject::putByIndex):
(JSC::JSObject::putGetter):
(JSC::JSObject::putSetter):
(JSC::JSObject::putDirectAccessor):
(JSC::JSObject::putDirectCustomAccessor):
(JSC::JSObject::putDirectNonIndexAccessor):
(JSC::JSObject::putIndexedDescriptor):
(JSC::JSObject::defineOwnIndexedProperty):
(JSC::JSObject::attemptToInterceptPutByIndexOnHoleForPrototype):
(JSC::JSObject::attemptToInterceptPutByIndexOnHole):
(JSC::JSObject::putByIndexBeyondVectorLengthWithoutAttributes):
(JSC::JSObject::putByIndexBeyondVectorLengthWithArrayStorage):
(JSC::JSObject::putByIndexBeyondVectorLength):
(JSC::JSObject::putDirectNativeIntrinsicGetter):
(JSC::JSObject::putDirectNativeFunction):
(JSC::JSObject::putDirectMayBeIndex):
(JSC::validateAndApplyPropertyDescriptor):
- runtime/JSObject.h:
(JSC::JSObject::putByIndexInline):
(JSC::JSObject::putDirect):
- runtime/JSObjectInlines.h:
(JSC::JSObject::putInline):
- runtime/JSProxy.cpp:
(JSC::JSProxy::put):
(JSC::JSProxy::putByIndex):
- runtime/JSProxy.h:
- runtime/JSSymbolTableObject.h:
(JSC::symbolTablePut):
(JSC::symbolTablePutTouchWatchpointSet):
(JSC::symbolTablePutInvalidateWatchpointSet):
(JSC::symbolTablePutWithAttributesTouchWatchpointSet):
- runtime/Lookup.h:
(JSC::putEntry):
(JSC::lookupPut):
- runtime/ProxyObject.cpp:
(JSC::ProxyObject::performPut):
(JSC::ProxyObject::put):
(JSC::ProxyObject::putByIndexCommon):
(JSC::ProxyObject::putByIndex):
- runtime/ProxyObject.h:
- runtime/PutPropertySlot.h:
- runtime/ReflectObject.cpp:
(JSC::reflectObjectSet):
- runtime/RegExpConstructor.cpp:
(JSC::setRegExpConstructorInput):
(JSC::setRegExpConstructorMultiline):
- runtime/RegExpObject.cpp:
(JSC::RegExpObject::defineOwnProperty):
(JSC::regExpObjectSetLastIndexStrict):
(JSC::regExpObjectSetLastIndexNonStrict):
(JSC::RegExpObject::put):
- runtime/RegExpObject.h:
- runtime/SparseArrayValueMap.cpp:
(JSC::SparseArrayValueMap::putEntry):
(JSC::SparseArrayEntry::put):
- runtime/SparseArrayValueMap.h:
- runtime/StringObject.cpp:
(JSC::StringObject::put):
(JSC::StringObject::putByIndex):
- runtime/StringObject.h:
- tests/es6.yaml:
- tests/modules/namespace.js:
- tests/stress/reflect-set.js: Added.
(shouldBe):
(shouldThrow):
(receiverCase.object2.set Cocoa):
(receiverCase):
(proxyCase):
(objectCase.set get shouldBe):
(objectCase.get shouldBe):
(arrayCase.set get shouldBe):
(arrayCase.get shouldBe):
(arrayBufferCase.set get shouldBe):
(arrayBufferCase.get shouldBe):
(set get shouldBe):
(get shouldBe):
(argumentCase.test1):
(argumentCase.test2):
(argumentCase.test3):
(argumentCase.test4.set get shouldBe):
(argumentCase.test5.get shouldBe):
(argumentStrictCase.test1):
(argumentStrictCase.test2):
(argumentStrictCase.test3):
(argumentStrictCase.test4.set get shouldBe):
(argumentStrictCase.test5.get shouldBe):
(stringObjectCase.set get shouldBe):
(stringObjectCase.get shouldBe):
(customSetter.test1):
(customSetter.test2):
(customSetter.test3):
(customSetter):
(regExpLastIndex):
(functionCase.func):
Source/WebCore:
CustomSetter returns boolean value that indicates the result of Set.
According to this change, this patch modifies the CodeGeneratorJS and test results.
Currently, DOM elements' Set return true when the setter is found.
This is good for the first step.
- bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::putDelegate):
- bindings/js/JSDOMBinding.cpp:
(WebCore::throwSetterTypeError):
- bindings/js/JSDOMBinding.h:
- bindings/js/JSDOMStringMapCustom.cpp:
(WebCore::JSDOMStringMap::putDelegate):
- bindings/js/JSDOMWindowBase.cpp:
(WebCore::JSDOMWindowBase::updateDocument):
- bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::put):
(WebCore::JSDOMWindow::putByIndex):
- bindings/js/JSHTMLAppletElementCustom.cpp:
(WebCore::JSHTMLAppletElement::putDelegate):
- bindings/js/JSHTMLEmbedElementCustom.cpp:
(WebCore::JSHTMLEmbedElement::putDelegate):
- bindings/js/JSHTMLObjectElementCustom.cpp:
(WebCore::JSHTMLObjectElement::putDelegate):
- bindings/js/JSLocationCustom.cpp:
(WebCore::JSLocation::putDelegate):
(WebCore::JSLocationPrototype::putDelegate):
- bindings/js/JSPluginElementFunctions.cpp:
(WebCore::pluginElementCustomPut):
- bindings/js/JSPluginElementFunctions.h:
- bindings/js/JSStorageCustom.cpp:
(WebCore::JSStorage::putDelegate):
- bindings/scripts/CodeGeneratorJS.pm:
(GenerateHeader):
(GenerateImplementation):
(GeneratePrototypeDeclaration):
- bindings/scripts/test/JS/JSTestActiveDOMObject.cpp:
(WebCore::setJSTestActiveDOMObjectConstructor):
- bindings/scripts/test/JS/JSTestClassWithJSBuiltinConstructor.cpp:
(WebCore::setJSTestClassWithJSBuiltinConstructorConstructor):
- bindings/scripts/test/JS/JSTestCustomConstructorWithNoInterfaceObject.cpp:
(WebCore::setJSTestCustomConstructorWithNoInterfaceObjectConstructor):
- bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:
(WebCore::setJSTestCustomNamedGetterConstructor):
- bindings/scripts/test/JS/JSTestEventConstructor.cpp:
(WebCore::setJSTestEventConstructorConstructor):
- bindings/scripts/test/JS/JSTestEventTarget.cpp:
(WebCore::setJSTestEventTargetConstructor):
- bindings/scripts/test/JS/JSTestException.cpp:
(WebCore::setJSTestExceptionConstructor):
- bindings/scripts/test/JS/JSTestGenerateIsReachable.cpp:
(WebCore::setJSTestGenerateIsReachableConstructor):
- bindings/scripts/test/JS/JSTestInterface.cpp:
(WebCore::setJSTestInterfaceConstructor):
(WebCore::JSTestInterface::put):
(WebCore::JSTestInterface::putByIndex):
(WebCore::setJSTestInterfaceConstructorImplementsStaticAttr):
(WebCore::setJSTestInterfaceImplementsStr2):
(WebCore::setJSTestInterfaceImplementsStr3):
(WebCore::setJSTestInterfaceImplementsNode):
(WebCore::setJSTestInterfaceConstructorSupplementalStaticAttr):
(WebCore::setJSTestInterfaceSupplementalStr2):
(WebCore::setJSTestInterfaceSupplementalStr3):
(WebCore::setJSTestInterfaceSupplementalNode):
- bindings/scripts/test/JS/JSTestInterface.h:
- bindings/scripts/test/JS/JSTestJSBuiltinConstructor.cpp:
(WebCore::setJSTestJSBuiltinConstructorConstructor):
(WebCore::setJSTestJSBuiltinConstructorTestAttributeRWCustom):
- bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
(WebCore::setJSTestMediaQueryListListenerConstructor):
- bindings/scripts/test/JS/JSTestNamedConstructor.cpp:
(WebCore::setJSTestNamedConstructorConstructor):
- bindings/scripts/test/JS/JSTestNode.cpp:
(WebCore::setJSTestNodeConstructor):
(WebCore::setJSTestNodeName):
- bindings/scripts/test/JS/JSTestNondeterministic.cpp:
(WebCore::setJSTestNondeterministicConstructor):
(WebCore::setJSTestNondeterministicNondeterministicWriteableAttr):
(WebCore::setJSTestNondeterministicNondeterministicExceptionAttr):
(WebCore::setJSTestNondeterministicNondeterministicGetterExceptionAttr):
(WebCore::setJSTestNondeterministicNondeterministicSetterExceptionAttr):
- bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::setJSTestObjConstructor):
(WebCore::setJSTestObjConstructorStaticStringAttr):
(WebCore::setJSTestObjTestSubObjEnabledBySettingConstructor):
(WebCore::setJSTestObjEnumAttr):
(WebCore::setJSTestObjByteAttr):
(WebCore::setJSTestObjOctetAttr):
(WebCore::setJSTestObjShortAttr):
(WebCore::setJSTestObjUnsignedShortAttr):
(WebCore::setJSTestObjLongAttr):
(WebCore::setJSTestObjLongLongAttr):
(WebCore::setJSTestObjUnsignedLongLongAttr):
(WebCore::setJSTestObjStringAttr):
(WebCore::setJSTestObjTestObjAttr):
(WebCore::setJSTestObjLenientTestObjAttr):
(WebCore::setJSTestObjStringAttrTreatingNullAsEmptyString):
(WebCore::setJSTestObjXMLObjAttr):
(WebCore::setJSTestObjCreate):
(WebCore::setJSTestObjReflectedStringAttr):
(WebCore::setJSTestObjReflectedIntegralAttr):
(WebCore::setJSTestObjReflectedUnsignedIntegralAttr):
(WebCore::setJSTestObjReflectedBooleanAttr):
(WebCore::setJSTestObjReflectedURLAttr):
(WebCore::setJSTestObjReflectedCustomIntegralAttr):
(WebCore::setJSTestObjReflectedCustomBooleanAttr):
(WebCore::setJSTestObjReflectedCustomURLAttr):
(WebCore::setJSTestObjTypedArrayAttr):
(WebCore::setJSTestObjAttrWithGetterException):
(WebCore::setJSTestObjAttrWithGetterExceptionWithMessage):
(WebCore::setJSTestObjAttrWithSetterException):
(WebCore::setJSTestObjAttrWithSetterExceptionWithMessage):
(WebCore::setJSTestObjStringAttrWithGetterException):
(WebCore::setJSTestObjStringAttrWithSetterException):
(WebCore::setJSTestObjStrictTypeCheckingAttribute):
(WebCore::setJSTestObjCustomAttr):
(WebCore::setJSTestObjOnfoo):
(WebCore::setJSTestObjWithScriptStateAttribute):
(WebCore::setJSTestObjWithCallWithAndSetterCallWithAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAttribute):
(WebCore::setJSTestObjWithScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttribute):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateAttributeRaises):
(WebCore::setJSTestObjWithScriptExecutionContextAndScriptStateWithSpacesAttribute):
(WebCore::setJSTestObjWithScriptArgumentsAndCallStackAttribute):
(WebCore::setJSTestObjConditionalAttr1):
(WebCore::setJSTestObjConditionalAttr2):
(WebCore::setJSTestObjConditionalAttr3):
(WebCore::setJSTestObjConditionalAttr4Constructor):
(WebCore::setJSTestObjConditionalAttr5Constructor):
(WebCore::setJSTestObjConditionalAttr6Constructor):
(WebCore::setJSTestObjAnyAttribute):
(WebCore::setJSTestObjMutablePoint):
(WebCore::setJSTestObjImmutablePoint):
(WebCore::setJSTestObjStrawberry):
(WebCore::setJSTestObjStrictFloat):
(WebCore::setJSTestObjId):
(WebCore::setJSTestObjReplaceableAttribute):
(WebCore::setJSTestObjNullableLongSettableAttribute):
(WebCore::setJSTestObjNullableStringSettableAttribute):
(WebCore::setJSTestObjNullableStringValue):
(WebCore::setJSTestObjAttributeWithReservedEnumType):
(WebCore::setJSTestObjPutForwardsAttribute):
(WebCore::setJSTestObjPutForwardsNullableAttribute):
- bindings/scripts/test/JS/JSTestOverloadedConstructors.cpp:
(WebCore::setJSTestOverloadedConstructorsConstructor):
- bindings/scripts/test/JS/JSTestOverrideBuiltins.cpp:
(WebCore::setJSTestOverrideBuiltinsConstructor):
- bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp:
(WebCore::setJSTestSerializedScriptValueInterfaceConstructor):
(WebCore::setJSTestSerializedScriptValueInterfaceValue):
(WebCore::setJSTestSerializedScriptValueInterfaceCachedValue):
- bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::setJSTestTypedefsConstructor):
(WebCore::setJSTestTypedefsUnsignedLongLongAttr):
(WebCore::setJSTestTypedefsImmutableSerializedScriptValue):
(WebCore::setJSTestTypedefsAttrWithGetterException):
(WebCore::setJSTestTypedefsAttrWithSetterException):
(WebCore::setJSTestTypedefsStringAttrWithGetterException):
(WebCore::setJSTestTypedefsStringAttrWithSetterException):
- bindings/scripts/test/JS/JSattribute.cpp:
(WebCore::setJSattributeConstructor):
- bindings/scripts/test/JS/JSreadonly.cpp:
(WebCore::setJSreadonlyConstructor):
- bridge/c/c_runtime.cpp:
(JSC::Bindings::CField::setValueToInstance):
- bridge/c/c_runtime.h:
- bridge/jsc/BridgeJSC.h:
(JSC::Bindings::Instance::put):
- bridge/objc/objc_runtime.h:
- bridge/objc/objc_runtime.mm:
(JSC::Bindings::ObjcField::setValueToInstance):
(JSC::Bindings::ObjcArray::setValueAt):
(JSC::Bindings::ObjcFallbackObjectImp::put):
- bridge/runtime_array.cpp:
(JSC::RuntimeArray::put):
(JSC::RuntimeArray::putByIndex):
- bridge/runtime_array.h:
- bridge/runtime_object.cpp:
(JSC::Bindings::RuntimeObject::put):
- bridge/runtime_object.h:
Source/WebKit/mac:
As the same to NPJSObject, we just propagate the returned value of NetscapePluginInstanceProxy::setProperty.
- Plugins/Hosted/ProxyInstance.h:
- Plugins/Hosted/ProxyInstance.mm:
(WebKit::ProxyField::setValueToInstance):
(WebKit::ProxyInstance::setFieldValue):
Source/WebKit2:
NPJSObject::setProperty may call
methodTable()->put
operation, but we intentionally do not propagate it to the caller's ::put.
In the current implementation, we just use the result of ::setProperty call.
This istrue
when ::setProperty attempts to callmethodTable()->put
.
In ::setProperty, after callingmethodTable()->put
, ::setProperty function clears the exception state.
So this is not the same semantics to the simple data property store. Rather, this is like the accessor.
In ECMA262 Set, it returns true if there is a setter. So we just use the returned value of ::setProperty.
This indicates that there is a setter for the given Set operation.
- WebProcess/Plugins/Netscape/JSNPObject.cpp:
(WebKit::JSNPObject::put):
- WebProcess/Plugins/Netscape/JSNPObject.h:
LayoutTests:
- js/dom/reflect-set-onto-dom-expected.txt: Added.
- js/dom/reflect-set-onto-dom.html: Added.
- js/dom/script-tests/reflect-set-onto-dom.js: Added.
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r197862 r198023 417 417 } 418 418 419 static NO_RETURN_DUE_TO_CRASH voidput(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&)419 static NO_RETURN_DUE_TO_CRASH bool put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&) 420 420 { 421 421 RELEASE_ASSERT_NOT_REACHED();