Commit c019d7f4 authored by danno's avatar danno Committed by Commit bot

Use big-boy Types to annotate interface descriptor parameters

- Thread Type::FunctionType through stubs and the TF pipeline.
- Augment Typer to decorate parameter nodes with types from
  a Type::FunctionType associated with interface descriptors.
- Factor interface descriptors into platform-specific and
  platform-independent components so that all descriptors share
  a common Type::FunctionType for all platforms.

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

Cr-Commit-Position: refs/heads/master@{#29248}
parent b7f4981c
......@@ -62,106 +62,99 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return r0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return r3; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3, r2, r1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3, r2, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r2, r3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r2, r3, r1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r3, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1, r3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1, r3, r2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// r0 : number of arguments
// r1 : the function to call
// r2 : feedback vector
......@@ -170,34 +163,34 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r2, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r0, r1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
Register registers[] = {cp};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
......@@ -205,80 +198,81 @@ void ArrayConstructorConstantArgCountDescriptor::Initialize(
// r1 -- function
// r2 -- allocation site with elements kind
Register registers[] = {cp, r1, r2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, r1, r2, r0};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
// cp -- context
// r0 -- number of arguments
// r1 -- constructor function
Register registers[] = {cp, r1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, r1, r0};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r2, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, r1, r0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor noInlineDescriptor =
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
......@@ -286,16 +280,13 @@ void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
r2, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&noInlineDescriptor);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor noInlineDescriptor =
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
......@@ -303,16 +294,13 @@ void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
r2, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&noInlineDescriptor);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -320,16 +308,13 @@ void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
r0, // receiver
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -339,18 +324,13 @@ void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
r0, // actual number of arguments
r2, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -362,20 +342,13 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
r1, // api_function_address
r3, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -386,30 +359,19 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
r2, // holder
r1, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
r1, // math rounding function
r3, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -68,59 +68,61 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return x0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return x3; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x2: function info
Register registers[] = {cp, x2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x1: function
Register registers[] = {cp, x1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x0: value
Register registers[] = {cp, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x0: value
Register registers[] = {cp, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, x3};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x3: array literals array
// x2: array literal index
// x1: constant elements
Register registers[] = {cp, x3, x2, x1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x3: object literals array
......@@ -128,71 +130,62 @@ void FastCloneShallowObjectDescriptor::Initialize(
// x1: constant properties
// x0: object literal flags
Register registers[] = {cp, x3, x2, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x2: feedback vector
// x3: call feedback slot
Register registers[] = {cp, x2, x3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
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};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, x3, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// x1 function the function to call
Register registers[] = {cp, x1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, x1, x3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, x1, x3, x2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// x0 : number of arguments
// x1 : the function to call
// x2 : feedback vector
......@@ -200,136 +193,137 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x2: length
// x1: index (of last match)
// x0: string
Register registers[] = {cp, x2, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x0: value (js_array)
// x1: to_map
Register registers[] = {cp, x0, x1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
Register registers[] = {cp};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, x1, x2, x0};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// cp: context
// x1: constructor function
// x0: number of arguments to the constructor function
Register registers[] = {cp, x1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, x1, x0};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x1: left operand
// x0: right operand
Register registers[] = {cp, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x0: value to compare
Register registers[] = {cp, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x0: value
Register registers[] = {cp, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x1: left operand
// x0: right operand
Register registers[] = {cp, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x2: allocation site
// x1: left operand
// x0: right operand
Register registers[] = {cp, x2, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// cp: context
// x1: left operand
// x0: right operand
Register registers[] = {cp, x1, x0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor noInlineDescriptor =
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
......@@ -337,16 +331,13 @@ void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
x2, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&noInlineDescriptor);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor noInlineDescriptor =
PlatformInterfaceDescriptor(NEVER_INLINE_TARGET_ADDRESS);
......@@ -354,16 +345,13 @@ void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
x2, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&noInlineDescriptor);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -371,16 +359,13 @@ void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
cp, // context
x0, // receiver
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -390,18 +375,13 @@ void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
x0, // actual number of arguments
x2, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -413,20 +393,13 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
x1, // api_function_address
x3, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
static PlatformInterfaceDescriptor default_descriptor =
PlatformInterfaceDescriptor(CAN_INLINE_TARGET_ADDRESS);
......@@ -437,30 +410,19 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
x2, // holder
x1, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations,
data->InitializePlatformSpecific(arraysize(registers), registers,
&default_descriptor);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
x1, // math rounding function
x3, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -136,7 +136,8 @@ bool CodeStubGraphBuilderBase::BuildGraph() {
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 = descriptor_.GetEnvironmentParameterRepresentation(i);
Representation r =
RepresentationFromType(descriptor_.GetEnvironmentParameterType(i));
HParameter* param = Add<HParameter>(i,
HParameter::REGISTER_PARAMETER, r);
start_environment->Bind(i, param);
......
......@@ -502,6 +502,7 @@ Handle<Code> TurboFanCodeStub::GenerateCode() {
// Build a "hybrid" CompilationInfo for a JSFunction/CodeStub pair.
ParseInfo parse_info(&zone, inner);
CompilationInfo info(&parse_info);
info.SetFunctionType(GetCallInterfaceDescriptor().GetFunctionType());
info.SetStub(this);
return info.GenerateCodeStub();
}
......@@ -1046,5 +1047,21 @@ InternalArrayConstructorStub::InternalArrayConstructorStub(
}
Representation RepresentationFromType(Type* type) {
if (type->Is(Type::UntaggedSigned()) || type->Is(Type::UntaggedUnsigned())) {
return Representation::Integer32();
}
if (type->Is(Type::TaggedSigned())) {
return Representation::Smi();
}
if (type->Is(Type::UntaggedPointer())) {
return Representation::External();
}
DCHECK(!type->Is(Type::Untagged()));
return Representation::Tagged();
}
} // namespace internal
} // namespace v8
......@@ -431,8 +431,8 @@ class CodeStubDescriptor {
return call_descriptor().GetEnvironmentParameterCount();
}
Representation GetEnvironmentParameterRepresentation(int index) const {
return call_descriptor().GetEnvironmentParameterRepresentation(index);
Type* GetEnvironmentParameterType(int index) const {
return call_descriptor().GetEnvironmentParameterType(index);
}
ExternalReference miss_handler() const {
......@@ -2963,6 +2963,8 @@ class StringCompareStub : public PlatformCodeStub {
#undef DEFINE_HYDROGEN_CODE_STUB
#undef DEFINE_CODE_STUB
#undef DEFINE_CODE_STUB_BASE
extern Representation RepresentationFromType(Type* type);
} } // namespace v8::internal
#endif // V8_CODE_STUBS_H_
......@@ -153,7 +153,8 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info, CodeStub* code_stub,
opt_count_(has_shared_info() ? shared_info()->opt_count() : 0),
parameter_count_(0),
optimization_id_(-1),
osr_expr_stack_height_(0) {}
osr_expr_stack_height_(0),
function_type_(nullptr) {}
CompilationInfo::~CompilationInfo() {
......
......@@ -9,6 +9,7 @@
#include "src/ast.h"
#include "src/bailout-reason.h"
#include "src/compilation-dependencies.h"
#include "src/signature.h"
#include "src/zone.h"
namespace v8 {
......@@ -288,6 +289,11 @@ class CompilationInfo {
optimization_id_ = isolate()->NextOptimizationId();
}
void SetFunctionType(Type::FunctionType* function_type) {
function_type_ = function_type;
}
Type::FunctionType* function_type() const { return function_type_; }
void SetStub(CodeStub* code_stub) {
SetMode(STUB);
code_stub_ = code_stub;
......@@ -479,6 +485,8 @@ class CompilationInfo {
int osr_expr_stack_height_;
Type::FunctionType* function_type_;
DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
};
......
......@@ -165,7 +165,7 @@ class LinkageHelper {
// The first parameters go in registers.
Register reg = descriptor.GetEnvironmentParameterRegister(i);
Representation rep =
descriptor.GetEnvironmentParameterRepresentation(i);
RepresentationFromType(descriptor.GetEnvironmentParameterType(i));
locations.AddParam(regloc(reg));
types.AddParam(reptyp(rep));
} else {
......
......@@ -1050,7 +1050,8 @@ Handle<Code> Pipeline::GenerateCode() {
SmartPointer<Typer> typer;
if (info()->is_typing_enabled()) {
// Type the graph.
typer.Reset(new Typer(isolate(), data.graph(), info()->context()));
typer.Reset(new Typer(isolate(), data.graph(), info()->function_type(),
info()->context()));
Run<TyperPhase>(typer.get());
RunPrintAndVerify("Typed");
}
......
......@@ -176,9 +176,11 @@ class Typer::Decorator final : public GraphDecorator {
};
Typer::Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context)
Typer::Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
MaybeHandle<Context> context)
: isolate_(isolate),
graph_(graph),
function_type_(function_type),
context_(context),
decorator_(NULL),
cache_(new (graph->zone()) LazyTypeCache(isolate, graph->zone())) {
......@@ -634,6 +636,12 @@ Bounds Typer::Visitor::TypeIfException(Node* node) {
Bounds Typer::Visitor::TypeParameter(Node* node) {
int param = OpParameter<int>(node);
Type::FunctionType* function_type = typer_->function_type();
if (function_type != nullptr && param >= 0 &&
param < static_cast<int>(function_type->Arity())) {
return Bounds(Type::None(), function_type->Parameter(param));
}
return Bounds::Unbounded(zone());
}
......
......@@ -18,7 +18,8 @@ class LazyTypeCache;
class Typer {
public:
Typer(Isolate* isolate, Graph* graph, MaybeHandle<Context> context);
Typer(Isolate* isolate, Graph* graph, Type::FunctionType* function_type,
MaybeHandle<Context> context);
~Typer();
void Run();
......@@ -33,9 +34,11 @@ class Typer {
MaybeHandle<Context> context() const { return context_; }
Zone* zone() const { return graph()->zone(); }
Isolate* isolate() const { return isolate_; }
Type::FunctionType* function_type() const { return function_type_; }
Isolate* const isolate_;
Graph* const graph_;
Type::FunctionType* function_type_;
MaybeHandle<Context> const context_;
Decorator* decorator_;
......
......@@ -2276,7 +2276,7 @@ class HCallWithDescriptor final : public HInstruction {
} else {
int par_index = index - 1;
DCHECK(par_index < descriptor_.GetEnvironmentLength());
return descriptor_.GetParameterRepresentation(par_index);
return RepresentationFromType(descriptor_.GetParameterType(par_index));
}
}
......
......@@ -63,107 +63,100 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return eax; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return ebx; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ebx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = {esi, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ebx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax, ebx, ecx};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax, ebx, ecx, edx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ebx, edx};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ebx, edx, edi};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ecx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edi, edx};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edi, edx, ebx};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// eax : number of arguments
// ebx : feedback vector
// edx : (only if ebx is not the megamorphic symbol) slot in feedback
......@@ -172,169 +165,156 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ecx, ebx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax, ebx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// esi -- context
Register registers[] = {esi};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// eax -- number of arguments
// edi -- function
// ebx -- allocation site with elements kind
Register registers[] = {esi, edi, ebx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {esi, edi, ebx, eax};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
// eax -- number of arguments
// edi -- function
Register registers[] = {esi, edi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {esi, edi, eax};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, ecx, edx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {esi, edx, eax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
ecx, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
ecx, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
edx, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
edi, // JSFunction
eax, // actual number of arguments
ebx, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
edi, // callee
......@@ -343,19 +323,12 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
edx, // api_function_address
eax, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
edi, // callee
......@@ -363,29 +336,18 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
ecx, // holder
edx, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
esi, // context
edi, // math rounding function
edx, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -9,9 +9,44 @@
namespace v8 {
namespace internal {
void CallInterfaceDescriptorData::Initialize(
namespace {
// Constructors for common combined semantic and representation types.
Type* SmiType() {
return Type::Intersect(Type::SignedSmall(), Type::TaggedSigned());
}
Type* UntaggedSigned32() {
return Type::Intersect(Type::Signed32(), Type::UntaggedSigned32());
}
Type* AnyTagged() {
return Type::Intersect(
Type::Any(), Type::Union(Type::TaggedPointer(), Type::TaggedSigned()));
}
Type* ExternalPointer() {
return Type::Intersect(Type::Internal(), Type::UntaggedPointer());
}
}
Type::FunctionType* CallInterfaceDescriptor::BuildDefaultFunctionType(
Isolate* isolate, int parameter_count) {
Type::FunctionType* function =
Type::FunctionType::New(AnyTagged(), Type::Undefined(), parameter_count,
isolate->interface_descriptor_zone());
while (parameter_count-- != 0) {
function->InitParameter(parameter_count, AnyTagged());
}
return function;
}
void CallInterfaceDescriptorData::InitializePlatformSpecific(
int register_parameter_count, Register* registers,
Representation* register_param_representations,
PlatformInterfaceDescriptor* platform_descriptor) {
platform_specific_descriptor_ = platform_descriptor;
register_param_count_ = register_parameter_count;
......@@ -25,23 +60,8 @@ void CallInterfaceDescriptorData::Initialize(
for (int i = 0; i < register_parameter_count; i++) {
register_params_[i] = registers[i];
}
// If a representations array is specified, then the descriptor owns that as
// well.
if (register_param_representations != NULL) {
register_param_representations_.Reset(
NewArray<Representation>(register_parameter_count));
for (int i = 0; i < register_parameter_count; i++) {
// If there is a context register, the representation must be tagged.
DCHECK(
i != 0 ||
register_param_representations[i].Equals(Representation::Tagged()));
register_param_representations_[i] = register_param_representations[i];
}
}
}
const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
CallInterfaceDescriptorData* start = isolate->call_descriptor_data(0);
size_t index = data_ - start;
......@@ -60,116 +80,319 @@ const char* CallInterfaceDescriptor::DebugName(Isolate* isolate) const {
}
void LoadDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Type::FunctionType* LoadDescriptor::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, AnyTagged());
function->InitParameter(2, AnyTagged());
function->InitParameter(3, SmiType());
return function;
}
void LoadDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
SlotRegister()};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StoreDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
ValueRegister()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreTransitionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StoreTransitionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
ValueRegister(), MapRegister()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ElementTransitionAndStoreDescriptor::Initialize(
void ElementTransitionAndStoreDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ValueRegister(), MapRegister(),
NameRegister(), ReceiverRegister()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InstanceofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void InstanceofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), left(), right()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathPowTaggedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathPowTaggedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), exponent()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathPowIntegerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathPowIntegerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), exponent()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
Type::FunctionType*
LoadWithVectorDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
AnyTagged(), Type::Undefined(), 5, isolate->interface_descriptor_zone());
function->InitParameter(0, AnyTagged());
function->InitParameter(1, AnyTagged());
function->InitParameter(2, AnyTagged());
function->InitParameter(3, SmiType());
function->InitParameter(4, AnyTagged());
return function;
}
void LoadWithVectorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void LoadWithVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
SlotRegister(), VectorRegister()};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
Type::FunctionType*
VectorStoreICDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
AnyTagged(), Type::Undefined(), 6, 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());
return function;
}
void VectorStoreICDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void VectorStoreICDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(),
NameRegister(), ValueRegister(),
SlotRegister(), VectorRegister()};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Tagged(),
Representation::Smi(), Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
Type::FunctionType*
VectorStoreICTrampolineDescriptor::BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int paramater_count) {
Type::FunctionType* function = Type::FunctionType::New(
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());
return function;
}
void VectorStoreICTrampolineDescriptor::Initialize(
void VectorStoreICTrampolineDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ReceiverRegister(), NameRegister(),
ValueRegister(), SlotRegister()};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiGetterDescriptor::Initialize(CallInterfaceDescriptorData* data) {
Type::FunctionType*
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());
return function;
}
void ApiGetterDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), function_address()};
Representation representations[] = {Representation::Tagged(),
Representation::External()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentsAccessReadDescriptor::Initialize(
void ArgumentsAccessReadDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), index(), parameter_count()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ContextOnlyDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ContextOnlyDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void GrowArrayElementsDescriptor::Initialize(
void GrowArrayElementsDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {ContextRegister(), ObjectRegister(), KeyRegister()};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
Type::FunctionType*
FastCloneShallowArrayDescriptor::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, AnyTagged());
function->InitParameter(2, SmiType());
function->InitParameter(3, AnyTagged());
return function;
}
Type::FunctionType*
CreateAllocationSiteDescriptor::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, AnyTagged());
function->InitParameter(2, SmiType());
return function;
}
Type::FunctionType*
CreateWeakCellDescriptor::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, AnyTagged());
function->InitParameter(2, SmiType());
function->InitParameter(3, AnyTagged());
return function;
}
Type::FunctionType*
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());
return function;
}
Type::FunctionType* CallFunctionWithFeedbackAndVectorDescriptor::
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());
return function;
}
Type::FunctionType*
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());
return function;
}
Type::FunctionType*
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());
return function;
}
Type::FunctionType*
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,
UntaggedSigned32()); // expected number of arguments
return function;
}
Type::FunctionType*
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
return function;
}
Type::FunctionType*
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
return function;
}
Type::FunctionType*
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());
return function;
}
} // namespace internal
} // namespace v8
......@@ -59,24 +59,33 @@ class PlatformInterfaceDescriptor;
V(StoreArrayLiteralElement) \
V(MathPowTagged) \
V(MathPowInteger) \
V(MathRoundVariant) \
V(ContextOnly) \
V(GrowArrayElements)
V(GrowArrayElements) \
V(MathRoundVariant)
class CallInterfaceDescriptorData {
public:
CallInterfaceDescriptorData() : register_param_count_(-1) {}
CallInterfaceDescriptorData()
: stack_paramater_count_(-1),
register_param_count_(-1),
function_type_(nullptr) {}
// A copy of the passed in registers and param_representations is made
// and owned by the CallInterfaceDescriptorData.
void InitializePlatformIndependent(int stack_paramater_count,
Type::FunctionType* function_type) {
function_type_ = function_type;
stack_paramater_count_ = stack_paramater_count;
}
// TODO(mvstanton): Instead of taking parallel arrays register and
// param_representations, how about a struct that puts the representation
// and register side by side (eg, RegRep(r1, Representation::Tagged()).
// The same should go for the CodeStubDescriptor class.
void Initialize(int register_parameter_count, Register* registers,
Representation* param_representations,
void InitializePlatformSpecific(
int register_parameter_count, Register* registers,
PlatformInterfaceDescriptor* platform_descriptor = NULL);
bool IsInitialized() const { return register_param_count_ >= 0; }
......@@ -84,17 +93,17 @@ class CallInterfaceDescriptorData {
int register_param_count() const { return register_param_count_; }
Register register_param(int index) const { return register_params_[index]; }
Register* register_params() const { return register_params_.get(); }
Representation register_param_representation(int index) const {
return register_param_representations_[index];
}
Representation* register_param_representations() const {
return register_param_representations_.get();
Type* register_param_type(int index) const {
return function_type_->Parameter(index);
}
PlatformInterfaceDescriptor* platform_specific_descriptor() const {
return platform_specific_descriptor_;
}
Type::FunctionType* function_type() const { return function_type_; }
private:
int stack_paramater_count_;
int register_param_count_;
// The Register params are allocated dynamically by the
......@@ -102,11 +111,9 @@ class CallInterfaceDescriptorData {
// arrays of Registers cause creation of runtime static initializers
// which we don't want.
SmartArrayPointer<Register> register_params_;
// Specifies Representations for the stub's parameter. Points to an array of
// Representations of the same length of the numbers of parameters to the
// stub, or if NULL (the default value), Representation of each parameter
// assumed to be Tagged().
SmartArrayPointer<Representation> register_param_representations_;
// Specifies types for parameters and return
Type::FunctionType* function_type_;
PlatformInterfaceDescriptor* platform_specific_descriptor_;
......@@ -128,6 +135,7 @@ class CallDescriptors {
class CallInterfaceDescriptor {
public:
CallInterfaceDescriptor() : data_(NULL) {}
virtual ~CallInterfaceDescriptor() {}
CallInterfaceDescriptor(Isolate* isolate, CallDescriptors::Key key)
: data_(isolate->call_descriptor_data(key)) {}
......@@ -142,13 +150,9 @@ class CallInterfaceDescriptor {
return data()->register_param(index);
}
Representation GetParameterRepresentation(int index) const {
Type* GetParameterType(int index) const {
DCHECK(index < data()->register_param_count());
if (data()->register_param_representations() == NULL) {
return Representation::Tagged();
}
return data()->register_param_representation(index);
return data()->register_param_type(index);
}
// "Environment" versions of parameter functions. The first register
......@@ -161,8 +165,8 @@ class CallInterfaceDescriptor {
return GetParameterRegister(index + 1);
}
Representation GetEnvironmentParameterRepresentation(int index) const {
return GetParameterRepresentation(index + 1);
Type* GetEnvironmentParameterType(int index) const {
return GetParameterType(index + 1);
}
// Some platforms have extra information to associate with the descriptor.
......@@ -170,13 +174,40 @@ class CallInterfaceDescriptor {
return data()->platform_specific_descriptor();
}
Type::FunctionType* GetFunctionType() const {
return data()->function_type();
}
static const Register ContextRegister();
const char* DebugName(Isolate* isolate) const;
static Type::FunctionType* BuildDefaultFunctionType(Isolate* isolate,
int paramater_count);
protected:
const CallInterfaceDescriptorData* data() const { return data_; }
virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int register_param_count) {
return BuildDefaultFunctionType(isolate, register_param_count);
}
virtual void InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
UNREACHABLE();
}
void Initialize(Isolate* isolate, CallDescriptors::Key key) {
if (!data()->IsInitialized()) {
CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
InitializePlatformSpecific(d);
Type::FunctionType* function_type =
BuildCallInterfaceDescriptorFunctionType(isolate,
d->register_param_count());
d->InitializePlatformIndependent(0, function_type);
}
}
private:
const CallInterfaceDescriptorData* data_;
};
......@@ -184,22 +215,29 @@ class CallInterfaceDescriptor {
#define DECLARE_DESCRIPTOR(name, base) \
explicit name(Isolate* isolate) : base(isolate, key()) { \
if (!data()->IsInitialized()) \
Initialize(isolate->call_descriptor_data(key())); \
Initialize(isolate, key()); \
} \
\
protected: \
void Initialize(CallInterfaceDescriptorData* data); \
void InitializePlatformSpecific(CallInterfaceDescriptorData* data) override; \
name(Isolate* isolate, CallDescriptors::Key key) : base(isolate, key) {} \
\
public: \
static inline CallDescriptors::Key key();
#define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \
DECLARE_DESCRIPTOR(name, base) \
protected: \
virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType( \
Isolate* isolate, int register_param_count) override; \
\
public:
// LoadDescriptor is used by all stubs that implement Load/KeyedLoad ICs.
class LoadDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(LoadDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadDescriptor,
CallInterfaceDescriptor)
enum ParameterIndices { kReceiverIndex, kNameIndex, kSlotIndex };
static const Register ReceiverRegister();
......@@ -260,7 +298,8 @@ class InstanceofDescriptor : public CallInterfaceDescriptor {
class VectorStoreICTrampolineDescriptor : public StoreDescriptor {
public:
DECLARE_DESCRIPTOR(VectorStoreICTrampolineDescriptor, StoreDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
VectorStoreICTrampolineDescriptor, StoreDescriptor)
enum ParameterIndices { kReceiverIndex, kNameIndex, kValueIndex, kSlotIndex };
......@@ -270,7 +309,8 @@ class VectorStoreICTrampolineDescriptor : public StoreDescriptor {
class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor {
public:
DECLARE_DESCRIPTOR(VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
VectorStoreICDescriptor, VectorStoreICTrampolineDescriptor)
enum ParameterIndices {
kReceiverIndex,
......@@ -286,7 +326,8 @@ class VectorStoreICDescriptor : public VectorStoreICTrampolineDescriptor {
class LoadWithVectorDescriptor : public LoadDescriptor {
public:
DECLARE_DESCRIPTOR(LoadWithVectorDescriptor, LoadDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(LoadWithVectorDescriptor,
LoadDescriptor)
enum ParameterIndices {
kReceiverIndex,
......@@ -331,7 +372,8 @@ class TypeofDescriptor : public CallInterfaceDescriptor {
class FastCloneShallowArrayDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(FastCloneShallowArrayDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(FastCloneShallowArrayDescriptor,
CallInterfaceDescriptor)
};
......@@ -343,7 +385,8 @@ class FastCloneShallowObjectDescriptor : public CallInterfaceDescriptor {
class CreateAllocationSiteDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(CreateAllocationSiteDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateAllocationSiteDescriptor,
CallInterfaceDescriptor)
};
......@@ -356,7 +399,8 @@ class CreateWeakCellDescriptor : public CallInterfaceDescriptor {
kParameterCount
};
DECLARE_DESCRIPTOR(CreateWeakCellDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(CreateWeakCellDescriptor,
CallInterfaceDescriptor)
};
......@@ -368,16 +412,16 @@ class CallFunctionDescriptor : public CallInterfaceDescriptor {
class CallFunctionWithFeedbackDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(CallFunctionWithFeedbackDescriptor,
CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
CallFunctionWithFeedbackDescriptor, CallInterfaceDescriptor)
};
class CallFunctionWithFeedbackAndVectorDescriptor
: public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(CallFunctionWithFeedbackAndVectorDescriptor,
CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
CallFunctionWithFeedbackAndVectorDescriptor, CallInterfaceDescriptor)
};
......@@ -415,7 +459,8 @@ class ArrayConstructorConstantArgCountDescriptor
class ArrayConstructorDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(ArrayConstructorDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArrayConstructorDescriptor,
CallInterfaceDescriptor)
};
......@@ -429,8 +474,8 @@ class InternalArrayConstructorConstantArgCountDescriptor
class InternalArrayConstructorDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(InternalArrayConstructorDescriptor,
CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(
InternalArrayConstructorDescriptor, CallInterfaceDescriptor)
};
......@@ -491,25 +536,29 @@ class CallHandlerDescriptor : public CallInterfaceDescriptor {
class ArgumentAdaptorDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(ArgumentAdaptorDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ArgumentAdaptorDescriptor,
CallInterfaceDescriptor)
};
class ApiFunctionDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(ApiFunctionDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiFunctionDescriptor,
CallInterfaceDescriptor)
};
class ApiAccessorDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(ApiAccessorDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiAccessorDescriptor,
CallInterfaceDescriptor)
};
class ApiGetterDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(ApiGetterDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(ApiGetterDescriptor,
CallInterfaceDescriptor)
static const Register function_address();
};
......@@ -549,7 +598,8 @@ class MathPowIntegerDescriptor : public CallInterfaceDescriptor {
class MathRoundVariantDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(MathRoundVariantDescriptor, CallInterfaceDescriptor)
DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(MathRoundVariantDescriptor,
CallInterfaceDescriptor)
};
......
......@@ -886,6 +886,7 @@ class Isolate {
return handle_scope_implementer_;
}
Zone* runtime_zone() { return &runtime_zone_; }
Zone* interface_descriptor_zone() { return &interface_descriptor_zone_; }
UnicodeCache* unicode_cache() {
return unicode_cache_;
......@@ -1271,6 +1272,7 @@ class Isolate {
HandleScopeImplementer* handle_scope_implementer_;
UnicodeCache* unicode_cache_;
Zone runtime_zone_;
Zone interface_descriptor_zone_;
InnerPointerToCodeCache* inner_pointer_to_code_cache_;
GlobalHandles* global_handles_;
EternalHandles* eternal_handles_;
......
......@@ -62,106 +62,99 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a2, a1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a3, a1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3, a2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// a0 : number of arguments
// a1 : the function to call
// a2 : feedback vector
......@@ -170,34 +163,34 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
Register registers[] = {cp};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
......@@ -205,136 +198,123 @@ void ArrayConstructorConstantArgCountDescriptor::Initialize(
// a1 -- function
// a2 -- allocation site with elements kind
Register registers[] = {cp, a1, a2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, a1, a2, a0};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
// cp -- context
// a0 -- number of arguments
// a1 -- constructor function
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, a1, a0};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a2, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a2, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // receiver
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a1, // JSFunction
a0, // actual number of arguments
a2, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // callee
......@@ -343,19 +323,12 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
a1, // api_function_address
a3, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // callee
......@@ -363,29 +336,18 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
a2, // holder
a1, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a1, // math rounding function
a3, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -62,106 +62,99 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return a0; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return a3; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a2, a1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a3, a1};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a3, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a3, a2};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// a0 : number of arguments
// a1 : the function to call
// a2 : feedback vector
......@@ -170,34 +163,34 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
Register registers[] = {cp};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// cp -- context
......@@ -205,136 +198,123 @@ void ArrayConstructorConstantArgCountDescriptor::Initialize(
// a1 -- function
// a2 -- allocation site with elements kind
Register registers[] = {cp, a1, a2};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, a1, a2, a0};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
// cp -- context
// a0 -- number of arguments
// a1 -- constructor function
Register registers[] = {cp, a1};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {cp, a1, a0};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a2, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {cp, a1, a0};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers, NULL);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a2, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a2, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // receiver
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a1, // JSFunction
a0, // actual number of arguments
a2, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // callee
......@@ -343,19 +323,12 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
a1, // api_function_address
a3, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a0, // callee
......@@ -363,29 +336,18 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
a2, // holder
a1, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
cp, // context
a1, // math rounding function
a3, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -64,107 +64,100 @@ const Register GrowArrayElementsDescriptor::ObjectRegister() { return rax; }
const Register GrowArrayElementsDescriptor::KeyRegister() { return rbx; }
void FastNewClosureDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewClosureDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rbx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastNewContextDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void FastNewContextDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TypeofDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void TypeofDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rbx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToNumberDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// ToNumberStub invokes a function, and therefore needs a context.
Register registers[] = {rsi, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NumberToStringDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NumberToStringDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowArrayDescriptor::Initialize(
void FastCloneShallowArrayDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax, rbx, rcx};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void FastCloneShallowObjectDescriptor::Initialize(
void FastCloneShallowObjectDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax, rbx, rcx, rdx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateAllocationSiteDescriptor::Initialize(
void CreateAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rbx, rdx};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CreateWeakCellDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CreateWeakCellDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rbx, rdx, rdi};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StoreArrayLiteralElementDescriptor::Initialize(
void StoreArrayLiteralElementDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rcx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackDescriptor::Initialize(
void CallFunctionWithFeedbackDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdi, rdx};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Smi()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallFunctionWithFeedbackAndVectorDescriptor::Initialize(
void CallFunctionWithFeedbackAndVectorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdi, rdx, rbx};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(), Representation::Smi(),
Representation::Tagged()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallConstructDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// rax : number of arguments
// rbx : feedback vector
// rdx : (only if rbx is not the megamorphic symbol) slot in feedback
......@@ -173,170 +166,157 @@ void CallConstructDescriptor::Initialize(CallInterfaceDescriptorData* data) {
// 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};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void RegExpConstructResultDescriptor::Initialize(
void RegExpConstructResultDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rcx, rbx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void TransitionElementsKindDescriptor::Initialize(
void TransitionElementsKindDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax, rbx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void AllocateHeapNumberDescriptor::Initialize(
void AllocateHeapNumberDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// rsi -- context
Register registers[] = {rsi};
data->Initialize(arraysize(registers), registers, nullptr);
data->InitializePlatformSpecific(arraysize(registers), registers, nullptr);
}
void ArrayConstructorConstantArgCountDescriptor::Initialize(
void ArrayConstructorConstantArgCountDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// register state
// rax -- number of arguments
// rdi -- function
// rbx -- allocation site with elements kind
Register registers[] = {rsi, rdi, rbx};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArrayConstructorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {rsi, rdi, rbx, rax};
Representation representations[] = {
Representation::Tagged(), Representation::Tagged(),
Representation::Tagged(), Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorConstantArgCountDescriptor::Initialize(
CallInterfaceDescriptorData* data) {
void InternalArrayConstructorConstantArgCountDescriptor::
InitializePlatformSpecific(CallInterfaceDescriptorData* data) {
// register state
// rsi -- context
// rax -- number of arguments
// rdi -- constructor function
Register registers[] = {rsi, rdi};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void InternalArrayConstructorDescriptor::Initialize(
void InternalArrayConstructorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
// stack param count needs (constructor pointer, and single argument)
Register registers[] = {rsi, rdi, rax};
Representation representations[] = {Representation::Tagged(),
Representation::Tagged(),
Representation::Integer32()};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CompareNilDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CompareNilDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ToBooleanDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ToBooleanDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void BinaryOpDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void BinaryOpWithAllocationSiteDescriptor::Initialize(
void BinaryOpWithAllocationSiteDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rcx, rdx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void StringAddDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void StringAddDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {rsi, rdx, rax};
data->Initialize(arraysize(registers), registers, NULL);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void KeyedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void KeyedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rcx, // key
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // key
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void NamedDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void NamedDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rcx, // name
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // name
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void CallHandlerDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void CallHandlerDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rdx, // receiver
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // receiver
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ArgumentAdaptorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ArgumentAdaptorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rdi, // JSFunction
rax, // actual number of arguments
rbx, // expected number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // JSFunction
Representation::Integer32(), // actual number of arguments
Representation::Integer32(), // expected number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiFunctionDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rdi, // callee
......@@ -345,19 +325,12 @@ void ApiFunctionDescriptor::Initialize(CallInterfaceDescriptorData* data) {
rdx, // api_function_address
rax, // actual number of arguments
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
Representation::Integer32(), // actual number of arguments
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void ApiAccessorDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rdi, // callee
......@@ -365,29 +338,18 @@ void ApiAccessorDescriptor::Initialize(CallInterfaceDescriptorData* data) {
rcx, // holder
rdx, // api_function_address
};
Representation representations[] = {
Representation::Tagged(), // context
Representation::Tagged(), // callee
Representation::Tagged(), // call_data
Representation::Tagged(), // holder
Representation::External(), // api_function_address
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void MathRoundVariantDescriptor::Initialize(CallInterfaceDescriptorData* data) {
void MathRoundVariantDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
rsi, // context
rdi, // math rounding function
rdx, // vector slot id
};
Representation representations[] = {
Representation::Tagged(), //
Representation::Tagged(), //
Representation::Tagged(), //
};
data->Initialize(arraysize(registers), registers, representations);
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8
......
......@@ -126,7 +126,7 @@ class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
void LowerChange(Node* change) {
// Run the graph reducer with changes lowering on a single node.
Typer typer(this->isolate(), this->graph(), Handle<Context>());
Typer typer(this->isolate(), this->graph(), nullptr, Handle<Context>());
typer.Run();
ChangeLowering change_lowering(&jsgraph);
SelectLowering select_lowering(this->graph(), this->common());
......
......@@ -21,7 +21,7 @@ class JSCacheTesterHelper {
: main_graph_(zone),
main_common_(zone),
main_javascript_(zone),
main_typer_(isolate, &main_graph_, MaybeHandle<Context>()),
main_typer_(isolate, &main_graph_, nullptr, MaybeHandle<Context>()),
main_machine_(zone) {}
Graph main_graph_;
CommonOperatorBuilder main_common_;
......
......@@ -38,7 +38,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
simplified(main_zone()),
common(main_zone()),
graph(main_zone()),
typer(main_isolate(), &graph, MaybeHandle<Context>()),
typer(main_isolate(), &graph, nullptr, MaybeHandle<Context>()),
context_node(NULL) {
graph.SetStart(graph.NewNode(common.Start(num_parameters)));
graph.SetEnd(graph.NewNode(common.End(1)));
......
......@@ -60,7 +60,7 @@ class ReducerTester : public HandleAndZoneScope {
common(main_zone()),
graph(main_zone()),
javascript(main_zone()),
typer(isolate, &graph, MaybeHandle<Context>()),
typer(isolate, &graph, nullptr, MaybeHandle<Context>()),
jsgraph(isolate, &graph, &common, &javascript, &machine),
maxuint32(Constant<int32_t>(kMaxUInt32)) {
Node* s = graph.NewNode(common.Start(num_parameters));
......
......@@ -35,7 +35,7 @@ class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
SimplifiedLoweringTester(MachineType p0 = kMachNone,
MachineType p1 = kMachNone)
: GraphBuilderTester<ReturnType>(p0, p1),
typer(this->isolate(), this->graph(), MaybeHandle<Context>()),
typer(this->isolate(), this->graph(), nullptr, MaybeHandle<Context>()),
javascript(this->zone()),
jsgraph(this->isolate(), this->graph(), this->common(), &javascript,
this->machine()),
......@@ -710,7 +710,7 @@ class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders {
explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(),
Type* p2_type = Type::None())
: GraphAndBuilders(main_zone()),
typer(main_isolate(), graph(), MaybeHandle<Context>()),
typer(main_isolate(), graph(), nullptr, MaybeHandle<Context>()),
javascript(main_zone()),
jsgraph(main_isolate(), graph(), common(), &javascript, machine()) {
start = graph()->NewNode(common()->Start(2));
......
......@@ -111,7 +111,7 @@ Matcher<Node*> GraphTest::IsUndefinedConstant() {
TypedGraphTest::TypedGraphTest(int num_parameters)
: GraphTest(num_parameters),
typer_(isolate(), graph(), MaybeHandle<Context>()) {}
typer_(isolate(), graph(), nullptr, MaybeHandle<Context>()) {}
TypedGraphTest::~TypedGraphTest() {}
......
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