[turbofan] Remove arguments order independent versions of [Tail]CallStub() from CodeAssembler.

... as they are no longer needed.

BUG=

Review-Url: https://codereview.chromium.org/2582593005
Cr-Commit-Position: refs/heads/master@{#41750}
This commit is contained in:
ishell 2016-12-16 02:43:41 -08:00 committed by Commit bot
parent 6eeab12414
commit d4a7c4bf66
4 changed files with 16 additions and 206 deletions

View File

@ -513,92 +513,6 @@ Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
return return_value;
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 3;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 4;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3, const Arg& arg4,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 5;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3, const Arg& arg4,
const Arg& arg5, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kNoFlags, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 6;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[arg5.index] = arg5.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return CallN(call_descriptor, target, args);
}
Node* CodeAssembler::CallStubN(const CallInterfaceDescriptor& descriptor,
int js_parameter_count, Node* target,
Node** args, size_t result_size) {
@ -757,52 +671,6 @@ Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
return raw_assembler()->TailCallN(call_descriptor, target, args);
}
Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
const Arg& arg4, size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 5;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return raw_assembler()->TailCallN(call_descriptor, target, args);
}
Node* CodeAssembler::TailCallStub(const CallInterfaceDescriptor& descriptor,
Node* target, Node* context, const Arg& arg1,
const Arg& arg2, const Arg& arg3,
const Arg& arg4, const Arg& arg5,
size_t result_size) {
CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor(
isolate(), zone(), descriptor, descriptor.GetStackParameterCount(),
CallDescriptor::kSupportsTailCalls, Operator::kNoProperties,
MachineType::AnyTagged(), result_size);
const int kArgsCount = 6;
Node** args = zone()->NewArray<Node*>(kArgsCount);
DCHECK((std::fill(&args[0], &args[kArgsCount], nullptr), true));
args[arg1.index] = arg1.value;
args[arg2.index] = arg2.value;
args[arg3.index] = arg3.value;
args[arg4.index] = arg4.value;
args[arg5.index] = arg5.value;
args[kArgsCount - 1] = context;
DCHECK_EQ(0, std::count(&args[0], &args[kArgsCount], nullptr));
return raw_assembler()->TailCallN(call_descriptor, target, args);
}
Node* CodeAssembler::TailCallBytecodeDispatch(
const CallInterfaceDescriptor& interface_descriptor,
Node* code_target_address, Node** args) {

View File

@ -308,15 +308,6 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Node* TailCallRuntime(Runtime::FunctionId function, Node* context,
TArgs... args);
// A pair of a zero-based argument index and a value.
// It helps writing arguments order independent code.
struct Arg {
Arg(int index, Node* value) : index(index), value(value) {}
int const index;
Node* const value;
};
template <class... TArgs>
Node* CallStub(Callable const& callable, Node* context, TArgs... args) {
Node* target = HeapConstant(callable.code());
@ -336,20 +327,6 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Node* CallStubN(const CallInterfaceDescriptor& descriptor, size_t result_size,
int input_count, Node* const* inputs);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, size_t result_size = 1);
Node* CallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, const Arg& arg5,
size_t result_size = 1);
Node* CallStubN(const CallInterfaceDescriptor& descriptor,
int js_parameter_count, Node* target, Node** args,
size_t result_size = 1);
@ -390,14 +367,6 @@ class V8_EXPORT_PRIVATE CodeAssembler {
Node* arg4, Node* arg5, Node* arg6,
size_t result_size = 1);
Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, size_t result_size = 1);
Node* TailCallStub(const CallInterfaceDescriptor& descriptor, Node* target,
Node* context, const Arg& arg1, const Arg& arg2,
const Arg& arg3, const Arg& arg4, const Arg& arg5,
size_t result_size = 1);
Node* TailCallBytecodeDispatch(const CallInterfaceDescriptor& descriptor,
Node* code_target_address, Node** args);

View File

