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

Side by Side Diff: test/mjsunit/external-array.js

Issue 6903060: Version 3.3.2.... (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 // "constant", but not read-only). 56 // "constant", but not read-only).
57 a = new Int32Array(2); 57 a = new Int32Array(2);
58 assertEquals(4, a.BYTES_PER_ELEMENT); 58 assertEquals(4, a.BYTES_PER_ELEMENT);
59 a.BYTES_PER_ELEMENT = 42; 59 a.BYTES_PER_ELEMENT = 42;
60 assertEquals(42, a.BYTES_PER_ELEMENT); 60 assertEquals(42, a.BYTES_PER_ELEMENT);
61 a = new Uint8Array(2); 61 a = new Uint8Array(2);
62 assertEquals(1, a.BYTES_PER_ELEMENT); 62 assertEquals(1, a.BYTES_PER_ELEMENT);
63 a = new Int16Array(2); 63 a = new Int16Array(2);
64 assertEquals(2, a.BYTES_PER_ELEMENT); 64 assertEquals(2, a.BYTES_PER_ELEMENT);
65 65
66 // Test Float64Arrays.
67 function get(a, index) {
68 return a[index];
69 }
70 function set(a, index, value) {
71 a[index] = value;
72 }
73
74 var array = new Float64Array(2);
75 for (var i = 0; i < 5; i++) {
76 set(array, 0, 2.5);
77 assertEquals(2.5, array[0]);
78 }
79 %OptimizeFunctionOnNextCall(set);
80 set(array, 0, 2.5);
81 assertEquals(2.5, array[0]);
82 set(array, 1, 3.5);
83 assertEquals(3.5, array[1]);
84 for (var i = 0; i < 5; i++) {
85 assertEquals(2.5, get(array, 0));
86 assertEquals(3.5, array[1]);
87 }
88 %OptimizeFunctionOnNextCall(get);
89 assertEquals(2.5, get(array, 0));
90 assertEquals(3.5, get(array, 1));
OLDNEW
« no previous file with comments | « test/mjsunit/array-functions-prototype-misc.js ('k') | test/mjsunit/global-load-from-eval-in-with.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698