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

Side by Side Diff: test/mjsunit/es6/typedarray-fill.js

Issue 2769673002: Move Oddball/String to %Typearray%.prototype.fill fast path (Closed)
Patch Set: Created 3 years, 9 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 unified diff | Download patch
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 var typedArrayConstructors = [ 5 var typedArrayConstructors = [
6 Uint8Array, 6 Uint8Array,
7 Int8Array, 7 Int8Array,
8 Uint16Array, 8 Uint16Array,
9 Int16Array, 9 Int16Array,
10 Uint32Array, 10 Uint32Array,
(...skipping 22 matching lines...) Expand all
33 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(8, In finity)); 33 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(8, In finity));
34 assertArrayEquals([8, 8, 8, 8, 8], new constructor([0, 0, 0, 0, 0]).fill(8, -I nfinity)); 34 assertArrayEquals([8, 8, 8, 8, 8], new constructor([0, 0, 0, 0, 0]).fill(8, -I nfinity));
35 assertArrayEquals([8, 8, 8, 8, 8], new constructor([0, 0, 0, 0, 0]).fill(8, 0, Infinity)); 35 assertArrayEquals([8, 8, 8, 8, 8], new constructor([0, 0, 0, 0, 0]).fill(8, 0, Infinity));
36 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(8, 0, -Infinity)); 36 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(8, 0, -Infinity));
37 37
38 // Test exceptions 38 // Test exceptions
39 assertThrows('constructor.prototype.fill.call(null)', TypeError); 39 assertThrows('constructor.prototype.fill.call(null)', TypeError);
40 assertThrows('constructor.prototype.fill.call(undefined)', TypeError); 40 assertThrows('constructor.prototype.fill.call(undefined)', TypeError);
41 assertThrows('constructor.prototype.fill.call([])', TypeError); 41 assertThrows('constructor.prototype.fill.call([])', TypeError);
42 42
43 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(false ));
44 assertArrayEquals([1, 1, 1, 1, 1], new constructor([0, 0, 0, 0, 0]).fill(true) );
45 assertArrayEquals([0, 0, 0, 0, 0], new constructor([0, 0, 0, 0, 0]).fill(null) );
Camillo Bruni 2017/03/22 21:26:50 please add the same for undefined :)
rongjie 2017/03/23 00:01:49 Done.
46
43 // Test ToNumber 47 // Test ToNumber
44 var s = ""; 48 var s = "";
45 var p = new Proxy({}, {get(t,k) { s += k.toString() + '\n'; return Reflect.get (t, k)}}) 49 var p = new Proxy({}, {get(t,k) { s += k.toString() + '\n'; return Reflect.get (t, k)}})
46 new constructor(3).fill(p); 50 new constructor(3).fill(p);
47 assertEquals(s, `Symbol(Symbol.toPrimitive) 51 assertEquals(s, `Symbol(Symbol.toPrimitive)
48 valueOf 52 valueOf
49 toString 53 toString
50 Symbol(Symbol.toStringTag) 54 Symbol(Symbol.toStringTag)
51 Symbol(Symbol.toPrimitive) 55 Symbol(Symbol.toPrimitive)
52 valueOf 56 valueOf
(...skipping 25 matching lines...) Expand all
78 assertArrayEquals([1, 1, 1, 1, 1], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .50001)); 82 assertArrayEquals([1, 1, 1, 1, 1], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .50001));
79 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .50000)); 83 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .50000));
80 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .49999)); 84 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(0 .49999));
81 // Check round half to even 85 // Check round half to even
82 assertArrayEquals([2, 2, 2, 2, 2], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(1 .50000)); 86 assertArrayEquals([2, 2, 2, 2, 2], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(1 .50000));
83 assertArrayEquals([2, 2, 2, 2, 2], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(2 .50000)); 87 assertArrayEquals([2, 2, 2, 2, 2], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(2 .50000));
84 assertArrayEquals([3, 3, 3, 3, 3], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(2 .50001)); 88 assertArrayEquals([3, 3, 3, 3, 3], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(2 .50001));
85 // Check infinity clamping. 89 // Check infinity clamping.
86 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(- Infinity)); 90 assertArrayEquals([0, 0, 0, 0, 0], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(- Infinity));
87 assertArrayEquals([255, 255, 255, 255, 255], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(Infinity)); 91 assertArrayEquals([255, 255, 255, 255, 255], new Uint8ClampedArray([0, 0, 0, 0, 0]).fill(Infinity));
OLDNEW
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698