diff --git a/src/js/typedarray.js b/src/js/typedarray.js index caced99321..2ec10d9ef9 100644 --- a/src/js/typedarray.js +++ b/src/js/typedarray.js @@ -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 diff --git a/test/js-perf-test/JSTests.json b/test/js-perf-test/JSTests.json index a9cd6eba78..cd67b915f6 100644 --- a/test/js-perf-test/JSTests.json +++ b/test/js-perf-test/JSTests.json @@ -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", diff --git a/test/js-perf-test/TypedArrays/set-from-same-type.js b/test/js-perf-test/TypedArrays/set-from-same-type.js new file mode 100644 index 0000000000..058c63e34a --- /dev/null +++ b/test/js-perf-test/TypedArrays/set-from-same-type.js @@ -0,0 +1,17 @@ +// 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); +}