Commit c8c55fa6 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

Make CallInterfaceDescriptor the source of truth about presence of context parameter.

Bug: v8:7754
Change-Id: I6e1461d5e4214b5649f850166c3a988019098465
Reviewed-on: https://chromium-review.googlesource.com/1110126
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#53958}
parent fc98eff9
......@@ -27,15 +27,15 @@ class Flags final {
typedef T flag_type;
typedef S mask_type;
Flags() : mask_(0) {}
Flags(flag_type flag) // NOLINT(runtime/explicit)
constexpr Flags() : mask_(0) {}
constexpr Flags(flag_type flag) // NOLINT(runtime/explicit)
: mask_(static_cast<S>(flag)) {}
explicit Flags(mask_type mask) : mask_(static_cast<S>(mask)) {}
constexpr explicit Flags(mask_type mask) : mask_(static_cast<S>(mask)) {}
bool operator==(flag_type flag) const {
constexpr bool operator==(flag_type flag) const {
return mask_ == static_cast<S>(flag);
}
bool operator!=(flag_type flag) const {
constexpr bool operator!=(flag_type flag) const {
return mask_ != static_cast<S>(flag);
}
......@@ -52,22 +52,34 @@ class Flags final {
return *this;
}
Flags operator&(const Flags& flags) const { return Flags(*this) &= flags; }
Flags operator|(const Flags& flags) const { return Flags(*this) |= flags; }
Flags operator^(const Flags& flags) const { return Flags(*this) ^= flags; }
constexpr Flags operator&(const Flags& flags) const {
return Flags(*this) &= flags;
}
constexpr Flags operator|(const Flags& flags) const {
return Flags(*this) |= flags;
}
constexpr Flags operator^(const Flags& flags) const {
return Flags(*this) ^= flags;
}
Flags& operator&=(flag_type flag) { return operator&=(Flags(flag)); }
Flags& operator|=(flag_type flag) { return operator|=(Flags(flag)); }
Flags& operator^=(flag_type flag) { return operator^=(Flags(flag)); }
Flags operator&(flag_type flag) const { return operator&(Flags(flag)); }
Flags operator|(flag_type flag) const { return operator|(Flags(flag)); }
Flags operator^(flag_type flag) const { return operator^(Flags(flag)); }
constexpr Flags operator&(flag_type flag) const {
return operator&(Flags(flag));
}
constexpr Flags operator|(flag_type flag) const {
return operator|(Flags(flag));
}
constexpr Flags operator^(flag_type flag) const {
return operator^(Flags(flag));
}
Flags operator~() const { return Flags(~mask_); }
constexpr Flags operator~() const { return Flags(~mask_); }
operator mask_type() const { return mask_; }
bool operator!() const { return !mask_; }
constexpr operator mask_type() const { return mask_; }
constexpr bool operator!() const { return !mask_; }
friend size_t hash_value(const Flags& flags) { return flags.mask_; }
......
......@@ -1206,7 +1206,7 @@ namespace internal {
TFC(WasmArgumentsAdaptor, ArgumentAdaptor, 1) \
TFC(WasmCallJavaScript, CallTrampoline, 1) \
TFC(WasmGrowMemory, WasmGrowMemory, 1) \
TFS(WasmStackGuard) \
TFC(WasmStackGuard, NoContext, 1) \
TFC(WasmToNumber, TypeConversion, 1) \
TFS(ThrowWasmTrapUnreachable) \
TFS(ThrowWasmTrapMemOutOfBounds) \
......
......@@ -50,9 +50,8 @@ class WasmBuiltinsAssembler : public CodeStubAssembler {
};
TF_BUILTIN(WasmAllocateHeapNumber, WasmBuiltinsAssembler) {
TNode<Object> context = UncheckedParameter(Descriptor::kContext);
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kAllocateHeapNumber);
TailCallStub(AllocateHeapNumberDescriptor(), target, context);
TailCallStub(AllocateHeapNumberDescriptor(), target, NoContextConstant());
}
TF_BUILTIN(WasmArgumentsAdaptor, WasmBuiltinsAssembler) {
......
......@@ -1142,9 +1142,9 @@ void CodeAssembler::TailCallRuntimeWithCEntryImpl(
Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
size_t result_size, int input_count,
Node* const* inputs, bool pass_context) {
Node* const* inputs) {
// implicit nodes are target and optionally context.
int implicit_nodes = pass_context ? 2 : 1;
int implicit_nodes = descriptor.HasContextParameter() ? 2 : 1;
DCHECK_LE(implicit_nodes, input_count);
int argc = input_count - implicit_nodes;
DCHECK_LE(descriptor.GetParameterCount(), argc);
......@@ -1152,10 +1152,10 @@ Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
int stack_parameter_count = argc - descriptor.GetRegisterParameterCount();
DCHECK_LE(descriptor.GetStackParameterCount(), stack_parameter_count);
DCHECK_EQ(result_size, descriptor.GetReturnCount());
auto call_descriptor = Linkage::GetStubCallDescriptor(
zone(), descriptor, stack_parameter_count, CallDescriptor::kNoFlags,
Operator::kNoProperties,
pass_context ? Linkage::kPassContext : Linkage::kNoContext);
Operator::kNoProperties);
CallPrologue();
Node* return_value =
......@@ -1177,7 +1177,9 @@ void CodeAssembler::TailCallStubImpl(const CallInterfaceDescriptor& descriptor,
NodeArray<kMaxNumArgs + 2> inputs;
inputs.Add(target);
for (auto arg : args) inputs.Add(arg);
inputs.Add(context);
if (descriptor.HasContextParameter()) {
inputs.Add(context);
}
raw_assembler()->TailCallN(call_descriptor, inputs.size(), inputs.data());
}
......@@ -1192,10 +1194,11 @@ Node* CodeAssembler::CallStubRImpl(const CallInterfaceDescriptor& descriptor,
NodeArray<kMaxNumArgs + 2> inputs;
inputs.Add(target);
for (auto arg : args) inputs.Add(arg);
if (context) inputs.Add(context);
if (descriptor.HasContextParameter()) {
inputs.Add(context);
}
return CallStubN(descriptor, result_size, inputs.size(), inputs.data(),
context != nullptr);
return CallStubN(descriptor, result_size, inputs.size(), inputs.data());
}
Node* CodeAssembler::TailCallStubThenBytecodeDispatchImpl(
......
......@@ -1050,8 +1050,7 @@ class V8_EXPORT_PRIVATE CodeAssembler {
}
Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size,
int input_count, Node* const* inputs,
bool pass_context = true);
int input_count, Node* const* inputs);
template <class... TArgs>
void TailCallStub(Callable const& callable, SloppyTNode<Object> context,
......
......@@ -2910,8 +2910,7 @@ Reduction JSCallReducer::ReduceCallApiFunction(
auto call_descriptor = Linkage::GetStubCallDescriptor(
graph()->zone(), cid,
cid.GetStackParameterCount() + argc + 1 /* implicit receiver */,
CallDescriptor::kNeedsFrameState, Operator::kNoProperties,
Linkage::kNoContext);
CallDescriptor::kNeedsFrameState);
ApiFunction api_function(v8::ToCData<Address>(call_handler_info->callback()));
Node* holder = lookup == CallOptimization::kHolderFound
? jsgraph()->HeapConstant(api_holder)
......
......@@ -1766,8 +1766,7 @@ Node* JSNativeContextSpecialization::InlineApiCall(
graph()->zone(), call_interface_descriptor,
call_interface_descriptor.GetStackParameterCount() + argc +
1 /* implicit receiver */,
CallDescriptor::kNeedsFrameState, Operator::kNoProperties,
Linkage::kNoContext);
CallDescriptor::kNeedsFrameState);
Node* data = jsgraph()->Constant(call_data_object);
ApiFunction function(v8::ToCData<Address>(call_handler_info->callback()));
......
......@@ -340,18 +340,15 @@ CallDescriptor* Linkage::GetJSCallDescriptor(Zone* zone, bool is_osr,
"js-call");
}
// TODO(all): Add support for return representations/locations to
// CallInterfaceDescriptor.
// TODO(turbofan): cache call descriptors for code stub calls.
CallDescriptor* Linkage::GetStubCallDescriptor(
Zone* zone, const CallInterfaceDescriptor& descriptor,
int stack_parameter_count, CallDescriptor::Flags flags,
Operator::Properties properties, Linkage::ContextSpecification context_spec,
StubCallMode stub_mode) {
Operator::Properties properties, StubCallMode stub_mode) {
const int register_parameter_count = descriptor.GetRegisterParameterCount();
const int js_parameter_count =
register_parameter_count + stack_parameter_count;
const int context_count = context_spec == kPassContext ? 1 : 0;
const int context_count = descriptor.HasContextParameter() ? 1 : 0;
const size_t parameter_count =
static_cast<size_t>(js_parameter_count + context_count);
......
......@@ -366,8 +366,6 @@ V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
// Call[BytecodeDispatch] address, arg 1, arg 2, [...]
class V8_EXPORT_PRIVATE Linkage : public NON_EXPORTED_BASE(ZoneObject) {
public:
enum ContextSpecification { kNoContext, kPassContext };
explicit Linkage(CallDescriptor* incoming) : incoming_(incoming) {}
static CallDescriptor* ComputeIncoming(Zone* zone,
......@@ -393,7 +391,6 @@ class V8_EXPORT_PRIVATE Linkage : public NON_EXPORTED_BASE(ZoneObject) {
Zone* zone, const CallInterfaceDescriptor& descriptor,
int stack_parameter_count, CallDescriptor::Flags flags,
Operator::Properties properties = Operator::kNoProperties,
ContextSpecification context_spec = kPassContext,
StubCallMode stub_mode = StubCallMode::kCallOnHeapBuiltin);
static CallDescriptor* GetBytecodeDispatchCallDescriptor(
......
......@@ -238,8 +238,7 @@ void MemoryOptimizer::VisitAllocateRaw(Node* node,
if (!allocate_operator_.is_set()) {
auto call_descriptor = Linkage::GetStubCallDescriptor(
graph()->zone(), AllocateDescriptor{}, 0,
CallDescriptor::kCanUseRoots, Operator::kNoThrow,
Linkage::kNoContext);
CallDescriptor::kCanUseRoots, Operator::kNoThrow);
allocate_operator_.set(common()->Call(call_descriptor));
}
Node* vfalse = __ Call(allocate_operator_.get(), target, size);
......@@ -295,8 +294,7 @@ void MemoryOptimizer::VisitAllocateRaw(Node* node,
if (!allocate_operator_.is_set()) {
auto call_descriptor = Linkage::GetStubCallDescriptor(
graph()->zone(), AllocateDescriptor{}, 0,
CallDescriptor::kCanUseRoots, Operator::kNoThrow,
Linkage::kNoContext);
CallDescriptor::kCanUseRoots, Operator::kNoThrow);
allocate_operator_.set(common()->Call(call_descriptor));
}
__ Goto(&done, __ Call(allocate_operator_.get(), target, size));
......
......@@ -266,11 +266,10 @@ void WasmGraphBuilder::StackCheck(wasm::WasmCodePosition position,
// representing the stack check code.
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), // zone
WasmStackGuardDescriptor{}, // descriptor
NoContextDescriptor{}, // descriptor
0, // stack parameter count
CallDescriptor::kNoFlags, // flags
Operator::kNoProperties, // properties
Linkage::kNoContext, // context specification
StubCallMode::kCallWasmRuntimeStub); // stub call mode
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
......@@ -2017,7 +2016,6 @@ Node* WasmGraphBuilder::GrowMemory(Node* input) {
interface_descriptor.GetStackParameterCount(), // stack parameter count
CallDescriptor::kNoFlags, // flags
Operator::kNoProperties, // properties
Linkage::kNoContext, // context specification
StubCallMode::kCallWasmRuntimeStub); // stub call mode
// A direct call to a wasm runtime stub defined in this module.
// Just encode the stub index. This will be patched at relocation.
......@@ -4030,8 +4028,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
if (!allocate_heap_number_operator_.is_set()) {
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), AllocateHeapNumberDescriptor(), 0,
CallDescriptor::kNoFlags, Operator::kNoThrow, Linkage::kNoContext,
stub_mode_);
CallDescriptor::kNoFlags, Operator::kNoThrow, stub_mode_);
allocate_heap_number_operator_.set(common->Call(call_descriptor));
}
Node* heap_number = graph()->NewNode(allocate_heap_number_operator_.get(),
......@@ -4191,9 +4188,8 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
Node* BuildJavaScriptToNumber(Node* node, Node* js_context) {
auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), TypeConversionDescriptor(), 0,
CallDescriptor::kNoFlags, Operator::kNoProperties,
Linkage::kPassContext, stub_mode_);
mcgraph()->zone(), TypeConversionDescriptor{}, 0,
CallDescriptor::kNoFlags, Operator::kNoProperties, stub_mode_);
Node* stub_code =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant(
......@@ -4513,7 +4509,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), ArgumentAdaptorDescriptor{}, 1 + wasm_count,
CallDescriptor::kNoFlags, Operator::kNoProperties,
Linkage::kPassContext, StubCallMode::kCallWasmRuntimeStub);
StubCallMode::kCallWasmRuntimeStub);
// Convert wasm numbers to JS values.
pos = AddArgumentNodes(args, pos, wasm_count, sig_);
......@@ -4538,7 +4534,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
call_descriptor = Linkage::GetStubCallDescriptor(
graph()->zone(), CallTrampolineDescriptor{}, wasm_count + 1,
CallDescriptor::kNoFlags, Operator::kNoProperties,
Linkage::kPassContext, StubCallMode::kCallWasmRuntimeStub);
StubCallMode::kCallWasmRuntimeStub);
// Convert wasm numbers to JS values.
pos = AddArgumentNodes(args, pos, wasm_count, sig_);
......
......@@ -19,10 +19,9 @@ void CallInterfaceDescriptorData::InitializePlatformSpecific(
}
void CallInterfaceDescriptorData::InitializePlatformIndependent(
int return_count, int parameter_count, const MachineType* machine_types,
int machine_types_length) {
// InterfaceDescriptor owns a copy of the MachineType array.
// We only care about parameters, not receiver and result.
Flags flags, int return_count, int parameter_count,
const MachineType* machine_types, int machine_types_length) {
flags_ = flags;
return_count_ = return_count;
param_count_ = parameter_count;
int types_length = return_count_ + param_count_;
......@@ -52,6 +51,11 @@ void CallDescriptors::InitializeOncePerProcess() {
name##Descriptor().Initialize(&call_descriptor_data_[CallDescriptors::name]);
INTERFACE_DESCRIPTOR_LIST(INTERFACE_DESCRIPTOR)
#undef INTERFACE_DESCRIPTOR
DCHECK(ContextOnlyDescriptor{}.HasContextParameter());
DCHECK(!NoContextDescriptor{}.HasContextParameter());
DCHECK(!AllocateDescriptor{}.HasContextParameter());
DCHECK(!AllocateHeapNumberDescriptor{}.HasContextParameter());
}
void CallDescriptors::TearDown() {
......@@ -233,6 +237,11 @@ void ContextOnlyDescriptor::InitializePlatformSpecific(
data->InitializePlatformSpecific(0, nullptr);
}
void NoContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
data->InitializePlatformSpecific(0, nullptr);
}
void GrowArrayElementsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ObjectRegister(), KeyRegister()};
......
......@@ -19,6 +19,7 @@ namespace internal {
V(Allocate) \
V(Void) \
V(ContextOnly) \
V(NoContext) \
V(Load) \
V(LoadWithVector) \
V(LoadGlobal) \
......@@ -75,6 +76,12 @@ namespace internal {
class V8_EXPORT_PRIVATE CallInterfaceDescriptorData {
public:
enum Flag {
kNoFlags = 0u,
kNoContext = 1u << 0,
};
typedef base::Flags<Flag> Flags;
CallInterfaceDescriptorData() = default;
// A copy of the passed in registers and param_representations is made
......@@ -91,7 +98,8 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptorData {
// (return_count + parameter_count). Those members of the parameter array will
// be initialized from {machine_types}, and the rest initialized to
// MachineType::AnyTagged().
void InitializePlatformIndependent(int return_count, int parameter_count,
void InitializePlatformIndependent(Flags flags, int return_count,
int parameter_count,
const MachineType* machine_types,
int machine_types_length);
......@@ -102,6 +110,7 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptorData {
param_count_ >= 0;
}
Flags flags() const { return flags_; }
int return_count() const { return return_count_; }
int param_count() const { return param_count_; }
int register_param_count() const { return register_param_count_; }
......@@ -130,6 +139,7 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptorData {
int register_param_count_ = -1;
int return_count_ = -1;
int param_count_ = -1;
Flags flags_ = kNoFlags;
// Specifying the set of registers that could be used by the register
// allocator. Currently, it's only used by RecordWrite code stub.
......@@ -178,12 +188,20 @@ class V8_EXPORT_PRIVATE CallDescriptors : public AllStatic {
class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
public:
typedef CallInterfaceDescriptorData::Flags Flags;
CallInterfaceDescriptor() : data_(nullptr) {}
virtual ~CallInterfaceDescriptor() {}
CallInterfaceDescriptor(CallDescriptors::Key key)
: data_(CallDescriptors::call_descriptor_data(key)) {}
Flags flags() const { return data()->flags(); }
bool HasContextParameter() const {
return (flags() & CallInterfaceDescriptorData::kNoContext) == 0;
}
int GetReturnCount() const { return data()->return_count(); }
MachineType GetReturnType(int index) const {
......@@ -229,7 +247,8 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
CallInterfaceDescriptorData* data) {
// Default descriptor configuration: one result, all parameters are passed
// in registers and all parameters have MachineType::AnyTagged() type.
data->InitializePlatformIndependent(1, data->register_param_count(),
data->InitializePlatformIndependent(CallInterfaceDescriptorData::kNoFlags,
1, data->register_param_count(),
nullptr, 0);
}
......@@ -269,24 +288,24 @@ class V8_EXPORT_PRIVATE CallInterfaceDescriptor {
constexpr int kMaxBuiltinRegisterParams = 5;
#define DECLARE_DEFAULT_DESCRIPTOR(name, base) \
DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
protected: \
static const int kRegisterParams = \
kParameterCount > kMaxBuiltinRegisterParams ? kMaxBuiltinRegisterParams \
: kParameterCount; \
static const int kStackParams = kParameterCount - kRegisterParams; \
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \
override { \
DefaultInitializePlatformSpecific(data, kRegisterParams); \
} \
void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
override { \
data->InitializePlatformIndependent(kReturnCount, kParameterCount, \
nullptr, 0); \
} \
name(CallDescriptors::Key key) : base(key) {} \
\
#define DECLARE_DEFAULT_DESCRIPTOR(name, base) \
DECLARE_DESCRIPTOR_WITH_BASE(name, base) \
protected: \
static const int kRegisterParams = \
kParameterCount > kMaxBuiltinRegisterParams ? kMaxBuiltinRegisterParams \
: kParameterCount; \
static const int kStackParams = kParameterCount - kRegisterParams; \
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) \
override { \
DefaultInitializePlatformSpecific(data, kRegisterParams); \
} \
void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
override { \
data->InitializePlatformIndependent(Flags(kDescriptorFlags), kReturnCount, \
kParameterCount, nullptr, 0); \
} \
name(CallDescriptors::Key key) : base(key) {} \
\
public:
#define DECLARE_JS_COMPATIBLE_DESCRIPTOR(name, base, \
......@@ -302,6 +321,8 @@ constexpr int kMaxBuiltinRegisterParams = 5;
public:
#define DEFINE_RESULT_AND_PARAMETERS(return_count, ...) \
static constexpr int kDescriptorFlags = \
CallInterfaceDescriptorData::kNoFlags; \
static constexpr int kReturnCount = return_count; \
enum ParameterIndices { \
__dummy = -1, /* to be able to pass zero arguments */ \
......@@ -312,6 +333,8 @@ constexpr int kMaxBuiltinRegisterParams = 5;
};
#define DEFINE_RESULT_AND_PARAMETERS_NO_CONTEXT(return_count, ...) \
static constexpr int kDescriptorFlags = \
CallInterfaceDescriptorData::kNoContext; \
static constexpr int kReturnCount = return_count; \
enum ParameterIndices { \
__dummy = -1, /* to be able to pass zero arguments */ \
......@@ -322,22 +345,28 @@ constexpr int kMaxBuiltinRegisterParams = 5;
#define DEFINE_PARAMETERS(...) DEFINE_RESULT_AND_PARAMETERS(1, ##__VA_ARGS__)
#define DEFINE_RESULT_AND_PARAMETER_TYPES(...) \
void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
override { \
MachineType machine_types[] = {__VA_ARGS__}; \
static_assert( \
kReturnCount + kParameterCount == arraysize(machine_types), \
"Parameter names definition is not consistent with parameter types"); \
data->InitializePlatformIndependent(kReturnCount, kParameterCount, \
machine_types, \
arraysize(machine_types)); \
#define DEFINE_PARAMETERS_NO_CONTEXT(...) \
DEFINE_RESULT_AND_PARAMETERS_NO_CONTEXT(1, ##__VA_ARGS__)
#define DEFINE_RESULT_AND_PARAMETER_TYPES(...) \
void InitializePlatformIndependent(CallInterfaceDescriptorData* data) \
override { \
MachineType machine_types[] = {__VA_ARGS__}; \
static_assert( \
kReturnCount + kParameterCount == arraysize(machine_types), \
"Parameter names definition is not consistent with parameter types"); \
data->InitializePlatformIndependent(Flags(kDescriptorFlags), kReturnCount, \
kParameterCount, machine_types, \
arraysize(machine_types)); \
}
#define DEFINE_PARAMETER_TYPES(...) \
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::AnyTagged() /* result */, \
##__VA_ARGS__)
#define DEFINE_JS_PARAMETERS(...) \
static constexpr int kDescriptorFlags = \
CallInterfaceDescriptorData::kNoFlags; \
static constexpr int kReturnCount = 1; \
enum ParameterIndices { \
kTarget, \
......@@ -372,8 +401,8 @@ class V8_EXPORT_PRIVATE VoidDescriptor : public CallInterfaceDescriptor {
class AllocateDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS_NO_CONTEXT(1, kRequestedSize)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::TaggedPointer(), // result 0
DEFINE_PARAMETERS_NO_CONTEXT(kRequestedSize)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::TaggedPointer(), // result 1
MachineType::Int32()) // kRequestedSize
DECLARE_DESCRIPTOR(AllocateDescriptor, CallInterfaceDescriptor)
};
......@@ -398,6 +427,13 @@ class ContextOnlyDescriptor : public CallInterfaceDescriptor {
DECLARE_DESCRIPTOR(ContextOnlyDescriptor, CallInterfaceDescriptor)
};
class NoContextDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS_NO_CONTEXT()
DEFINE_PARAMETER_TYPES()
DECLARE_DESCRIPTOR(NoContextDescriptor, CallInterfaceDescriptor)
};
// LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
class LoadDescriptor : public CallInterfaceDescriptor {
public:
......@@ -721,7 +757,7 @@ class AbortJSDescriptor : public CallInterfaceDescriptor {
class AllocateHeapNumberDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS()
DEFINE_PARAMETERS_NO_CONTEXT()
DEFINE_PARAMETER_TYPES()
DECLARE_DESCRIPTOR(AllocateHeapNumberDescriptor, CallInterfaceDescriptor)
};
......@@ -801,7 +837,7 @@ class StringAtDescriptor final : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kReceiver, kPosition)
// TODO(turbofan): Return untagged value here.
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::TaggedSigned(), // result 0
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::TaggedSigned(), // result 1
MachineType::AnyTagged(), // kReceiver
MachineType::IntPtr()) // kPosition
DECLARE_DESCRIPTOR(StringAtDescriptor, CallInterfaceDescriptor)
......@@ -827,7 +863,8 @@ class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
class ApiCallbackDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_PARAMETERS(kTargetContext, kCallData, kHolder, kApiFunctionAddress)
DEFINE_PARAMETERS_NO_CONTEXT(kTargetContext, kCallData, kHolder,
kApiFunctionAddress)
DEFINE_PARAMETER_TYPES(MachineType::AnyTagged(), // kTargetContext
MachineType::AnyTagged(), // kCallData
MachineType::AnyTagged(), // kHolder
......@@ -872,8 +909,8 @@ class NewArgumentsElementsDescriptor final : public CallInterfaceDescriptor {
class V8_EXPORT_PRIVATE InterpreterDispatchDescriptor
: public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS(1, kAccumulator, kBytecodeOffset, kBytecodeArray,
kDispatchTable)
DEFINE_PARAMETERS(kAccumulator, kBytecodeOffset, kBytecodeArray,
kDispatchTable)
DEFINE_PARAMETER_TYPES(MachineType::AnyTagged(), // kAccumulator
MachineType::IntPtr(), // kBytecodeOffset
MachineType::AnyTagged(), // kBytecodeArray
......@@ -883,7 +920,7 @@ class V8_EXPORT_PRIVATE InterpreterDispatchDescriptor
class InterpreterPushArgsThenCallDescriptor : public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS(1, kNumberOfArguments, kFirstArgument, kFunction)
DEFINE_PARAMETERS(kNumberOfArguments, kFirstArgument, kFunction)
DEFINE_PARAMETER_TYPES(MachineType::Int32(), // kNumberOfArguments
MachineType::Pointer(), // kFirstArgument
MachineType::AnyTagged()) // kFunction
......@@ -894,8 +931,8 @@ class InterpreterPushArgsThenCallDescriptor : public CallInterfaceDescriptor {
class InterpreterPushArgsThenConstructDescriptor
: public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS(1, kNumberOfArguments, kNewTarget, kConstructor,
kFeedbackElement, kFirstArgument)
DEFINE_PARAMETERS(kNumberOfArguments, kNewTarget, kConstructor,
kFeedbackElement, kFirstArgument)
DEFINE_PARAMETER_TYPES(MachineType::Int32(), // kNumberOfArguments
MachineType::AnyTagged(), // kNewTarget
MachineType::AnyTagged(), // kConstructor
......@@ -909,7 +946,7 @@ class InterpreterCEntry1Descriptor : public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS(1, kNumberOfArguments, kFirstArgument,
kFunctionEntry)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::AnyTagged(), // result 0
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::AnyTagged(), // result 1
MachineType::Int32(), // kNumberOfArguments
MachineType::Pointer(), // kFirstArgument
MachineType::Pointer()) // kFunctionEntry
......@@ -920,8 +957,8 @@ class InterpreterCEntry2Descriptor : public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS(2, kNumberOfArguments, kFirstArgument,
kFunctionEntry)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::AnyTagged(), // result 0
MachineType::AnyTagged(), // result 1
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::AnyTagged(), // result 1
MachineType::AnyTagged(), // result 2
MachineType::Int32(), // kNumberOfArguments
MachineType::Pointer(), // kFirstArgument
MachineType::Pointer()) // kFunctionEntry
......@@ -951,9 +988,9 @@ class RunMicrotasksDescriptor final : public CallInterfaceDescriptor {
class WasmGrowMemoryDescriptor final : public CallInterfaceDescriptor {
public:
DEFINE_RESULT_AND_PARAMETERS_NO_CONTEXT(1 /* result size */, kNumPages)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::Int32() /* result */,
MachineType::Int32() /* kNumPages */)
DEFINE_PARAMETERS_NO_CONTEXT(kNumPages)
DEFINE_RESULT_AND_PARAMETER_TYPES(MachineType::Int32(), // result 1
MachineType::Int32()) // kNumPages
DECLARE_DESCRIPTOR(WasmGrowMemoryDescriptor, CallInterfaceDescriptor)
};
......@@ -973,6 +1010,7 @@ BUILTIN_LIST_TFS(DEFINE_TFS_BUILTIN_DESCRIPTOR)
#undef DEFINE_RESULT_AND_PARAMETERS
#undef DEFINE_RESULT_AND_PARAMETERS_NO_CONTEXT
#undef DEFINE_PARAMETERS
#undef DEFINE_PARAMETERS_NO_CONTEXT
#undef DEFINE_RESULT_AND_PARAMETER_TYPES
#undef DEFINE_PARAMETER_TYPES
#undef DEFINE_JS_PARAMETERS
......
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