Commit 0f9e9e20 authored by Paolo Severini's avatar Paolo Severini Committed by V8 LUCI CQ

[fastcall] Swap the template arguments in CopyAndConvertArrayToCppBuffer

For CopyAndConvertArrayToCppBuffer<T, type_info>(src, dst, length),
type `T` can be deducible from `dst`, but `type_info` cannot be
deducible so it's better to rewrite it as
CopyAndConvertArrayToCppBuffer<type_info, T>(src, dst, length).

Bug: v8:11739
Change-Id: Ic3a28671cf7576672dad2f21bf6acf87807c3b48
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3023006Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Paolo Severini <paolosev@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#75709}
parent 1eb87706
......@@ -782,7 +782,7 @@ using CFunctionBuilder = internal::CFunctionBuilder;
* to the requested destination type, is considered unsupported. The operation
* returns true on success. `type_info` will be used for conversions.
*/
template <typename T, const CTypeInfo* type_info>
template <const CTypeInfo* type_info, typename T>
bool CopyAndConvertArrayToCppBuffer(Local<Array> src, T* dst,
uint32_t max_length);
......
......@@ -263,7 +263,7 @@ void CopyDoubleElementsToTypedBuffer(T* dst, uint32_t length,
}
}
template <typename T, const CTypeInfo* type_info>
template <const CTypeInfo* type_info, typename T>
bool CopyAndConvertArrayToCppBuffer(Local<Array> src, T* dst,
uint32_t max_length) {
static_assert(
......
......@@ -120,7 +120,7 @@ class FastCApiObject {
Type buffer[1024];
bool result =
CopyAndConvertArrayToCppBuffer<Type, &type_info>(seq_arg, buffer, 1024);
CopyAndConvertArrayToCppBuffer<&type_info, Type>(seq_arg, buffer, 1024);
if (!result) {
options.fallback = 1;
return 0;
......@@ -168,7 +168,7 @@ class FastCApiObject {
}
Type buffer[1024];
bool result =
CopyAndConvertArrayToCppBuffer<Type, &type_info>(seq_arg, buffer, 1024);
CopyAndConvertArrayToCppBuffer<&type_info, Type>(seq_arg, buffer, 1024);
if (!result) {
isolate->ThrowError("Array conversion unsuccessful.");
return;
......
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