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

Unified Diff: test/mjsunit/regress/regress-crbug-618788.js

Issue 2090193002: Array splice should only normalize deleted_elements if it's an array (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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/js/array.js ('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-crbug-618788.js
diff --git a/test/mjsunit/regress/regress-crbug-618788.js b/test/mjsunit/regress/regress-crbug-618788.js
index 6e49ec2f503762b7fc5f969caf46edb510f970d8..a104d8d39ed09a5f5bcd1b9092a1828f811ea249 100644
--- a/test/mjsunit/regress/regress-crbug-618788.js
+++ b/test/mjsunit/regress/regress-crbug-618788.js
@@ -2,7 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var a = new Array();
-a.constructor = Int32Array;
-a.length = 1000; // Make the length >= 1000 so UseSparseVariant returns true.
-assertThrows(() => a.slice());
+// Slice and splice both try to set the length property of their return
+// value. Add a bogus setter to allow that.
+Object.defineProperty(Int32Array.prototype, 'length', { set(v) { } });
+
+(function testSlice() {
+ var a = new Array();
+ a.constructor = Int32Array;
+ a.length = 1000; // Make the length >= 1000 so UseSparseVariant returns true.
+ assertTrue(a.slice() instanceof Int32Array);
+})();
+
+(function testSplice() {
+ var a = new Array();
+ a.constructor = Int32Array;
+ a.length = 1000; // Make the length >= 1000 so UseSparseVariant returns true.
+ assertTrue(a.splice(1) instanceof Int32Array);
+})();
« no previous file with comments | « src/js/array.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698