Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / js / script-tests / dfg-byte-array-put.js
blob82853e9066d2fabfcb324cb52a5dec367ef7b01e
1 description(
2 "This tests that the DFG JIT's optimizations for byte arrays work as expected."
3 );
5 function doPut(array, index, value) {
6 array[index] = value;
9 function doGet(array, index) {
10 return array[index];
13 canvas = document.createElement("canvas");
14 context = canvas.getContext("2d");
15 imageData = context.createImageData(10,10);
16 data = imageData.data;
18 shouldBe("data.length", "400");
20 for (var i = 0; i < 1000; ++i) {
21 doPut(data, i % 100, i - 100);
22 var expectedValue;
23 if (i < 100)
24 expectedValue = 0;
25 else if (i > 355)
26 expectedValue = 255;
27 else
28 expectedValue = i - 100;
29 shouldBe("doGet(data, " + (i % 100) + ")", "" + expectedValue);
32 var successfullyParsed = true;