Commit 9c0aef52 authored by hablich's avatar hablich Committed by Commit bot

Revert of Amends the TypedArray constructor to use the path for primitives for...

Revert of Amends the TypedArray constructor to use the path for primitives for all (patchset #4 id:60001 of https://codereview.chromium.org/2096873002/ )

Reason for revert:
Speculative revert to unblock roll https://codereview.chromium.org/2114113002/

Original issue's description:
> Amends the TypedArray constructor to use the path for primitives for all
> types of primitives, not just undefined, booleans, numbers, and strings.
> (The missing cases were null and Symbol.) This is required by the
> specification, and there are test262 tests which we were failing due to
> this bug.
>
> BUG=v8:5124
>
> Committed: https://crrev.com/f788bd9cce19815cba746e47bb65abfe25c16208
> Committed: https://crrev.com/f772c22cd1c492aa0235a8e6012d0386146d2eb2
> Cr-Original-Commit-Position: refs/heads/master@{#37234}
> Cr-Commit-Position: refs/heads/master@{#37407}

TBR=littledan@chromium.org,bakkot@google.com
NOTREECHECKS=true
BUG=v8:5124

Review-Url: https://codereview.chromium.org/2120763002
Cr-Commit-Position: refs/heads/master@{#37487}
parent c171ced5
......@@ -263,17 +263,18 @@ function NAMEConstructor(arg1, arg2, arg3) {
if (!IS_UNDEFINED(new.target)) {
if (IS_ARRAYBUFFER(arg1) || IS_SHAREDARRAYBUFFER(arg1)) {
NAMEConstructByArrayBuffer(this, arg1, arg2, arg3);
} else if (IS_NUMBER(arg1) || IS_STRING(arg1) ||
IS_BOOLEAN(arg1) || IS_UNDEFINED(arg1)) {
NAMEConstructByLength(this, arg1);
} else if (IS_TYPEDARRAY(arg1)) {
NAMEConstructByTypedArray(this, arg1);
} else if (IS_RECEIVER(arg1)) {
} else {
var iteratorFn = arg1[iteratorSymbol];
if (IS_UNDEFINED(iteratorFn) || iteratorFn === ArrayValues) {
NAMEConstructByArrayLike(this, arg1, arg1.length);
} else {
NAMEConstructByIterable(this, arg1, iteratorFn);
}
} else {
NAMEConstructByLength(this, arg1);
}
} else {
throw MakeTypeError(kConstructorNotFunction, "NAME")
......
......@@ -229,27 +229,6 @@ function TestTypedArray(constr, elementSize, typicalElement) {
RangeError);
}
var aFromUndef = new constr();
assertSame(elementSize, aFromUndef.BYTES_PER_ELEMENT);
assertSame(0, aFromUndef.length);
assertSame(0*elementSize, aFromUndef.byteLength);
assertSame(0, aFromUndef.byteOffset);
assertSame(0*elementSize, aFromUndef.buffer.byteLength);
var aFromNull = new constr(null);
assertSame(elementSize, aFromNull.BYTES_PER_ELEMENT);
assertSame(0, aFromNull.length);
assertSame(0*elementSize, aFromNull.byteLength);
assertSame(0, aFromNull.byteOffset);
assertSame(0*elementSize, aFromNull.buffer.byteLength);
var aFromBool = new constr(true);
assertSame(elementSize, aFromBool.BYTES_PER_ELEMENT);
assertSame(1, aFromBool.length);
assertSame(1*elementSize, aFromBool.byteLength);
assertSame(0, aFromBool.byteOffset);
assertSame(1*elementSize, aFromBool.buffer.byteLength);
var aFromString = new constr("30");
assertSame(elementSize, aFromString.BYTES_PER_ELEMENT);
assertSame(30, aFromString.length);
......@@ -257,8 +236,6 @@ function TestTypedArray(constr, elementSize, typicalElement) {
assertSame(0, aFromString.byteOffset);
assertSame(30*elementSize, aFromString.buffer.byteLength);
assertThrows(function() { new constr(Symbol()); }, TypeError);
var jsArray = [];
for (i = 0; i < 30; i++) {
jsArray.push(typicalElement);
......
......@@ -137,6 +137,9 @@
'intl402/DateTimeFormat/12.1.1_1': [FAIL],
'intl402/NumberFormat/11.1.1_1': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4727
'built-ins/TypedArrays/length-arg-is-symbol-throws': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4784
'built-ins/TypedArray/prototype/set/typedarray-arg-negative-integer-offset-throws': [FAIL],
'built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws': [FAIL],
......@@ -399,6 +402,9 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=5121
'language/expressions/assignment/destructuring/obj-prop-__proto__dup': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=5124
'built-ins/TypedArrays/length-arg-toindex-length': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4973
'language/literals/numeric/non-octal-decimal-integer-strict': [FAIL],
......@@ -530,9 +536,6 @@
'built-ins/RegExp/prototype/multiline/15.10.7.4-1': [FAIL],
# https://github.com/tc39/test262/issues/694
'built-ins/TypedArrays/length-arg-toindex-length': [FAIL],
# https://github.com/tc39/test262/issues/696
'language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing': [FAIL],
############################ SKIPPED TESTS #############################
......
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