v8/test/mjsunit/regress/regress-718285.js
Peter Marshall 4d611d1dc3 [builtins] Use the byte_length for byte length, not byte_offset.
length != offset.

Bug: chromium:718285
Change-Id: I150af1473cb5180c242f3817b940fa1cf1c49cea
Reviewed-on: https://chromium-review.googlesource.com/497727
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45121}
2017-05-05 09:57:17 +00:00

47 lines
1.0 KiB
JavaScript

// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
function foo_reference(n) {
var array = new Int32Array(n + 1);
for (var i = 0; i < n; ++i) {
array[i] = i;
}
var array2 = new Int32Array(array);
array2.set(new Uint8Array(array.buffer, 0, n), 1);
return array2;
}
function foo(n) {
var array = new Int32Array(n + 1);
for (var i = 0; i < n; ++i) {
array[i] = i;
}
array.set(new Uint8Array(array.buffer, 0, n), 1);
return array;
}
function bar_reference(n) {
var array = new Int32Array(n + 1);
for (var i = 0; i < n; ++i) {
array[i] = i;
}
var array2 = new Int32Array(array);
array2.set(new Uint8Array(array.buffer, 34), 0);
return array2;
}
function bar(n) {
var array = new Int32Array(n + 1);
for (var i = 0; i < n; ++i) {
array[i] = i;
}
array.set(new Uint8Array(array.buffer, 34), 0);
return array;
}
foo(10);
foo_reference(10);
bar(10);
bar_reference(10);