[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/+/3023006 Reviewed-by: Maya Lekova <mslekova@chromium.org> Reviewed-by: Camillo Bruni <cbruni@chromium.org> Commit-Queue: Paolo Severini <paolosev@microsoft.com> Cr-Commit-Position: refs/heads/master@{#75709}
This commit is contained in:
parent
1eb8770691
commit
0f9e9e2010
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user