Ben Murdoch | b8a8cc1 | 2014-11-26 15:28:44 +0000 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | // |
| 5 | // Flags: --typed-array-max-size-in-heap=64 |
| 6 | |
| 7 | function TestArray(constructor) { |
| 8 | function Check(a) { |
| 9 | a[0] = ""; |
| 10 | assertEquals(0, a[0]); |
| 11 | a[0] = {}; |
| 12 | assertEquals(0, a[0]); |
| 13 | a[0] = { valueOf : function() { return 27; } }; |
| 14 | assertEquals(27, a[0]); |
| 15 | } |
| 16 | Check(new constructor(1)); |
| 17 | Check(new constructor(100)); |
| 18 | } |
| 19 | |
| 20 | TestArray(Uint8Array); |