diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2015-06-19 13:23:56 +0200 |
---|---|---|
committer | Rod Vagg <rod@vagg.org> | 2015-08-04 11:56:14 -0700 |
commit | 70d1f32f5605465a1a630a64f6f0d35f96c7709d (patch) | |
tree | 0a349040a686eafcb0a09943ebc733477dce2781 /deps/v8/test/mjsunit/regress/regress-typedarray-length.js | |
parent | 4643b8b6671607a7aff60cbbd0b384dcf2f6959e (diff) | |
download | node-new-70d1f32f5605465a1a630a64f6f0d35f96c7709d.tar.gz |
deps: update v8 to 4.4.63.9
Upgrade the bundled V8 and update code in src/ and lib/ to the new API.
Notable backwards incompatible changes are the removal of the smalloc
module and dropped support for CESU-8 decoding. CESU-8 support can be
brought back if necessary by doing UTF-8 decoding ourselves.
This commit includes https://codereview.chromium.org/1192973004 to fix
a build error on python 2.6 systems. The original commit log follows:
Use optparse in js2c.py for python compatibility
Without this change, V8 won't build on RHEL/CentOS 6 because the
distro python is too old to know about the argparse module.
PR-URL: https://github.com/nodejs/io.js/pull/2022
Reviewed-By: Rod Vagg <rod@vagg.org>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'deps/v8/test/mjsunit/regress/regress-typedarray-length.js')
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-typedarray-length.js | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-typedarray-length.js b/deps/v8/test/mjsunit/regress/regress-typedarray-length.js new file mode 100644 index 0000000000..cae55731f9 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-typedarray-length.js @@ -0,0 +1,112 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var a = new Int32Array(100); +a.__proto__ = null; + +function get(a) { + return a.length; +} + +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(undefined, get(a)); + +get = function(a) { + return a.byteLength; +} + +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(undefined, get(a)); + +get = function(a) { + return a.byteOffset; +} + +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +assertEquals(undefined, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(undefined, get(a)); + +(function() { + "use strict"; + + class MyTypedArray extends Int32Array { + get length() { + return "length"; + } + } + + a = new MyTypedArray(); + + get = function(a) { + return a.length; + } + + assertEquals("length", get(a)); + assertEquals("length", get(a)); + assertEquals("length", get(a)); + %OptimizeFunctionOnNextCall(get); + assertEquals("length", get(a)); + + a.__proto__ = null; + + get = function(a) { + return a.length; + } + + assertEquals(undefined, get(a)); + assertEquals(undefined, get(a)); + assertEquals(undefined, get(a)); + %OptimizeFunctionOnNextCall(get); + assertEquals(undefined, get(a)); +})(); + +// Ensure we cannot delete length, byteOffset, byteLength. +assertTrue(Int32Array.prototype.hasOwnProperty("length")); +assertTrue(Int32Array.prototype.hasOwnProperty("byteOffset")); +assertTrue(Int32Array.prototype.hasOwnProperty("byteLength")); +assertFalse(delete Int32Array.prototype.length); +assertFalse(delete Int32Array.prototype.byteOffset); +assertFalse(delete Int32Array.prototype.byteLength); + +a = new Int32Array(100); + +get = function(a) { + return a.length; +} + +assertEquals(100, get(a)); +assertEquals(100, get(a)); +assertEquals(100, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(100, get(a)); + +get = function(a) { + return a.byteLength; +} + +assertEquals(400, get(a)); +assertEquals(400, get(a)); +assertEquals(400, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(400, get(a)); + +get = function(a) { + return a.byteOffset; +} + +assertEquals(0, get(a)); +assertEquals(0, get(a)); +assertEquals(0, get(a)); +%OptimizeFunctionOnNextCall(get); +assertEquals(0, get(a)); |