Modified: trunk/JSTests/test262/expectations.yaml (294928 => 294929)
--- trunk/JSTests/test262/expectations.yaml 2022-05-27 03:55:15 UTC (rev 294928)
+++ trunk/JSTests/test262/expectations.yaml 2022-05-27 05:20:50 UTC (rev 294929)
@@ -1098,9 +1098,6 @@
test/built-ins/TypedArray/prototype/sort/sort-tonumber.js:
default: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
strict mode: 'TypeError: Underlying ArrayBuffer has been detached from the view (Testing with Float64Array.)'
-test/built-ins/TypedArrayConstructors/ctors/no-species.js:
- default: 'Test262Error: unreachable'
- strict mode: 'Test262Error: unreachable'
test/harness/temporalHelpers-one-shift-time-zone.js:
default: "TypeError: undefined is not a constructor (evaluating 'new Temporal.PlainDateTime(2021, 3, 28, 1)')"
strict mode: "TypeError: undefined is not a constructor (evaluating 'new Temporal.PlainDateTime(2021, 3, 28, 1)')"
Modified: trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h (294928 => 294929)
--- trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h 2022-05-27 03:55:15 UTC (rev 294928)
+++ trunk/Source/_javascript_Core/runtime/JSGenericTypedArrayViewConstructorInlines.h 2022-05-27 05:20:50 UTC (rev 294929)
@@ -105,43 +105,6 @@
return result;
}
-inline JSArrayBuffer* constructCustomArrayBufferIfNeeded(JSGlobalObject* globalObject, JSArrayBufferView* view)
-{
- VM& vm = globalObject->vm();
- auto scope = DECLARE_THROW_SCOPE(vm);
-
- JSArrayBuffer* source = view->possiblySharedJSBuffer(globalObject);
- RETURN_IF_EXCEPTION(scope, nullptr);
- if (source->isShared())
- return nullptr;
-
- std::optional<JSValue> species = arrayBufferSpeciesConstructor(globalObject, source, ArrayBufferSharingMode::Default);
- RETURN_IF_EXCEPTION(scope, nullptr);
- if (!species)
- return nullptr;
-
- if (!species->isConstructor()) {
- throwTypeError(globalObject, scope, "species is not a constructor"_s);
- return nullptr;
- }
-
- JSValue prototype = species->get(globalObject, vm.propertyNames->prototype);
- RETURN_IF_EXCEPTION(scope, nullptr);
-
- auto buffer = ArrayBuffer::tryCreate(source->impl()->byteLength(), 1);
- if (!buffer) {
- throwOutOfMemoryError(globalObject, scope);
- return nullptr;
- }
-
- JSGlobalObject* functionGlobalObject = getFunctionRealm(globalObject, asObject(species.value()));
- RETURN_IF_EXCEPTION(scope, nullptr);
- auto result = JSArrayBuffer::create(vm, functionGlobalObject->arrayBufferStructure(ArrayBufferSharingMode::Default), WTFMove(buffer));
- if (prototype.isObject())
- result->setPrototypeDirect(vm, prototype);
- return result;
-}
-
template<typename ViewClass>
inline JSObject* constructGenericTypedArrayViewWithArguments(JSGlobalObject* globalObject, Structure* structure, EncodedJSValue firstArgument, size_t offset, std::optional<size_t> lengthOpt)
{
@@ -183,13 +146,10 @@
if (JSObject* object = jsDynamicCast<JSObject*>(firstValue)) {
size_t length;
- JSArrayBuffer* customBuffer = nullptr;
if (isTypedView(object->classInfo()->typedArrayStorageType)) {
auto* view = jsCast<JSArrayBufferView*>(object);
- customBuffer = constructCustomArrayBufferIfNeeded(globalObject, view);
- RETURN_IF_EXCEPTION(scope, nullptr);
if (view->isDetached()) {
throwTypeError(globalObject, scope, "Underlying ArrayBuffer has been detached from the view"_s);
return nullptr;
@@ -236,9 +196,7 @@
}
}
- ViewClass* result = customBuffer
- ? ViewClass::create(globalObject, structure, customBuffer->impl(), 0, length)
- : ViewClass::createUninitialized(globalObject, structure, length);
+ ViewClass* result = ViewClass::createUninitialized(globalObject, structure, length);
EXCEPTION_ASSERT(!!scope.exception() == !result);
if (UNLIKELY(!result))
return nullptr;