Commit bf20d7d1 authored by Victor Gomes's avatar Victor Gomes Committed by Commit Bot

[builtins] Reverse arguments order of TF builtins with JS linkage

Bug: v8:10201
Change-Id: Ie6dbd43ff776b7a5b777923d659edf3038783567
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2074498
Commit-Queue: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Auto-Submit: Victor Gomes <victorgomes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66463}
parent c626bc5e
......@@ -13,8 +13,20 @@
namespace v8 {
namespace internal {
#define REVERSE_0(a) a
#define REVERSE_1(a, b) b, a
#define REVERSE_2(a, b, c) c, b, a
#define REVERSE_3(a, b, c, d) d, c, b, a
#define REVERSE_4(a, b, c, d, e) e, d, c, b, a
#define REVERSE_5(a, b, c, d, e, f) f, e, d, c, b, a
#define REVERSE_6(a, b, c, d, e, f, g) g, f, e, d, c, b, a
#define REVERSE_7(a, b, c, d, e, f, g, h) h, g, f, e, d, c, b, a
#define REVERSE_8(a, b, c, d, e, f, g, h, i) i, h, g, f, e, d, c, b, a
#define REVERSE_kDontAdaptArgumentsSentinel(...)
#define REVERSE(N, ...) REVERSE_##N(__VA_ARGS__)
// Define interface descriptors for builtins with JS linkage.
#define DEFINE_TFJ_INTERFACE_DESCRIPTOR(Name, Argc, ...) \
#define DEFINE_TFJ_INTERFACE_DESCRIPTOR_HELPER(Name, Argc, ...) \
struct Builtin_##Name##_InterfaceDescriptor { \
enum ParameterIndices { \
kJSTarget = compiler::CodeAssembler::kTargetParameterIndex, \
......@@ -29,6 +41,14 @@ namespace internal {
static_assert(kJSTarget == -1, "Unexpected kJSTarget index value"); \
};
#ifdef V8_REVERSE_JSARGS
#define DEFINE_TFJ_INTERFACE_DESCRIPTOR(Name, Argc, ...) \
DEFINE_TFJ_INTERFACE_DESCRIPTOR_HELPER(Name, Argc, REVERSE(Argc, __VA_ARGS__))
#else
#define DEFINE_TFJ_INTERFACE_DESCRIPTOR(Name, Argc, ...) \
DEFINE_TFJ_INTERFACE_DESCRIPTOR_HELPER(Name, Argc, ##__VA_ARGS__)
#endif
// Define interface descriptors for builtins with StubCall linkage.
#define DEFINE_TFC_INTERFACE_DESCRIPTOR(Name, InterfaceDescriptor) \
using Builtin_##Name##_InterfaceDescriptor = InterfaceDescriptor##Descriptor;
......
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