Commit ae0a6f4b authored by Franziska Hinkelmann's avatar Franziska Hinkelmann Committed by Commit Bot

Add benchmark for TypedArray.prototype.set

Add benchmark for TypedArray.prototype.set when
setting from another TypedArray with the same type.

Bug: v8:6704
Change-Id: Ibde60b17aa32fb9c8237b2ab766d2b2913e256d7
Reviewed-on: https://chromium-review.googlesource.com/613264Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Franziska Hinkelmann <franzih@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47342}
parent 6917f9a5
......@@ -317,6 +317,7 @@ function TypedArraySetFromOverlappingTypedArray(target, source, offset) {
}
}
// 22.2.3.23%TypedArray%.prototype.set ( overloaded [ , offset ] )
DEFINE_METHOD_LEN(
GlobalTypedArray.prototype,
set(obj, offset) {
......@@ -328,7 +329,7 @@ DEFINE_METHOD_LEN(
}
switch (%TypedArraySetFastCases(this, obj, intOffset)) {
// These numbers should be synchronized with runtime.cc.
// These numbers should be synchronized with runtime-typedarray.cc.
case 0: // TYPED_ARRAY_SET_TYPED_ARRAY_SAME_TYPE
return;
case 1: // TYPED_ARRAY_SET_TYPED_ARRAY_OVERLAPPING
......
......@@ -331,6 +331,12 @@
"resources": ["construct-all-typedarrays.js"],
"test_flags": ["construct-all-typedarrays"]
},
{
"name": "SetFromSameType",
"main": "run.js",
"resources": ["set-from-same-type.js"],
"test_flags": ["set-from-same-type"]
},
{
"name": "Sort",
"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('SetFromSameType', [1000], [
new Benchmark('SetFromSameType', false, false, 0, SetFromSameType),
]);
let src = [1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4];
let typed_src = new Float32Array(src);
let typed_dest = new Float32Array(16);
function SetFromSameType() {
typed_dest.set(typed_src);
}
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