Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Unified Diff: src/interface-descriptors.cc

Issue 1197703002: Use big-boy Types to annotate interface descriptor parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Latest Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interface-descriptors.h ('k') | src/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interface-descriptors.cc
diff --git a/src/interface-descriptors.cc b/src/interface-descriptors.cc
index 099b2fb4ec25065d0aae8910659a77dd3cfe95ec..780c715bf24e7bad011c1c275d6a3b5859d6bf97 100644
--- a/src/interface-descriptors.cc
+++ b/src/interface-descriptors.cc
@@ -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);
}
-void VectorStoreICTrampolineDescriptor::Initialize(
+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::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
« no previous file with comments | « src/interface-descriptors.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698