blob: 375ad406eaa8185e73f243db0c703c3a3c6e0c56 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// 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
3// found in the LICENSE file.
4
5(function() {
6 function store(x) { x[0] = 0; }
7 store([]);
8 var c = /x/;
9 store(c);
10 function get_hole() {
11 var b = /x/;
12 store(b);
13 return b[1];
14 }
15 assertEquals(undefined, get_hole());
16 assertEquals(undefined, get_hole());
17})();
18
19(function() {
20 function store(x) { x[0] = 0; }
21 store([]);
22 var c = new Date();
23 store(c);
24 function get_hole() {
25 var b = new Date();
26 store(b);
27 return b[1];
28 }
29 assertEquals(undefined, get_hole());
30 assertEquals(undefined, get_hole());
31})();
32
33(function() {
34 function store(x) { x[0] = 0; }
35 store([]);
36 var c = new Number(1);
37 store(c);
38 function get_hole() {
39 var b = new Number(1);
40 store(b);
41 return b[1];
42 }
43 assertEquals(undefined, get_hole());
44 assertEquals(undefined, get_hole());
45})();
46
47(function() {
48 function store(x) { x[0] = 0; }
49 store([]);
50 var c = new Boolean();
51 store(c);
52 function get_hole() {
53 var b = new Boolean();
54 store(b);
55 return b[1];
56 }
57 assertEquals(undefined, get_hole());
58 assertEquals(undefined, get_hole());
59})();
60
61(function() {
62 function store(x) { x[0] = 0; }
63 store([]);
64 var c = new Map();
65 store(c);
66 function get_hole() {
67 var b = new Map();
68 store(b);
69 return b[1];
70 }
71 assertEquals(undefined, get_hole());
72 assertEquals(undefined, get_hole());
73})();
74
75(function() {
76 function store(x) { x[0] = 0; }
77 store([]);
78 var c = new Set();
79 store(c);
80 function get_hole() {
81 var b = new Set();
82 store(b);
83 return b[1];
84 }
85 assertEquals(undefined, get_hole());
86 assertEquals(undefined, get_hole());
87})();
88
89(function() {
90 function store(x) { x[0] = 0; }
91 store([]);
92 var c = new WeakMap();
93 store(c);
94 function get_hole() {
95 var b = new WeakMap();
96 store(b);
97 return b[1];
98 }
99 assertEquals(undefined, get_hole());
100 assertEquals(undefined, get_hole());
101})();
102
103(function() {
104 function store(x) { x[0] = 0; }
105 store([]);
106 var c = new WeakSet();
107 store(c);
108 function get_hole() {
109 var b = new WeakSet();
110 store(b);
111 return b[1];
112 }
113 assertEquals(undefined, get_hole());
114 assertEquals(undefined, get_hole());
115})();