Index: test/mjsunit/regress/regress-typedarray-length.js |
diff --git a/test/mjsunit/regress/regress-typedarray-length.js b/test/mjsunit/regress/regress-typedarray-length.js |
index cae55731f921ced9e26218d1b47631867aa71c30..ee853647355215485aaf1d1bbcba463ca83234a2 100644 |
--- a/test/mjsunit/regress/regress-typedarray-length.js |
+++ b/test/mjsunit/regress/regress-typedarray-length.js |
@@ -71,6 +71,43 @@ assertEquals(undefined, get(a)); |
assertEquals(undefined, get(a)); |
})(); |
+(function() { |
+ "use strict"; |
+ |
+ class MyTypedArray extends Int32Array { |
+ constructor(length) { |
+ super(length); |
+ } |
+ } |
+ |
+ a = new MyTypedArray(1024); |
+ |
+ get = function(a) { |
+ return a.length; |
+ } |
+ |
+ assertEquals(1024, get(a)); |
+ assertEquals(1024, get(a)); |
+ assertEquals(1024, get(a)); |
+ %OptimizeFunctionOnNextCall(get); |
+ assertEquals(1024, get(a)); |
+})(); |
+ |
+(function() { |
+ "use strict"; |
+ var a = new Uint8Array(4); |
+ Object.defineProperty(a, "length", {get: function() { return "blah"; }}); |
+ get = function(a) { |
+ return a.length; |
+ } |
+ |
+ assertEquals("blah", get(a)); |
+ assertEquals("blah", get(a)); |
+ assertEquals("blah", get(a)); |
+ %OptimizeFunctionOnNextCall(get); |
+ assertEquals("blah", get(a)); |
+})(); |
+ |
// Ensure we cannot delete length, byteOffset, byteLength. |
assertTrue(Int32Array.prototype.hasOwnProperty("length")); |
assertTrue(Int32Array.prototype.hasOwnProperty("byteOffset")); |