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

Side by Side Diff: test/mjsunit/array-methods-read-only-length.js

Issue 737383002: Fix for 435073: CHECK failure in CHECK(p->IsSmi()) failed. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Another test. Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « src/hydrogen.cc ('k') | test/mjsunit/array-shift4.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Flags: --allow-natives-syntax 5 // Flags: --allow-natives-syntax
6 6
7 function testAdd(mode) { 7 function testAdd(mode) {
8 var a = []; 8 var a = [];
9 Object.defineProperty(a, "length", { writable : false}); 9 Object.defineProperty(a, "length", { writable : false});
10 10
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 check(splice); 44 check(splice);
45 check(splice); 45 check(splice);
46 %OptimizeFunctionOnNextCall(splice); 46 %OptimizeFunctionOnNextCall(splice);
47 check(splice); 47 check(splice);
48 } 48 }
49 49
50 testAdd("fast properties"); 50 testAdd("fast properties");
51 51
52 testAdd("normalized"); 52 testAdd("normalized");
53 53
54 function testRemove(mode) { 54 function testRemove(a, mode) {
55 var a = [1, 2, 3];
56 Object.defineProperty(a, "length", { writable : false}); 55 Object.defineProperty(a, "length", { writable : false});
57 56
58 function check(f) { 57 function check(f) {
59 assertThrows(function() { f(a) }, TypeError); 58 assertThrows(function() { f(a) }, TypeError);
60 assertEquals(3, a.length); 59 assertEquals(3, a.length);
61 } 60 }
62 61
63 if (mode == "fast properties") %ToFastProperties(a); 62 if (mode == "fast properties") %ToFastProperties(a);
64 63
65 function pop(a) { 64 function pop(a) {
(...skipping 18 matching lines...) Expand all
84 83
85 function splice(a) { 84 function splice(a) {
86 a.splice(0, 1); 85 a.splice(0, 1);
87 } 86 }
88 87
89 check(splice); 88 check(splice);
90 check(splice); 89 check(splice);
91 check(splice); 90 check(splice);
92 %OptimizeFunctionOnNextCall(splice); 91 %OptimizeFunctionOnNextCall(splice);
93 check(splice); 92 check(splice);
93
94 %ClearFunctionTypeFeedback(pop);
95 %ClearFunctionTypeFeedback(shift);
96 %ClearFunctionTypeFeedback(splice);
94 } 97 }
95 98
96 testRemove("fast properties"); 99 for (var i = 0; i < 3; i++) {
97 100 var a = [1, 2, 3];
98 testRemove("normalized"); 101 if (i == 1) {
102 a = [1, 2, 3.5];
103 } else if (i == 2) {
104 a = [1, 2, "string"];
105 }
106 testRemove(a, "fast properties");
107 testRemove(a, "normalized");
108 }
99 109
100 var b = []; 110 var b = [];
101 Object.defineProperty(b.__proto__, "0", { 111 Object.defineProperty(b.__proto__, "0", {
102 set : function(v) { 112 set : function(v) {
103 b.x = v; 113 b.x = v;
104 Object.defineProperty(b, "length", { writable : false }); 114 Object.defineProperty(b, "length", { writable : false });
105 }, 115 },
106 get: function() { 116 get: function() {
107 return b.x; 117 return b.x;
108 } 118 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 157 }
148 }); 158 });
149 159
150 try { 160 try {
151 b.unshift(3, 4, 5); 161 b.unshift(3, 4, 5);
152 } catch(e) { } 162 } catch(e) { }
153 163
154 assertFalse(2 in b); 164 assertFalse(2 in b);
155 assertFalse(3 in b); 165 assertFalse(3 in b);
156 assertEquals(2, b.length); 166 assertEquals(2, b.length);
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | test/mjsunit/array-shift4.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698