Commit 1c8760c6 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[Tests] Add a test for constructing a TypedArray from the same kind.

This should be the fastest case, as we can just copy the backing store
directly. Adding this test so that we can monitor if upcoming changes
regress this path.

BUG=v8:5977

Change-Id: I021a199061ac845f265a906bda68b7ad3e8d5708
Reviewed-on: https://chromium-review.googlesource.com/461183Reviewed-by: 's avatarFranziska Hinkelmann <franzih@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44225}
parent 51ef3212
...@@ -333,6 +333,11 @@ ...@@ -333,6 +333,11 @@
"main": "run.js", "main": "run.js",
"test_flags": ["construct-typedarray"] "test_flags": ["construct-typedarray"]
}, },
{
"name": "ConstructBySameTypedArray",
"main": "run.js",
"test_flags": ["construct-same-typedarray"]
},
{ {
"name": "Sort", "name": "Sort",
"main": "run.js", "main": "run.js",
......
// 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.
new BenchmarkSuite('ConstructBySameTypedArray', [1000], [
new Benchmark('ConstructBySameTypedArray', false, false, 0, constructor),
]);
const length = 1024;
let arr = new Uint8Array(length);
for (var i = 0; i < length; i++) {
arr[i] = i;
}
function constructor() {
new Uint8Array(arr);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment