Commit 2fa1c884 authored by littledan's avatar littledan Committed by Commit bot

Implement TypedArray(typedarray) constructor

The ES2016 draft spec defines a sort of fast path for constructing
a TypedArray based on another TypedArray. This patch implements that
alternative path in TypedArray construction. It is verified by
test262 tests, which now pass. This patch also has a slight cleanup
of TypedArray code by using a macro for TypedArray type checks, as
is done for other types.

This patch includes a minor spec violation: In the same-type case, the
spec indicates that the underlying ArrayBuffer should be copied until
the end, and this is fixed up by making the [[ArrayLength]] shorter.
This is observable with the buffer getter. This patch just copies the
used part of the underlying ArrayBuffer.

R=adamk
BUG=v8:4726
LOG=Y

Review URL: https://codereview.chromium.org/1754593003

Cr-Commit-Position: refs/heads/master@{#34443}
parent 2d090b11
......@@ -90,6 +90,7 @@ macro IS_STRING(arg) = (typeof(arg) === 'string');
macro IS_STRING_WRAPPER(arg) = (%_ClassOf(arg) === 'String');
macro IS_SYMBOL(arg) = (typeof(arg) === 'symbol');
macro IS_SYMBOL_WRAPPER(arg) = (%_ClassOf(arg) === 'Symbol');
macro IS_TYPEDARRAY(arg) = (%_IsTypedArray(arg));
macro IS_UNDEFINED(arg) = (arg === (void 0));
macro IS_WEAKMAP(arg) = (%_ClassOf(arg) === 'WeakMap');
macro IS_WEAKSET(arg) = (%_ClassOf(arg) === 'WeakSet');
......
This diff is collapsed.
......@@ -257,20 +257,6 @@
'language/statements/try/tco-finally': [FAIL],
'language/statements/while/tco-body': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4726
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-access-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-custom-species': [FAIL],
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-not-object-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-access-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-not-ctor-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-other-ctor-buffer-ctor-species-prototype-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-access-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-custom': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-not-ctor': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-prototype-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-species-throws': [FAIL],
'built-ins/TypedArrays/typedarray-arg-same-ctor-buffer-ctor-value-not-obj-throws': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4727
'built-ins/TypedArrays/length-arg-is-undefined-throws': [FAIL],
'built-ins/TypedArrays/length-arg-is-symbol-throws': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment