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

Reason for revert:
[Sheriff] Breaks layout tests. Please rebase upstream if intended:
https://build.chromium.org/p/client.v8.fyi/builders/V8-Blink%20Linux%2064/builds/7691

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
> Cr-Commit-Position: refs/heads/master@{#37234}

TBR=littledan@chromium.org,bakkot@google.com
# Skipping CQ checks because original CL landed less than 1 days ago.
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=v8:5124

Review-Url: https://codereview.chromium.org/2091693004
Cr-Commit-Position: refs/heads/master@{#37236}
This commit is contained in:
machenbach 2016-06-23 23:31:07 -07:00 committed by Commit bot
parent c7eb436d09
commit 3f0ada1d84
3 changed files with 13 additions and 29 deletions

View File

@ -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")

View File

@ -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);

View File

@ -132,6 +132,12 @@
'built-ins/ArrayBuffer/positive-integer-length': [FAIL],
'language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing': [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],
'built-ins/TypedArrays/length-arg-is-float-throws-rangeerror': [FAIL],
'built-ins/TypedArrays/length-arg-is-nan-throws-rangeerror': [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],
@ -427,6 +433,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],
@ -563,9 +572,6 @@
'built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1': [FAIL],
'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],
############################ SKIPPED TESTS #############################
# These tests take a looong time to run.