@ -168,11 +168,8 @@ void AccessorAssemblerImpl::HandleLoadICHandlerCase(
Bind(&call_handler);
{
typedef LoadWithVectorDescriptor Descriptor;
TailCallStub(Descriptor(isolate()), handler, p->context,
Arg(Descriptor::kReceiver, p->receiver),
Arg(Descriptor::kName, p->name),
Arg(Descriptor::kSlot, p->slot),
Arg(Descriptor::kVector, p->vector));
TailCallStub(Descriptor(isolate()), handler, p->context, p->receiver,
p->name, p->slot, p->vector);
}
}
@ -374,12 +371,8 @@ void AccessorAssemblerImpl::HandleLoadICProtoHandlerCase(
typedef LoadICProtoArrayDescriptor Descriptor;
LoadICProtoArrayStub stub(isolate(), throw_reference_error_if_nonexistent);
Node* target = HeapConstant(stub.GetCode());
TailCallStub(Descriptor(isolate()), target, p->context,
Arg(Descriptor::kReceiver, p->receiver),
Arg(Descriptor::kName, p->name),
Arg(Descriptor::kSlot, p->slot),
Arg(Descriptor::kVector, p->vector),
Arg(Descriptor::kHandler, handler));
TailCallStub(Descriptor(isolate()), target, p->context, p->receiver,
p->name, p->slot, p->vector, handler);
}
}

View File

@ -27,7 +27,6 @@ namespace interpreter {
using compiler::Node;
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
typedef InterpreterAssembler::Arg Arg;
#define __ assembler->
@ -416,17 +415,13 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) {
Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index,
Node* feedback_slot,
InterpreterAssembler* assembler) {
typedef LoadGlobalWithVectorDescriptor Descriptor;
// Load the global via the LoadGlobalIC.
Node* code_target = __ HeapConstant(ic.code());
Node* name = __ LoadConstantPoolEntry(name_index);
Node* smi_slot = __ SmiTag(feedback_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
return __ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kName, name),
Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
return __ CallStub(ic.descriptor(), code_target, context, name, smi_slot,
type_feedback_vector);
}
// LdaGlobal <name_index> <slot>
@ -464,7 +459,6 @@ void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) {
}
void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
// Get the global object.
Node* context = __ GetContext();
Node* native_context = __ LoadNativeContext(context);
@ -479,10 +473,8 @@ void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) {
Node* raw_slot = __ BytecodeOperandIdx(1);
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, global), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ CallStub(ic.descriptor(), code_target, context, global, name, value,
smi_slot, type_feedback_vector);
__ Dispatch();
}
@ -716,7 +708,6 @@ void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) {
// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at
// constant pool entry <name_index>.
void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_);
Node* code_target = __ HeapConstant(ic.code());
Node* register_index = __ BytecodeOperandReg(0);
@ -727,10 +718,8 @@ void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
Node* result = __ CallStub(
ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
Node* result = __ CallStub(ic.descriptor(), code_target, context, object,
name, smi_slot, type_feedback_vector);
__ SetAccumulator(result);
__ Dispatch();
}
@ -740,7 +729,6 @@ void Interpreter::DoLdaNamedProperty(InterpreterAssembler* assembler) {
// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key
// in the accumulator.
void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
typedef LoadWithVectorDescriptor Descriptor;
Callable ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate_);
Node* code_target = __ HeapConstant(ic.code());
Node* reg_index = __ BytecodeOperandReg(0);
@ -750,16 +738,13 @@ void Interpreter::DoLdaKeyedProperty(InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
Node* result = __ CallStub(
ic.descriptor(), code_target, context, Arg(Descriptor::kReceiver, object),
Arg(Descriptor::kName, name), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
Node* result = __ CallStub(ic.descriptor(), code_target, context, object,
name, smi_slot, type_feedback_vector);
__ SetAccumulator(result);
__ Dispatch();
}
void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index);
@ -770,10 +755,8 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ CallStub(ic.descriptor(), code_target, context, object, name, value,
smi_slot, type_feedback_vector);
__ Dispatch();
}
@ -798,7 +781,6 @@ void Interpreter::DoStaNamedPropertyStrict(InterpreterAssembler* assembler) {
}
void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
typedef StoreWithVectorDescriptor Descriptor;
Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg(0);
Node* object = __ LoadRegister(object_reg_index);
@ -809,10 +791,8 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) {
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* context = __ GetContext();
__ CallStub(ic.descriptor(), code_target, context,
Arg(Descriptor::kReceiver, object), Arg(Descriptor::kName, name),
Arg(Descriptor::kValue, value), Arg(Descriptor::kSlot, smi_slot),
Arg(Descriptor::kVector, type_feedback_vector));
__ CallStub(ic.descriptor(), code_target, context, object, name, value,
smi_slot, type_feedback_vector);
__ Dispatch();
}