Changeset 203937 in webkit
- Timestamp:
- Jul 29, 2016, 7:02:48 PM (9 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r203925 r203937 1 2016-07-29 Keith Miller <keith_miller@apple.com> 2 3 TypedArray super constructor has some incompatabilities 4 https://bugs.webkit.org/show_bug.cgi?id=160369 5 6 Reviewed by Filip Pizlo. 7 8 This patch fixes the length proprety of the TypedArray super constructor. 9 Additionally, the TypedArray super constructor should no longer be callable. 10 11 Also, this patch fixes the expected result of some test262 tests. 12 13 * runtime/JSTypedArrayViewConstructor.cpp: 14 (JSC::JSTypedArrayViewConstructor::finishCreation): 15 (JSC::constructTypedArrayView): 16 (JSC::JSTypedArrayViewConstructor::getCallData): 17 * tests/test262.yaml: 18 1 19 2016-07-29 Jonathan Bedard <jbedard@apple.com> 2 20 -
trunk/Source/JavaScriptCore/runtime/JSTypedArrayViewConstructor.cpp
r202890 r203937 50 50 Base::finishCreation(vm, "TypedArray"); 51 51 putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly); 52 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber( 3), DontEnum | DontDelete| ReadOnly);52 putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontEnum | ReadOnly); 53 53 putDirectNonIndexAccessor(vm, vm.propertyNames->speciesSymbol, speciesSymbol, Accessor | ReadOnly | DontEnum); 54 54 … … 64 64 65 65 66 // The only way we can call this function is through Reflect.construct or if they mucked with the TypedArray prototype chain. 67 // In either case we are ok with this being slow. 66 68 67 static EncodedJSValue JSC_HOST_CALL constructTypedArrayView(ExecState* exec) 69 68 { 70 JSValue value = exec->newTarget(); 71 72 JSObject* object = jsDynamicCast<JSObject*>(value); 73 if (!object) 74 return JSValue::encode(throwTypeError(exec, ASCIILiteral("new.target passed to TypedArray is not an object."))); 75 76 ConstructData data; 77 if (object->methodTable()->getConstructData(object, data) == ConstructType::None) 78 return JSValue::encode(throwTypeError(exec, ASCIILiteral("new.target passed to TypedArray is not a valid constructor."))); 79 80 for (; !value.isNull(); value = jsCast<JSObject*>(value)->getPrototypeDirect()) { 81 if (jsDynamicCast<JSTypedArrayViewConstructor*>(value)) 82 return JSValue::encode(throwTypeError(exec, ASCIILiteral("Unable to find TypedArray constructor that inherits from TypedArray."))); 83 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSInt8Array>*>(value)) 84 return constructGenericTypedArrayView<JSInt8Array>(exec); 85 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSInt16Array>*>(value)) 86 return constructGenericTypedArrayView<JSInt16Array>(exec); 87 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSInt32Array>*>(value)) 88 return constructGenericTypedArrayView<JSInt32Array>(exec); 89 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSUint8Array>*>(value)) 90 return constructGenericTypedArrayView<JSUint8Array>(exec); 91 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSUint16Array>*>(value)) 92 return constructGenericTypedArrayView<JSUint16Array>(exec); 93 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSUint32Array>*>(value)) 94 return constructGenericTypedArrayView<JSUint32Array>(exec); 95 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSUint8ClampedArray>*>(value)) 96 return constructGenericTypedArrayView<JSUint8ClampedArray>(exec); 97 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSFloat32Array>*>(value)) 98 return constructGenericTypedArrayView<JSFloat32Array>(exec); 99 if (jsDynamicCast<JSGenericTypedArrayViewConstructor<JSFloat64Array>*>(value)) 100 return constructGenericTypedArrayView<JSFloat64Array>(exec); 101 } 102 103 return JSValue::encode(throwTypeError(exec, ASCIILiteral("Unable to find TypedArray constructor in prototype-chain, hit null."))); 69 return throwVMTypeError(exec, ASCIILiteral("%TypedArray% should not be called directly")); 104 70 } 105 71 … … 112 78 CallType JSTypedArrayViewConstructor::getCallData(JSCell*, CallData& callData) 113 79 { 114 callData.native.function = nullptr;115 return CallType:: None;80 callData.native.function = constructTypedArrayView; 81 return CallType::Host; 116 82 } 117 83 -
trunk/Source/JavaScriptCore/tests/test262.yaml
r203499 r203937 45257 45257 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/testTypedArray.js"], [:strict] 45258 45258 - path: test262/test/built-ins/TypedArray/length.js 45259 cmd: runTest262 : fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js", "../../../harness/testTypedArray.js"], []45259 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js", "../../../harness/testTypedArray.js"], [] 45260 45260 - path: test262/test/built-ins/TypedArray/length.js 45261 cmd: runTest262 : fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js", "../../../harness/testTypedArray.js"], [:strict]45261 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js", "../../../harness/testTypedArray.js"], [:strict] 45262 45262 - path: test262/test/built-ins/TypedArray/name.js 45263 45263 cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js", "../../../harness/testTypedArray.js"], [] … … 46313 46313 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict] 46314 46314 - path: test262/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js 46315 cmd: runTest262 : fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], []46315 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [] 46316 46316 - path: test262/test/built-ins/TypedArray/prototype/indexOf/strict-comparison.js 46317 cmd: runTest262 : fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict]46317 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict] 46318 46318 - path: test262/test/built-ins/TypedArray/prototype/indexOf/this-is-not-object.js 46319 46319 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [] … … 46489 46489 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict] 46490 46490 - path: test262/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js 46491 cmd: runTest262 : fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], []46491 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [] 46492 46492 - path: test262/test/built-ins/TypedArray/prototype/lastIndexOf/strict-comparison.js 46493 cmd: runTest262 : fail, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict]46493 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], [:strict] 46494 46494 - path: test262/test/built-ins/TypedArray/prototype/lastIndexOf/this-is-not-object.js 46495 46495 cmd: runTest262 :normal, "NoException", ["../../../../../harness/assert.js", "../../../../../harness/sta.js", "../../../../../harness/testTypedArray.js"], []
Note:
See TracChangeset
for help on using the changeset viewer.