66856bacdc
This is a reland of 84d5b027a7
It removes support for 8-byte types which were causing
unaligned reads.
Original change's description:
> [fastcall] Implement support for TypedArray arguments
>
> This CL adds TypedArrays as supported arguments for fast API calls.
> It implements "exact type" matching, i.e. if Float32Array is expected
> and e.g. Int32Array is passed instead, the generated code bails to the
> slow callback.
>
> Bug: chromium:1052746, chromium:1018624
> Change-Id: I01d4e681d2b367cbb57b06effcb591c090a23295
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2999094
> Commit-Queue: Maya Lekova <mslekova@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Reviewed-by: Camillo Bruni <cbruni@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#75756}
Bug: chromium:1052746, chromium:1018624
Change-Id: I872716d95bde8c340cf04990a3e4ae8ec8cd74a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3035090
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Maya Lekova <mslekova@chromium.org>
Cr-Commit-Position: refs/heads/master@{#75877}
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
// Copyright 2021 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.
|
|
|
|
// Flags: --turbo-fast-api-calls --allow-natives-syntax --opt
|
|
|
|
// Helper for sequence tests.
|
|
function optimize_and_check(func, fast_count, slow_count, expected) {
|
|
%PrepareFunctionForOptimization(func);
|
|
let result = func();
|
|
assertEqualsDelta(expected, result, 0.001);
|
|
|
|
fast_c_api.reset_counts();
|
|
%OptimizeFunctionOnNextCall(func);
|
|
result = func();
|
|
assertEqualsDelta(expected, result, 0.001);
|
|
assertOptimized(func);
|
|
assertEquals(fast_count, fast_c_api.fast_call_count());
|
|
assertEquals(slow_count, fast_c_api.slow_call_count());
|
|
}
|
|
|
|
function ExpectFastCall(func, expected) {
|
|
optimize_and_check(func, 1, 0, expected);
|
|
}
|
|
|
|
function ExpectSlowCall(func, expected) {
|
|
optimize_and_check(func, 0, 1, expected);
|
|
}
|
|
|
|
function assert_throws_and_optimized(func, arg) {
|
|
fast_c_api.reset_counts();
|
|
assertThrows(() => func(arg));
|
|
assertOptimized(func);
|
|
assertEquals(0, fast_c_api.fast_call_count());
|
|
assertEquals(1, fast_c_api.slow_call_count());
|
|
}
|