Commit f4eb08f4 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: Make context register implicit for CallInterfaceDescriptors

Port 7015fd20

Original commit message:
    Up until now the context register was listed explicitly in each stub's
    CallInterfaceDescriptor. This was problematic, because it was listed
    first in the list of register parameters--which is fine for Crankshaft,
    which is more or less built to handle the context as the first
    parameter-- but not ideal for TurboFan, which adds the context at
    the end of all function parameters. Now the context register is no
    longer in the register list and can be handled appropriately by both
    compilers. Specifically, this allows the FunctionType specified for
    each CallInterfaceDescriptor to exactly match the parameter register
    list.

R=danno@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1218463004

Cr-Commit-Position: refs/heads/master@{#29421}
parent 1ab39b49
...@@ -108,15 +108,15 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm, ...@@ -108,15 +108,15 @@ void HydrogenCodeStub::GenerateLightweightMiss(MacroAssembler* masm,
isolate()->counters()->code_stubs()->Increment(); isolate()->counters()->code_stubs()->Increment();
CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor(); CallInterfaceDescriptor descriptor = GetCallInterfaceDescriptor();
int param_count = descriptor.GetEnvironmentParameterCount(); int param_count = descriptor.GetRegisterParameterCount();
{ {
// Call the runtime system in a fresh internal frame. // Call the runtime system in a fresh internal frame.
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
DCHECK(param_count == 0 || DCHECK(param_count == 0 ||
r3.is(descriptor.GetEnvironmentParameterRegister(param_count - 1))); r3.is(descriptor.GetRegisterParameter(param_count - 1)));
// Push arguments // Push arguments
for (int i = 0; i < param_count; ++i) { for (int i = 0; i < param_count; ++i) {
__ push(descriptor.GetEnvironmentParameterRegister(i)); __ push(descriptor.GetRegisterParameter(i));
} }
__ CallExternalReference(miss, param_count); __ CallExternalReference(miss, param_count);
} }
......
...@@ -64,91 +64,91 @@ const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; } ...@@ -64,91 +64,91 @@ const Register GrowArrayElementsDescriptor::KeyRegister() { return r6; }
void FastNewClosureDescriptor::InitializePlatformSpecific( void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r5}; Register registers[] = {r5};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void FastNewContextDescriptor::InitializePlatformSpecific( void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4}; Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void ToNumberDescriptor::InitializePlatformSpecific( void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3}; Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void NumberToStringDescriptor::InitializePlatformSpecific( void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3}; Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void TypeofDescriptor::InitializePlatformSpecific( void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r6}; Register registers[] = {r6};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific( void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r6, r5, r4}; Register registers[] = {r6, r5, r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific( void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r6, r5, r4, r3}; Register registers[] = {r6, r5, r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CreateAllocationSiteDescriptor::InitializePlatformSpecific( void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r5, r6}; Register registers[] = {r5, r6};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CreateWeakCellDescriptor::InitializePlatformSpecific( void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r5, r6, r4}; Register registers[] = {r5, r6, r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific( void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r6, r3}; Register registers[] = {r6, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CallFunctionDescriptor::InitializePlatformSpecific( void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4}; Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific( void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4, r6}; Register registers[] = {r4, r6};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific( void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4, r6, r5}; Register registers[] = {r4, r6, r5};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
...@@ -162,42 +162,38 @@ void CallConstructDescriptor::InitializePlatformSpecific( ...@@ -162,42 +162,38 @@ void CallConstructDescriptor::InitializePlatformSpecific(
// vector (Smi) // vector (Smi)
// TODO(turbofan): So far we don't gather type feedback and hence skip the // TODO(turbofan): So far we don't gather type feedback and hence skip the
// slot parameter, but ArrayConstructStub needs the vector to be undefined. // slot parameter, but ArrayConstructStub needs the vector to be undefined.
Register registers[] = {cp, r3, r4, r5}; Register registers[] = {r3, r4, r5};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void RegExpConstructResultDescriptor::InitializePlatformSpecific( void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r5, r4, r3}; Register registers[] = {r5, r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void TransitionElementsKindDescriptor::InitializePlatformSpecific( void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3, r4}; Register registers[] = {r3, r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void AllocateHeapNumberDescriptor::InitializePlatformSpecific( void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// register state data->InitializePlatformSpecific(0, nullptr, nullptr);
// cp -- context
Register registers[] = {cp};
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
} }
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific( void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// register state // register state
// cp -- context
// r3 -- number of arguments // r3 -- number of arguments
// r4 -- function // r4 -- function
// r5 -- allocation site with elements kind // r5 -- allocation site with elements kind
Register registers[] = {cp, r4, r5}; Register registers[] = {r4, r5};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
...@@ -205,7 +201,7 @@ void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific( ...@@ -205,7 +201,7 @@ void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
void ArrayConstructorDescriptor::InitializePlatformSpecific( void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument) // stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, r4, r5, r3}; Register registers[] = {r4, r5, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
...@@ -213,10 +209,9 @@ void ArrayConstructorDescriptor::InitializePlatformSpecific( ...@@ -213,10 +209,9 @@ void ArrayConstructorDescriptor::InitializePlatformSpecific(
void InternalArrayConstructorConstantArgCountDescriptor:: void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) { InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state // register state
// cp -- context
// r3 -- number of arguments // r3 -- number of arguments
// r4 -- constructor function // r4 -- constructor function
Register registers[] = {cp, r4}; Register registers[] = {r4};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
...@@ -224,49 +219,49 @@ void InternalArrayConstructorConstantArgCountDescriptor:: ...@@ -224,49 +219,49 @@ void InternalArrayConstructorConstantArgCountDescriptor::
void InternalArrayConstructorDescriptor::InitializePlatformSpecific( void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument) // stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, r4, r3}; Register registers[] = {r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CompareDescriptor::InitializePlatformSpecific( void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4, r3}; Register registers[] = {r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void CompareNilDescriptor::InitializePlatformSpecific( void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3}; Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void ToBooleanDescriptor::InitializePlatformSpecific( void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3}; Register registers[] = {r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void BinaryOpDescriptor::InitializePlatformSpecific( void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4, r3}; Register registers[] = {r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific( void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r5, r4, r3}; Register registers[] = {r5, r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
void StringAddDescriptor::InitializePlatformSpecific( void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r4, r3}; Register registers[] = {r4, r3};
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
} }
...@@ -274,7 +269,6 @@ void StringAddDescriptor::InitializePlatformSpecific( ...@@ -274,7 +269,6 @@ void StringAddDescriptor::InitializePlatformSpecific(
void KeyedDescriptor::InitializePlatformSpecific( void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r5, // key r5, // key
}; };
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
...@@ -284,7 +278,6 @@ void KeyedDescriptor::InitializePlatformSpecific( ...@@ -284,7 +278,6 @@ void KeyedDescriptor::InitializePlatformSpecific(
void NamedDescriptor::InitializePlatformSpecific( void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r5, // name r5, // name
}; };
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
...@@ -294,7 +287,6 @@ void NamedDescriptor::InitializePlatformSpecific( ...@@ -294,7 +287,6 @@ void NamedDescriptor::InitializePlatformSpecific(
void CallHandlerDescriptor::InitializePlatformSpecific( void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r3, // receiver r3, // receiver
}; };
data->InitializePlatformSpecific(arraysize(registers), registers); data->InitializePlatformSpecific(arraysize(registers), registers);
...@@ -304,7 +296,6 @@ void CallHandlerDescriptor::InitializePlatformSpecific( ...@@ -304,7 +296,6 @@ void CallHandlerDescriptor::InitializePlatformSpecific(
void ArgumentAdaptorDescriptor::InitializePlatformSpecific( void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r4, // JSFunction r4, // JSFunction
r3, // actual number of arguments r3, // actual number of arguments
r5, // expected number of arguments r5, // expected number of arguments
...@@ -316,7 +307,6 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific( ...@@ -316,7 +307,6 @@ void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
void ApiFunctionDescriptor::InitializePlatformSpecific( void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r3, // callee r3, // callee
r7, // call_data r7, // call_data
r5, // holder r5, // holder
...@@ -330,7 +320,6 @@ void ApiFunctionDescriptor::InitializePlatformSpecific( ...@@ -330,7 +320,6 @@ void ApiFunctionDescriptor::InitializePlatformSpecific(
void ApiAccessorDescriptor::InitializePlatformSpecific( void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r3, // callee r3, // callee
r7, // call_data r7, // call_data
r5, // holder r5, // holder
...@@ -343,7 +332,6 @@ void ApiAccessorDescriptor::InitializePlatformSpecific( ...@@ -343,7 +332,6 @@ void ApiAccessorDescriptor::InitializePlatformSpecific(
void MathRoundVariantDescriptor::InitializePlatformSpecific( void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) { CallInterfaceDescriptorData* data) {
Register registers[] = { Register registers[] = {
cp, // context
r4, // math rounding function r4, // math rounding function
r6, // vector slot id r6, // vector slot id
}; };
......
...@@ -1098,10 +1098,18 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor(HCallWithDescriptor* instr) { ...@@ -1098,10 +1098,18 @@ LInstruction* LChunkBuilder::DoCallWithDescriptor(HCallWithDescriptor* instr) {
LOperand* target = UseRegisterOrConstantAtStart(instr->target()); LOperand* target = UseRegisterOrConstantAtStart(instr->target());
ZoneList<LOperand*> ops(instr->OperandCount(), zone()); ZoneList<LOperand*> ops(instr->OperandCount(), zone());
// Target
ops.Add(target, zone()); ops.Add(target, zone());
for (int i = 1; i < instr->OperandCount(); i++) { // Context
LOperand* op = LOperand* op = UseFixed(instr->OperandAt(1), cp);
UseFixed(instr->OperandAt(i), descriptor.GetParameterRegister(i - 1)); 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()); ops.Add(op, zone());
} }
...@@ -2451,7 +2459,7 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) { ...@@ -2451,7 +2459,7 @@ LInstruction* LChunkBuilder::DoParameter(HParameter* instr) {
CallInterfaceDescriptor descriptor = CallInterfaceDescriptor descriptor =
info()->code_stub()->GetCallInterfaceDescriptor(); info()->code_stub()->GetCallInterfaceDescriptor();
int index = static_cast<int>(instr->index()); int index = static_cast<int>(instr->index());
Register reg = descriptor.GetEnvironmentParameterRegister(index); Register reg = descriptor.GetRegisterParameter(index);
return DefineFixed(result, reg); return DefineFixed(result, reg);
} }
} }
......
...@@ -1777,8 +1777,12 @@ class LCallWithDescriptor final : public LTemplateResultInstruction<1> { ...@@ -1777,8 +1777,12 @@ class LCallWithDescriptor final : public LTemplateResultInstruction<1> {
LCallWithDescriptor(CallInterfaceDescriptor descriptor, LCallWithDescriptor(CallInterfaceDescriptor descriptor,
const ZoneList<LOperand*>& operands, Zone* zone) const ZoneList<LOperand*>& operands, Zone* zone)
: descriptor_(descriptor), : descriptor_(descriptor),
inputs_(descriptor.GetRegisterParameterCount() + 1, zone) { inputs_(descriptor.GetRegisterParameterCount() +
DCHECK(descriptor.GetRegisterParameterCount() + 1 == operands.length()); kImplicitRegisterParameterCount,
zone) {
DCHECK(descriptor.GetRegisterParameterCount() +
kImplicitRegisterParameterCount ==
operands.length());
inputs_.AddAll(operands, zone); inputs_.AddAll(operands, zone);
} }
...@@ -1788,6 +1792,10 @@ class LCallWithDescriptor final : public LTemplateResultInstruction<1> { ...@@ -1788,6 +1792,10 @@ class LCallWithDescriptor final : public LTemplateResultInstruction<1> {
DECLARE_HYDROGEN_ACCESSOR(CallWithDescriptor) 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: private:
DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor") DECLARE_CONCRETE_INSTRUCTION(CallWithDescriptor, "call-with-descriptor")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment