Commit 91e2039d authored by gsathya's avatar gsathya Committed by Commit bot

TypedArray: Make byteOffset, byteLength, and length configurable

Removes the DONT_DELETE enum bit from the properties to make them
configurable.

Also, updates the regress-typedarray-length test to --
- Check for true boolean return value on deletion of these
  properties.
- Check for undefined return value on trying to access these
  properties after deletion.

BUG=v8:4902
LOG=Y

Review-Url: https://codereview.chromium.org/2001393004
Cr-Commit-Position: refs/heads/master@{#36528}
parent 06cc9b7c
......@@ -827,12 +827,11 @@ utils.InstallFunctions(TypedArray, DONT_ENUM, [
"of", TypedArrayOf
]);
utils.InstallGetter(TypedArray.prototype, "buffer", TypedArrayGetBuffer);
utils.InstallGetter(TypedArray.prototype, "byteOffset", TypedArrayGetByteOffset,
DONT_ENUM | DONT_DELETE);
utils.InstallGetter(TypedArray.prototype, "byteOffset",
TypedArrayGetByteOffset);
utils.InstallGetter(TypedArray.prototype, "byteLength",
TypedArrayGetByteLength, DONT_ENUM | DONT_DELETE);
utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength,
DONT_ENUM | DONT_DELETE);
TypedArrayGetByteLength);
utils.InstallGetter(TypedArray.prototype, "length", TypedArrayGetLength);
utils.InstallGetter(TypedArray.prototype, toStringTagSymbol,
TypedArrayGetToStringTag);
utils.InstallFunctions(TypedArray.prototype, DONT_ENUM, [
......
......@@ -108,13 +108,13 @@ assertEquals(undefined, get(a));
assertEquals("blah", get(a));
})();
// Ensure we cannot delete length, byteOffset, byteLength.
// Ensure we can delete length, byteOffset, byteLength.
assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("length"));
assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteOffset"));
assertTrue(Int32Array.prototype.__proto__.hasOwnProperty("byteLength"));
assertFalse(delete Int32Array.prototype.__proto__.length);
assertFalse(delete Int32Array.prototype.__proto__.byteOffset);
assertFalse(delete Int32Array.prototype.__proto__.byteLength);
assertTrue(delete Int32Array.prototype.__proto__.length);
assertTrue(delete Int32Array.prototype.__proto__.byteOffset);
assertTrue(delete Int32Array.prototype.__proto__.byteLength);
a = new Int32Array(100);
......@@ -122,28 +122,28 @@ get = function(a) {
return a.length;
}
assertEquals(100, get(a));
assertEquals(100, get(a));
assertEquals(100, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
%OptimizeFunctionOnNextCall(get);
assertEquals(100, get(a));
assertEquals(undefined, get(a));
get = function(a) {
return a.byteLength;
}
assertEquals(400, get(a));
assertEquals(400, get(a));
assertEquals(400, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
%OptimizeFunctionOnNextCall(get);
assertEquals(400, get(a));
assertEquals(undefined, get(a));
get = function(a) {
return a.byteOffset;
}
assertEquals(0, get(a));
assertEquals(0, get(a));
assertEquals(0, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
assertEquals(undefined, get(a));
%OptimizeFunctionOnNextCall(get);
assertEquals(0, get(a));
assertEquals(undefined, get(a));
......@@ -233,20 +233,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=4034
'built-ins/ThrowTypeError/unique-per-realm-function-proto': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4902
'built-ins/TypedArray/prototype/byteLength/prop-desc': [FAIL],
'built-ins/TypedArray/prototype/byteOffset/prop-desc': [FAIL],
'built-ins/TypedArray/prototype/copyWithin/get-length-ignores-length-prop': [FAIL],
'built-ins/TypedArray/prototype/every/get-length-ignores-length-prop': [FAIL],
'built-ins/TypedArray/prototype/every/get-length-uses-internal-arraylength': [FAIL],
'built-ins/TypedArray/prototype/fill/get-length-ignores-length-prop': [FAIL],
'built-ins/TypedArray/prototype/find/get-length-ignores-length-prop': [FAIL],
'built-ins/TypedArray/prototype/findIndex/get-length-ignores-length-prop': [FAIL],
'built-ins/TypedArray/prototype/indexOf/get-length-uses-internal-arraylength': [FAIL],
'built-ins/TypedArray/prototype/lastIndexOf/get-length-uses-internal-arraylength': [FAIL],
'built-ins/TypedArray/prototype/length/prop-desc': [FAIL],
'built-ins/TypedArray/prototype/some/get-length-uses-internal-arraylength': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=4231
'language/eval-code/direct/var-env-lower-lex-catch-non-strict': [FAIL],
'language/statements/try/early-catch-lex': [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