Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: test/mjsunit/regress/regress-typedarray-length.js

Issue 1313493005: [accessors] second-chance typed array field lookup (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: last fixes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"));
« no previous file with comments | « src/accessors.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698