isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
DCHECK(param_count == 0 ||
- r0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ r0.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ push(descriptor.GetEnvironmentParameterRegister(i));
+ __ push(descriptor.GetRegisterParameter(i));
}
__ CallExternalReference(miss, param_count);
}
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r2};
+ Register registers[] = {r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1};
+ Register registers[] = {r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r0};
+ Register registers[] = {r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r0};
+ Register registers[] = {r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r3};
+ Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r3, r2, r1};
+ Register registers[] = {r3, r2, r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r3, r2, r1, r0};
+ Register registers[] = {r3, r2, r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r2, r3};
+ Register registers[] = {r2, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r2, r3, r1};
+ Register registers[] = {r2, r3, r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r3, r0};
+ Register registers[] = {r3, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1};
+ Register registers[] = {r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1, r3};
+ Register registers[] = {r1, r3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1, r3, r2};
+ Register registers[] = {r1, r3, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// vector (Smi)
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {cp, r0, r1, r2};
+ Register registers[] = {r0, r1, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r2, r1, r0};
+ Register registers[] = {r2, r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r0, r1};
+ Register registers[] = {r0, r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // register state
- // cp -- context
- Register registers[] = {cp};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// r0 -- number of arguments
// r1 -- function
// r2 -- allocation site with elements kind
- Register registers[] = {cp, r1, r2};
+ Register registers[] = {r1, r2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, r1, r2, r0};
+ Register registers[] = {r1, r2, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// r0 -- number of arguments
// r1 -- constructor function
- Register registers[] = {cp, r1};
+ Register registers[] = {r1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, r1, r0};
+ Register registers[] = {r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1, r0};
+ Register registers[] = {r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r0};
+ Register registers[] = {r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r0};
+ Register registers[] = {r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1, r0};
+ Register registers[] = {r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r2, r1, r0};
+ Register registers[] = {r2, r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, r1, r0};
+ Register registers[] = {r1, r0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r2, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r2, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r0, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r1, // JSFunction
r0, // actual number of arguments
r2, // expected number of arguments
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r0, // callee
r4, // call_data
r2, // holder
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
r0, // callee
r4, // call_data
r2, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
r1, // math rounding function
r3, // vector slot id
};
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), cp);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
ops.Add(op, zone());
}
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
DCHECK((param_count == 0) ||
- x0.Is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ x0.Is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments
MacroAssembler::PushPopQueue queue(masm);
for (int i = 0; i < param_count; ++i) {
- queue.Queue(descriptor.GetEnvironmentParameterRegister(i));
+ queue.Queue(descriptor.GetRegisterParameter(i));
}
queue.PushQueued();
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x2: function info
- Register registers[] = {cp, x2};
+ Register registers[] = {x2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x1: function
- Register registers[] = {cp, x1};
+ Register registers[] = {x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x0: value
- Register registers[] = {cp, x0};
+ Register registers[] = {x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x0: value
- Register registers[] = {cp, x0};
+ Register registers[] = {x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, x3};
+ Register registers[] = {x3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x3: array literals array
// x2: array literal index
// x1: constant elements
- Register registers[] = {cp, x3, x2, x1};
+ Register registers[] = {x3, x2, x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x3: object literals array
// x2: object literal index
// x1: constant properties
// x0: object literal flags
- Register registers[] = {cp, x3, x2, x1, x0};
+ Register registers[] = {x3, x2, x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x2: feedback vector
// x3: call feedback slot
- Register registers[] = {cp, x2, x3};
+ Register registers[] = {x2, x3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x2: feedback vector
// x3: call feedback slot
// x1: tagged value to put in the weak cell
- Register registers[] = {cp, x2, x3, x1};
+ Register registers[] = {x2, x3, x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, x3, x0};
+ Register registers[] = {x3, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// x1 function the function to call
- Register registers[] = {cp, x1};
+ Register registers[] = {x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, x1, x3};
+ Register registers[] = {x1, x3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, x1, x3, x2};
+ Register registers[] = {x1, x3, x2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// x3 : slot in feedback vector (smi) (if r2 is not the megamorphic symbol)
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {cp, x0, x1, x2};
+ Register registers[] = {x0, x1, x2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x2: length
// x1: index (of last match)
// x0: string
- Register registers[] = {cp, x2, x1, x0};
+ Register registers[] = {x2, x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x0: value (js_array)
// x1: to_map
- Register registers[] = {cp, x0, x1};
+ Register registers[] = {x0, x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
- Register registers[] = {cp};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x1: function
// x2: allocation site with elements kind
// x0: number of arguments to the constructor function
- Register registers[] = {cp, x1, x2};
+ Register registers[] = {x1, x2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, x1, x2, x0};
+ Register registers[] = {x1, x2, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
- // cp: context
// x1: constructor function
// x0: number of arguments to the constructor function
- Register registers[] = {cp, x1};
+ Register registers[] = {x1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, x1, x0};
+ Register registers[] = {x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x1: left operand
// x0: right operand
- Register registers[] = {cp, x1, x0};
+ Register registers[] = {x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x0: value to compare
- Register registers[] = {cp, x0};
+ Register registers[] = {x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x0: value
- Register registers[] = {cp, x0};
+ Register registers[] = {x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x1: left operand
// x0: right operand
- Register registers[] = {cp, x1, x0};
+ Register registers[] = {x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x2: allocation site
// x1: left operand
// x0: right operand
- Register registers[] = {cp, x2, x1, x0};
+ Register registers[] = {x2, x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // cp: context
// x1: left operand
// x0: right operand
- Register registers[] = {cp, x1, x0};
+ Register registers[] = {x1, x0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x2, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x2, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x0, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers,
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x1, // JSFunction
x0, // actual number of arguments
x2, // expected number of arguments
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x0, // callee
x4, // call_data
x2, // holder
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
Register registers[] = {
- cp, // context
x0, // callee
x4, // call_data
x2, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
x1, // math rounding function
x3, // vector slot id
};
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), cp);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
ops.Add(op, zone());
}
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
info_(info),
descriptor_(info->code_stub()),
context_(NULL) {
- int parameter_count = descriptor_.GetEnvironmentParameterCount();
+ int parameter_count = GetParameterCount();
parameters_.Reset(new HParameter*[parameter_count]);
}
virtual bool BuildGraph();
protected:
virtual HValue* BuildCodeStub() = 0;
+ int GetParameterCount() const {
+ return descriptor_.GetRegisterParameterCount();
+ }
HParameter* GetParameter(int parameter) {
- DCHECK(parameter < descriptor_.GetEnvironmentParameterCount());
+ DCHECK(parameter < GetParameterCount());
return parameters_[parameter];
}
+ Representation GetParameterRepresentation(int parameter) {
+ return RepresentationFromType(descriptor_.GetParameterType(parameter));
+ }
+ bool IsParameterCountRegister(int index) const {
+ return descriptor_.GetRegisterParameter(index)
+ .is(descriptor_.stack_parameter_count());
+ }
HValue* GetArgumentsLength() {
// This is initialized in BuildGraph()
DCHECK(arguments_length_ != NULL);
isolate()->GetHTracer()->TraceCompilation(info());
}
- int param_count = descriptor_.GetEnvironmentParameterCount();
+ int param_count = GetParameterCount();
HEnvironment* start_environment = graph()->start_environment();
HBasicBlock* next_block = CreateBasicBlock(start_environment);
Goto(next_block);
bool runtime_stack_params = descriptor_.stack_parameter_count().is_valid();
HInstruction* stack_parameter_count = NULL;
for (int i = 0; i < param_count; ++i) {
- Representation r =
- RepresentationFromType(descriptor_.GetEnvironmentParameterType(i));
+ Representation r = GetParameterRepresentation(i);
HParameter* param = Add<HParameter>(i,
HParameter::REGISTER_PARAMETER, r);
start_environment->Bind(i, param);
parameters_[i] = param;
- if (descriptor_.IsEnvironmentParameterCountRegister(i)) {
+ if (IsParameterCountRegister(i)) {
param->set_type(HType::Smi());
stack_parameter_count = param;
arguments_length_ = stack_parameter_count;
}
-CallInterfaceDescriptor HandlerStub::GetCallInterfaceDescriptor() {
+CallInterfaceDescriptor HandlerStub::GetCallInterfaceDescriptor() const {
if (kind() == Code::LOAD_IC || kind() == Code::KEYED_LOAD_IC) {
return LoadWithVectorDescriptor(isolate());
} else {
}
-CallInterfaceDescriptor StoreTransitionStub::GetCallInterfaceDescriptor() {
+CallInterfaceDescriptor StoreTransitionStub::GetCallInterfaceDescriptor()
+ const {
return StoreTransitionDescriptor(isolate());
}
// Lookup the code in the (possibly custom) cache.
bool FindCodeInCache(Code** code_out);
- virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() = 0;
+ virtual CallInterfaceDescriptor GetCallInterfaceDescriptor() const = 0;
virtual int GetStackParameterCount() const { return 0; }
// Only used by pipeline.cc's GetDebugName in DEBUG mode.
Major MajorKey() const override { return CodeStub::NoCache; }
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
UNREACHABLE();
return CallInterfaceDescriptor();
}
Handle<Code> GenerateCode() override; \
DEFINE_CODE_STUB(NAME, SUPER)
-#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
- public: \
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \
- return NAME##Descriptor(isolate()); \
+#define DEFINE_CALL_INTERFACE_DESCRIPTOR(NAME) \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
+ return NAME##Descriptor(isolate()); \
}
// There are some code stubs we just can't describe right now with a
// CallInterfaceDescriptor. Isolate behavior for those cases with this macro.
// An attempt to retrieve a descriptor will fail.
-#define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
- public: \
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override { \
- UNREACHABLE(); \
- return CallInterfaceDescriptor(); \
+#define DEFINE_NULL_CALL_INTERFACE_DESCRIPTOR() \
+ public: \
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override { \
+ UNREACHABLE(); \
+ return CallInterfaceDescriptor(); \
}
void set_call_descriptor(CallInterfaceDescriptor d) { call_descriptor_ = d; }
CallInterfaceDescriptor call_descriptor() const { return call_descriptor_; }
- int GetEnvironmentParameterCount() const {
- return call_descriptor().GetEnvironmentParameterCount();
+ int GetRegisterParameterCount() const {
+ return call_descriptor().GetRegisterParameterCount();
}
- Type* GetEnvironmentParameterType(int index) const {
- return call_descriptor().GetEnvironmentParameterType(index);
+ Register GetRegisterParameter(int index) const {
+ return call_descriptor().GetRegisterParameter(index);
+ }
+
+ Type* GetParameterType(int index) const {
+ return call_descriptor().GetParameterType(index);
}
ExternalReference miss_handler() const {
return has_miss_handler_;
}
- bool IsEnvironmentParameterCountRegister(int index) const {
- return call_descriptor().GetEnvironmentParameterRegister(index).is(
- stack_parameter_count_);
- }
-
int GetHandlerParameterCount() const {
- int params = call_descriptor().GetEnvironmentParameterCount();
+ int params = GetRegisterParameterCount();
if (handler_arguments_mode_ == PASS_ARGUMENTS) {
params += 1;
}
// Retrieve the code for the stub. Generate the code if needed.
Handle<Code> GenerateCode() override;
+ virtual int GetStackParameterCount() const override {
+ return GetCallInterfaceDescriptor().GetStackParameterCount();
+ }
+
Code::StubType GetStubType() const override { return Code::FAST; }
protected:
static Register left() { return InstanceofDescriptor::left(); }
static Register right() { return InstanceofDescriptor::right(); }
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
if (HasArgsInRegisters()) {
return InstanceofDescriptor(isolate());
}
minor_key_ = ExponentTypeBits::encode(exponent_type);
}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
if (exponent_type() == TAGGED) {
return MathPowTaggedDescriptor(isolate());
} else if (exponent_type() == INTEGER) {
// TODO(mvstanton): only the receiver register is accessed. When this is
// translated to a hydrogen code stub, a new CallInterfaceDescriptor
// should be created that just uses that register for more efficient code.
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return LoadWithVectorDescriptor(isolate());
}
void InitializeDescriptor(CodeStubDescriptor* descriptor) override;
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override;
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
protected:
explicit HandlerStub(Isolate* isolate) : HydrogenCodeStub(isolate) {}
return StoreModeBits::decode(sub_minor_key());
}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override;
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override;
protected:
Code::Kind kind() const override { return Code::STORE_IC; }
minor_key_ = TypeBits::encode(type);
}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
if (type() == READ_ELEMENT) {
return ArgumentsAccessReadDescriptor(isolate());
}
public:
explicit RestParamAccessStub(Isolate* isolate) : PlatformCodeStub(isolate) { }
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return ContextOnlyDescriptor(isolate());
}
minor_key_ = state.GetExtraICState();
}
- CallInterfaceDescriptor GetCallInterfaceDescriptor() override {
+ CallInterfaceDescriptor GetCallInterfaceDescriptor() const override {
return LoadWithVectorDescriptor(isolate());
}
Isolate* isolate, Zone* zone, const CallInterfaceDescriptor& descriptor,
int stack_parameter_count, CallDescriptor::Flags flags,
Operator::Properties properties, MachineType return_type) {
- const int register_parameter_count =
- descriptor.GetEnvironmentParameterCount();
+ const int register_parameter_count = descriptor.GetRegisterParameterCount();
const int js_parameter_count =
register_parameter_count + stack_parameter_count;
const int context_count = 1;
for (int i = 0; i < js_parameter_count; i++) {
if (i < register_parameter_count) {
// The first parameters go in registers.
- Register reg = descriptor.GetEnvironmentParameterRegister(i);
+ Register reg = descriptor.GetRegisterParameter(i);
Representation rep =
- RepresentationFromType(descriptor.GetEnvironmentParameterType(i));
+ RepresentationFromType(descriptor.GetParameterType(i));
locations.AddParam(regloc(reg));
types.AddParam(reptyp(rep));
} else {
// and the standard stack frame slots. Include space for an argument
// object to the callee and optionally the space to pass the argument
// object to the stub failure handler.
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
CHECK_EQ(translated_frame->height(), param_count);
CHECK_GE(param_count, 0);
WriteTranslatedValueToOutput(&value_iterator, &input_index, 0,
output_frame_offset);
- if (!arg_count_known && descriptor.IsEnvironmentParameterCountRegister(i)) {
+ if (!arg_count_known &&
+ descriptor.GetRegisterParameter(i)
+ .is(descriptor.stack_parameter_count())) {
arguments_length_offset = output_frame_offset;
}
}
CallInterfaceDescriptor descriptor,
const Vector<HValue*>& operands,
CallMode call_mode = NORMAL_CALL) {
- DCHECK(operands.length() == descriptor.GetEnvironmentLength());
HCallWithDescriptor* res = new (zone) HCallWithDescriptor(
target, argument_count, descriptor, operands, call_mode, zone);
+ DCHECK(operands.length() == res->GetParameterCount());
return res;
}
HValue* OperandAt(int index) const final { return values_[index]; }
Representation RequiredInputRepresentation(int index) final {
- if (index == 0) {
+ if (index == 0 || index == 1) {
+ // Target + context
return Representation::Tagged();
} else {
- int par_index = index - 1;
- DCHECK(par_index < descriptor_.GetEnvironmentLength());
+ int par_index = index - 2;
+ DCHECK(par_index < GetParameterCount());
return RepresentationFromType(descriptor_.GetParameterType(par_index));
}
}
const Vector<HValue*>& operands, CallMode call_mode,
Zone* zone)
: descriptor_(descriptor),
- values_(descriptor.GetEnvironmentLength() + 1, zone),
+ values_(GetParameterCount() + 1, zone),
argument_count_(argument_count),
call_mode_(call_mode) {
// We can only tail call without any stack arguments.
SetOperandAt(values_.length() - 1, v);
}
+ int GetParameterCount() const {
+ return descriptor_.GetRegisterParameterCount() + 1;
+ }
+
void InternalSetOperandAt(int index, HValue* value) final {
values_[index] = value;
}
if (info->IsStub()) {
CallInterfaceDescriptor descriptor =
info->code_stub()->GetCallInterfaceDescriptor();
- start_environment_ = new (zone_)
- HEnvironment(zone_, descriptor.GetEnvironmentParameterCount());
+ start_environment_ =
+ new (zone_) HEnvironment(zone_, descriptor.GetRegisterParameterCount());
} else {
if (info->is_tracking_positions()) {
info->TraceInlinedFunction(info->shared_info(), SourcePosition::Unknown(),
isolate()->builtins()->ArgumentsAdaptorTrampoline();
HConstant* adaptor_value = Add<HConstant>(adaptor);
- return New<HCallWithDescriptor>(
- adaptor_value, argument_count, descriptor,
- Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ return New<HCallWithDescriptor>(adaptor_value, argument_count, descriptor,
+ Vector<HValue*>(op_vals, arraysize(op_vals)));
}
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
ApiAccessorDescriptor descriptor(isolate());
- DCHECK(arraysize(op_vals) - 1 == descriptor.GetEnvironmentLength());
call = New<HCallWithDescriptor>(
code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
} else if (argc <= CallApiFunctionWithFixedArgsStub::kMaxFixedArgs) {
CallApiFunctionWithFixedArgsStub stub(isolate(), argc, call_data_undefined);
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
ApiFunctionWithFixedArgsDescriptor descriptor(isolate());
- DCHECK(arraysize(op_vals) - 1 == descriptor.GetEnvironmentLength());
call = New<HCallWithDescriptor>(
code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ Vector<HValue*>(op_vals, arraysize(op_vals) - 1));
Drop(1); // Drop function.
} else {
op_vals[arraysize(op_vals) - 1] = Add<HConstant>(argc);
Handle<Code> code = stub.GetCode();
HConstant* code_value = Add<HConstant>(code);
ApiFunctionDescriptor descriptor(isolate());
- DCHECK(arraysize(op_vals) == descriptor.GetEnvironmentLength());
- call = New<HCallWithDescriptor>(
- code_value, argc + 1, descriptor,
- Vector<HValue*>(op_vals, descriptor.GetEnvironmentLength()));
+ call =
+ New<HCallWithDescriptor>(code_value, argc + 1, descriptor,
+ Vector<HValue*>(op_vals, arraysize(op_vals)));
Drop(1); // Drop function.
}
isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
DCHECK(param_count == 0 ||
- eax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ eax.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ push(descriptor.GetEnvironmentParameterRegister(i));
+ __ push(descriptor.GetRegisterParameter(i));
}
__ CallExternalReference(miss, param_count);
}
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ebx};
+ Register registers[] = {ebx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edi};
+ Register registers[] = {edi};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// ToNumberStub invokes a function, and therefore needs a context.
- Register registers[] = {esi, eax};
+ Register registers[] = {eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax};
+ Register registers[] = {eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ebx};
+ Register registers[] = {ebx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax, ebx, ecx};
+ Register registers[] = {eax, ebx, ecx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax, ebx, ecx, edx};
+ Register registers[] = {eax, ebx, ecx, edx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ebx, edx};
+ Register registers[] = {ebx, edx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ebx, edx, edi};
+ Register registers[] = {ebx, edx, edi};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ecx, eax};
+ Register registers[] = {ecx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edi};
+ Register registers[] = {edi};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edi, edx};
+ Register registers[] = {edi, edx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edi, edx, ebx};
+ Register registers[] = {edi, edx, ebx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// edi : constructor function
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {esi, eax, edi, ebx};
+ Register registers[] = {eax, edi, ebx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ecx, ebx, eax};
+ Register registers[] = {ecx, ebx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax, ebx};
+ Register registers[] = {eax, ebx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // esi -- context
- Register registers[] = {esi};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
// eax -- number of arguments
// edi -- function
// ebx -- allocation site with elements kind
- Register registers[] = {esi, edi, ebx};
+ Register registers[] = {edi, ebx};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {esi, edi, ebx, eax};
+ Register registers[] = {edi, ebx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// register state
// eax -- number of arguments
// edi -- function
- Register registers[] = {esi, edi};
+ Register registers[] = {edi};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {esi, edi, eax};
+ Register registers[] = {edi, eax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edx, eax};
+ Register registers[] = {edx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax};
+ Register registers[] = {eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, eax};
+ Register registers[] = {eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edx, eax};
+ Register registers[] = {edx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, ecx, edx, eax};
+ Register registers[] = {ecx, edx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {esi, edx, eax};
+ Register registers[] = {edx, eax};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
ecx, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
ecx, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
edx, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
edi, // JSFunction
eax, // actual number of arguments
ebx, // expected number of arguments
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
edi, // callee
ebx, // call_data
ecx, // holder
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
edi, // callee
ebx, // call_data
ecx, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- esi, // context
edi, // math rounding function
edx, // vector slot id
};
CallInterfaceDescriptor descriptor = instr->descriptor();
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), esi);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
ops.Add(op, zone());
}
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
public:
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
- : inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ : inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
platform_specific_descriptor_ = platform_descriptor;
register_param_count_ = register_parameter_count;
- // An interface descriptor must have a context register.
- DCHECK(register_parameter_count > 0 &&
- registers[0].is(CallInterfaceDescriptor::ContextRegister()));
-
// InterfaceDescriptor owns a copy of the registers array.
register_params_.Reset(NewArray<Register>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
Type::FunctionType* LoadDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
function->InitParameter(1, AnyTagged());
- function->InitParameter(2, AnyTagged());
- function->InitParameter(3, SmiType());
+ function->InitParameter(2, SmiType());
return function;
}
void LoadDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
- SlotRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
- ValueRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreTransitionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
- ValueRegister(), MapRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
+ MapRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ElementTransitionAndStoreDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ValueRegister(), MapRegister(),
- NameRegister(), ReceiverRegister()};
+ Register registers[] = {ValueRegister(), MapRegister(), NameRegister(),
+ ReceiverRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InstanceofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), left(), right()};
+ Register registers[] = {left(), right()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathPowTaggedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), exponent()};
+ Register registers[] = {exponent()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathPowIntegerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), exponent()};
+ Register registers[] = {exponent()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
function->InitParameter(1, AnyTagged());
- function->InitParameter(2, AnyTagged());
- function->InitParameter(3, SmiType());
- function->InitParameter(4, AnyTagged());
+ function->InitParameter(2, SmiType());
+ function->InitParameter(3, AnyTagged());
return function;
}
void LoadWithVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
- SlotRegister(), VectorRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), SlotRegister(),
+ VectorRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
VectorStoreICDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 6, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
function->InitParameter(1, AnyTagged());
function->InitParameter(2, AnyTagged());
- function->InitParameter(3, AnyTagged());
- function->InitParameter(4, SmiType());
- function->InitParameter(5, AnyTagged());
+ function->InitParameter(3, SmiType());
+ function->InitParameter(4, AnyTagged());
return function;
}
void VectorStoreICDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(),
- NameRegister(), ValueRegister(),
- SlotRegister(), VectorRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
+ SlotRegister(), VectorRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
VectorStoreICTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
function->InitParameter(1, AnyTagged());
function->InitParameter(2, AnyTagged());
- function->InitParameter(3, AnyTagged());
- function->InitParameter(4, SmiType());
+ function->InitParameter(3, SmiType());
return function;
}
void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
- ValueRegister(), SlotRegister()};
+ Register registers[] = {ReceiverRegister(), NameRegister(), ValueRegister(),
+ SlotRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
ApiGetterDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged());
- function->InitParameter(1, ExternalPointer());
+ AnyTagged(), Type::Undefined(), 1, isolate->interface_descriptor_zone());
+ function->InitParameter(0, ExternalPointer());
return function;
}
void ApiGetterDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), function_address()};
+ Register registers[] = {function_address()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentsAccessReadDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), index(), parameter_count()};
+ Register registers[] = {index(), parameter_count()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ContextOnlyDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister()};
- data->InitializePlatformSpecific(arraysize(registers), registers);
+ data->InitializePlatformSpecific(0, nullptr);
}
void GrowArrayElementsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {ContextRegister(), ObjectRegister(), KeyRegister()};
+ Register registers[] = {ObjectRegister(), KeyRegister()};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
FastCloneShallowArrayDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
- function->InitParameter(1, AnyTagged());
- function->InitParameter(2, SmiType());
- function->InitParameter(3, AnyTagged());
+ function->InitParameter(1, SmiType());
+ function->InitParameter(2, AnyTagged());
return function;
}
CreateAllocationSiteDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
- function->InitParameter(1, AnyTagged());
- function->InitParameter(2, SmiType());
+ function->InitParameter(1, SmiType());
return function;
}
CreateWeakCellDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
- function->InitParameter(1, AnyTagged());
- function->InitParameter(2, SmiType());
- function->InitParameter(3, AnyTagged());
+ function->InitParameter(1, SmiType());
+ function->InitParameter(2, AnyTagged());
return function;
}
CallFunctionWithFeedbackDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged());
- function->InitParameter(1, Type::Receiver()); // JSFunction
- function->InitParameter(2, SmiType());
+ AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
+ function->InitParameter(0, Type::Receiver()); // JSFunction
+ function->InitParameter(1, SmiType());
return function;
}
BuildCallInterfaceDescriptorFunctionType(Isolate* isolate,
int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged());
- function->InitParameter(1, Type::Receiver()); // JSFunction
- function->InitParameter(2, SmiType());
- function->InitParameter(3, AnyTagged());
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
+ function->InitParameter(0, Type::Receiver()); // JSFunction
+ function->InitParameter(1, SmiType());
+ function->InitParameter(2, AnyTagged());
return function;
}
ArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged());
- function->InitParameter(1, Type::Receiver()); // JSFunction
- function->InitParameter(2, AnyTagged());
- function->InitParameter(3, UntaggedSigned32());
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
+ function->InitParameter(0, Type::Receiver()); // JSFunction
+ function->InitParameter(1, AnyTagged());
+ function->InitParameter(2, UntaggedSigned32());
return function;
}
InternalArrayConstructorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged());
- function->InitParameter(1, Type::Receiver()); // JSFunction
- function->InitParameter(2, UntaggedSigned32());
+ AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
+ function->InitParameter(0, Type::Receiver()); // JSFunction
+ function->InitParameter(1, UntaggedSigned32());
return function;
}
ArgumentAdaptorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged()); // context
- function->InitParameter(1, Type::Receiver()); // JSFunction
- function->InitParameter(2, UntaggedSigned32()); // actual number of arguments
- function->InitParameter(3,
+ AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
+ function->InitParameter(0, Type::Receiver()); // JSFunction
+ function->InitParameter(1, UntaggedSigned32()); // actual number of arguments
+ function->InitParameter(2,
UntaggedSigned32()); // expected number of arguments
return function;
}
ApiFunctionDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 6, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged()); // context
- function->InitParameter(1, AnyTagged()); // callee
- function->InitParameter(2, AnyTagged()); // call_data
- function->InitParameter(3, AnyTagged()); // holder
- function->InitParameter(4, ExternalPointer()); // api_function_address
- function->InitParameter(5, UntaggedSigned32()); // actual number of arguments
+ AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
+ function->InitParameter(0, AnyTagged()); // callee
+ function->InitParameter(1, AnyTagged()); // call_data
+ function->InitParameter(2, AnyTagged()); // holder
+ function->InitParameter(3, ExternalPointer()); // api_function_address
+ function->InitParameter(4, UntaggedSigned32()); // actual number of arguments
return function;
}
ApiAccessorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
- function->InitParameter(0, AnyTagged()); // context
- function->InitParameter(1, AnyTagged()); // callee
- function->InitParameter(2, AnyTagged()); // call_data
- function->InitParameter(3, AnyTagged()); // holder
- function->InitParameter(4, ExternalPointer()); // api_function_address
+ AnyTagged(), Type::Undefined(), 4, isolate->interface_descriptor_zone());
+ function->InitParameter(0, AnyTagged()); // callee
+ function->InitParameter(1, AnyTagged()); // call_data
+ function->InitParameter(2, AnyTagged()); // holder
+ function->InitParameter(3, ExternalPointer()); // api_function_address
return function;
}
MathRoundVariantDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
- AnyTagged(), Type::Undefined(), 3, isolate->interface_descriptor_zone());
- function->InitParameter(0, Type::Receiver());
- function->InitParameter(1, SmiType());
- function->InitParameter(2, AnyTagged());
+ AnyTagged(), Type::Undefined(), 2, isolate->interface_descriptor_zone());
+ function->InitParameter(0, SmiType());
+ function->InitParameter(1, AnyTagged());
return function;
}
CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key)
: data_(isolate->call_descriptor_data(key)) {}
- int GetEnvironmentLength() const { return data()->register_param_count(); }
-
int GetRegisterParameterCount() const {
return data()->register_param_count();
}
- Register GetParameterRegister(int index) const {
+ int GetStackParameterCount() const {
+ return data()->function_type()->Arity() - data()->register_param_count();
+ }
+
+ Register GetRegisterParameter(int index) const {
return data()->register_param(index);
}
return data()->register_param_type(index);
}
- // "Environment" versions of parameter functions. The first register
- // parameter (context) is not included.
- int GetEnvironmentParameterCount() const {
- return GetEnvironmentLength() - 1;
- }
-
- Register GetEnvironmentParameterRegister(int index) const {
- return GetParameterRegister(index + 1);
- }
-
- Type* GetEnvironmentParameterType(int index) const {
- return GetParameterType(index + 1);
- }
-
// Some platforms have extra information to associate with the descriptor.
PlatformInterfaceDescriptor* platform_specific_descriptor() const {
return data()->platform_specific_descriptor();
isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
DCHECK(param_count == 0 ||
- a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ a0.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments, adjust sp.
__ Subu(sp, sp, Operand(param_count * kPointerSize));
for (int i = 0; i < param_count; ++i) {
// Store argument to stack.
- __ sw(descriptor.GetEnvironmentParameterRegister(i),
+ __ sw(descriptor.GetRegisterParameter(i),
MemOperand(sp, (param_count - 1 - i) * kPointerSize));
}
__ CallExternalReference(miss, param_count);
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2};
+ Register registers[] = {a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3};
+ Register registers[] = {a3};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a2, a1};
+ Register registers[] = {a3, a2, a1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a2, a1, a0};
+ Register registers[] = {a3, a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a3};
+ Register registers[] = {a2, a3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a3, a1};
+ Register registers[] = {a2, a3, a1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a0};
+ Register registers[] = {a3, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a3};
+ Register registers[] = {a1, a3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a3, a2};
+ Register registers[] = {a1, a3, a2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// vector (Smi)
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {cp, a0, a1, a2};
+ Register registers[] = {a0, a1, a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a1, a0};
+ Register registers[] = {a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0, a1};
+ Register registers[] = {a0, a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
- Register registers[] = {cp};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// a0 -- number of arguments
// a1 -- function
// a2 -- allocation site with elements kind
- Register registers[] = {cp, a1, a2};
+ Register registers[] = {a1, a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, a1, a2, a0};
+ Register registers[] = {a1, a2, a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// a0 -- number of arguments
// a1 -- constructor function
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a1, a0};
+ Register registers[] = {a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a2, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a2, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a1, // JSFunction
a0, // actual number of arguments
a2, // expected number of arguments
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // callee
t0, // call_data
a2, // holder
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // callee
t0, // call_data
a2, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a1, // math rounding function
a3, // vector slot id
};
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), cp);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
ops.Add(op, zone());
}
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
DCHECK((param_count == 0) ||
- a0.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ a0.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments, adjust sp.
__ Dsubu(sp, sp, Operand(param_count * kPointerSize));
for (int i = 0; i < param_count; ++i) {
// Store argument to stack.
- __ sd(descriptor.GetEnvironmentParameterRegister(i),
+ __ sd(descriptor.GetRegisterParameter(i),
MemOperand(sp, (param_count - 1 - i) * kPointerSize));
}
__ CallExternalReference(miss, param_count);
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2};
+ Register registers[] = {a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3};
+ Register registers[] = {a3};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a2, a1};
+ Register registers[] = {a3, a2, a1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a2, a1, a0};
+ Register registers[] = {a3, a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a3};
+ Register registers[] = {a2, a3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a3, a1};
+ Register registers[] = {a2, a3, a1};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a3, a0};
+ Register registers[] = {a3, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a3};
+ Register registers[] = {a1, a3};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a3, a2};
+ Register registers[] = {a1, a3, a2};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
// vector (Smi)
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {cp, a0, a1, a2};
+ Register registers[] = {a0, a1, a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a1, a0};
+ Register registers[] = {a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0, a1};
+ Register registers[] = {a0, a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
- Register registers[] = {cp};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// a0 -- number of arguments
// a1 -- function
// a2 -- allocation site with elements kind
- Register registers[] = {cp, a1, a2};
+ Register registers[] = {a1, a2};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, a1, a2, a0};
+ Register registers[] = {a1, a2, a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
- // cp -- context
// a0 -- number of arguments
// a1 -- constructor function
- Register registers[] = {cp, a1};
+ Register registers[] = {a1};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a0};
+ Register registers[] = {a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a2, a1, a0};
+ Register registers[] = {a2, a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {cp, a1, a0};
+ Register registers[] = {a1, a0};
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a2, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a2, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a1, // JSFunction
a0, // actual number of arguments
a2, // expected number of arguments
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // callee
a4, // call_data
a2, // holder
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a0, // callee
a4, // call_data
a2, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- cp, // context
a1, // math rounding function
a3, // vector slot id
};
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
- ops.Add(op, zone());
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), cp);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
+ ops.Add(op, zone());
}
LCallWithDescriptor* result = new(zone()) LCallWithDescriptor(
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
: descriptor_(descriptor),
- inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
- int param_count = descriptor.GetEnvironmentParameterCount();
+ int param_count = descriptor.GetRegisterParameterCount();
{
// Call the runtime system in a fresh internal frame.
FrameScope scope(masm, StackFrame::INTERNAL);
DCHECK(param_count == 0 ||
- rax.is(descriptor.GetEnvironmentParameterRegister(param_count - 1)));
+ rax.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments
for (int i = 0; i < param_count; ++i) {
- __ Push(descriptor.GetEnvironmentParameterRegister(i));
+ __ Push(descriptor.GetRegisterParameter(i));
}
__ CallExternalReference(miss, param_count);
}
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rbx};
+ Register registers[] = {rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdi};
+ Register registers[] = {rdi};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rbx};
+ Register registers[] = {rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// ToNumberStub invokes a function, and therefore needs a context.
- Register registers[] = {rsi, rax};
+ Register registers[] = {rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax};
+ Register registers[] = {rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax, rbx, rcx};
+ Register registers[] = {rax, rbx, rcx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax, rbx, rcx, rdx};
+ Register registers[] = {rax, rbx, rcx, rdx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rbx, rdx};
+ Register registers[] = {rbx, rdx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rbx, rdx, rdi};
+ Register registers[] = {rbx, rdx, rdi};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rcx, rax};
+ Register registers[] = {rcx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdi};
+ Register registers[] = {rdi};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdi, rdx};
+ Register registers[] = {rdi, rdx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdi, rdx, rbx};
+ Register registers[] = {rdi, rdx, rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
// rdi : constructor function
// TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined.
- Register registers[] = {rsi, rax, rdi, rbx};
+ Register registers[] = {rax, rdi, rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rcx, rbx, rax};
+ Register registers[] = {rcx, rbx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax, rbx};
+ Register registers[] = {rax, rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- // register state
- // rsi -- context
- Register registers[] = {rsi};
- data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
+ data->InitializePlatformSpecific(0, nullptr, nullptr);
}
// rax -- number of arguments
// rdi -- function
// rbx -- allocation site with elements kind
- Register registers[] = {rsi, rdi, rbx};
+ Register registers[] = {rdi, rbx};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {rsi, rdi, rbx, rax};
+ Register registers[] = {rdi, rbx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
- // rsi -- context
// rax -- number of arguments
// rdi -- constructor function
- Register registers[] = {rsi, rdi};
+ Register registers[] = {rdi};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
- Register registers[] = {rsi, rdi, rax};
+ Register registers[] = {rdi, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdx, rax};
+ Register registers[] = {rdx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax};
+ Register registers[] = {rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rax};
+ Register registers[] = {rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdx, rax};
+ Register registers[] = {rdx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rcx, rdx, rax};
+ Register registers[] = {rcx, rdx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
- Register registers[] = {rsi, rdx, rax};
+ Register registers[] = {rdx, rax};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rcx, // key
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rcx, // name
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rdx, // receiver
};
data->InitializePlatformSpecific(arraysize(registers), registers);
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rdi, // JSFunction
rax, // actual number of arguments
rbx, // expected number of arguments
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rdi, // callee
rbx, // call_data
rcx, // holder
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rdi, // callee
rbx, // call_data
rcx, // holder
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
- rsi, // context
rdi, // math rounding function
rdx, // vector slot id
};
LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone());
+ // Target
ops.Add(target, zone());
- for (int i = 1; i < instr->OperandCount(); i++) {
- LOperand* op =
- UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1));
+ // Context
+ LOperand* op = UseFixed(instr->OperandAt(1), rsi);
+ ops.Add(op, zone());
+ // Other register parameters
+ for (int i = LCallWithDescriptor::kImplicitRegisterParameterCount;
+ i < instr->OperandCount(); i++) {
+ op =
+ UseFixed(instr->OperandAt(i),
+ descriptor.GetRegisterParameter(
+ i - LCallWithDescriptor::kImplicitRegisterParameterCount));
ops.Add(op, zone());
}
CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index());
- Register reg = descriptor.GetEnvironmentParameterRegister(index);
+ Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg);
}
}
public:
LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone)
- : inputs_(descriptor.GetRegisterParameterCount() + 1, zone) {
- DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length());
+ : inputs_(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount,
+ zone) {
+ DCHECK(descriptor.GetRegisterParameterCount() +
+ kImplicitRegisterParameterCount ==
+ operands.length());
inputs_.AddAll(operands, zone);
}
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor)
+ // The target and context are passed as implicit parameters that are not
+ // explicitly listed in the descriptor.
+ static const int kImplicitRegisterParameterCount = 2;
+
private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")