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

Side by Side Diff: test/mjsunit/regress/regress-447756.js

Issue 790813005: Map -0 to integer 0 for typed array constructors. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « src/runtime.js ('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
(Empty)
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
3 // found in the LICENSE file.
4 //
5 // Flags: --allow-natives-syntax
6
7 function TestConstructor(c) {
8 var a = new c(-0);
9 assertSame(Infinity, 1 / a.length);
10 assertSame(Infinity, 1 / a.byteLength);
11
12 var ab = new ArrayBuffer(-0);
13 assertSame(Infinity, 1 / ab.byteLength);
14
15 var a1 = new c(ab, -0, -0);
16 assertSame(Infinity, 1 / a1.length);
17 assertSame(Infinity, 1 / a1.byteLength);
18 assertSame(Infinity, 1 / a1.byteOffset);
19 }
20
21 var constructors =
22 [ Uint8Array, Int8Array, Uint8ClampedArray,
23 Uint16Array, Int16Array,
24 Uint32Array, Int32Array,
25 Float32Array, Float64Array ];
26 for (var i = 0; i < constructors.length; i++) {
27 TestConstructor(constructors[i]);
28 }
29
30
31 function TestOptimizedCode() {
32 var a = new Uint8Array(-0);
33 assertSame(Infinity, 1 / a.length);
34 assertSame(Infinity, 1 / a.byteLength);
35
36 var ab = new ArrayBuffer(-0);
37 assertSame(Infinity, 1 / ab.byteLength);
38
39 var a1 = new Uint8Array(ab, -0, -0);
40 assertSame(Infinity, 1 / a1.length);
41 assertSame(Infinity, 1 / a1.byteLength);
42 assertSame(Infinity, 1 / a1.byteOffset);
43 }
44
45 %OptimizeFunctionOnNextCall(Uint8Array);
46 for (var i = 0; i < 1000; i++) {
47 TestOptimizedCode();
48 }
OLDNEW
« no previous file with comments | « src/runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698