Commit 34f6b5fb authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Get rid of FieldTypeRef

All we care about w.r.t FieldType is object identity. Moreover,
FieldType does not have its own instance type. Hence it makes no
sense to have the broker know about FieldType at all.

Bug: v8:7790
Change-Id: I585e7e06826fae95890c1889ae2f4613479cbb32
Reviewed-on: https://chromium-review.googlesource.com/1151300
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarSigurd Schneider <sigurds@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54725}
parent 331cb450
......@@ -129,7 +129,7 @@ class PretenureModeDependency final
class FieldTypeDependency final : public CompilationDependencies::Dependency {
public:
FieldTypeDependency(const MapRef& owner, int descriptor,
const FieldTypeRef& type)
const ObjectRef& type)
: owner_(owner), descriptor_(descriptor), type_(type) {
DCHECK(IsSane());
}
......@@ -156,7 +156,7 @@ class FieldTypeDependency final : public CompilationDependencies::Dependency {
private:
MapRef owner_;
int descriptor_;
FieldTypeRef type_;
ObjectRef type_;
};
class GlobalPropertyDependency final
......@@ -291,7 +291,7 @@ PretenureFlag CompilationDependencies::DependOnPretenureMode(
void CompilationDependencies::DependOnFieldType(const MapRef& map,
int descriptor) {
MapRef owner = map.FindFieldOwner(descriptor);
FieldTypeRef type = owner.GetFieldType(descriptor);
ObjectRef type = owner.GetFieldType(descriptor);
DCHECK(type.equals(map.GetFieldType(descriptor)));
dependencies_.push_front(new (zone_)
FieldTypeDependency(owner, descriptor, type));
......
......@@ -28,7 +28,7 @@ class ObjectData : public ZoneObject {
AllowHandleDereference allow_handle_dereference; \
return object->Is##Name(); \
}
HEAP_BROKER_NORMAL_OBJECT_LIST(DEFINE_IS)
HEAP_BROKER_OBJECT_LIST(DEFINE_IS)
DEFINE_IS(Smi)
#undef DEFINE_IS
};
......@@ -118,15 +118,11 @@ HeapObjectType JSHeapBroker::HeapObjectTypeFromMap(Map* map) const {
DCHECK(Is##Name()); \
return Name##Ref(data()); \
}
HEAP_BROKER_NORMAL_OBJECT_LIST(DEFINE_IS_AND_AS)
HEAP_BROKER_OBJECT_LIST(DEFINE_IS_AND_AS)
#undef DEFINE_IS_AND_AS
bool ObjectRef::IsSmi() const { return data()->IsSmi(); }
FieldTypeRef ObjectRef::AsFieldType() const {
return FieldTypeRef(broker(), object<Object>());
}
HeapObjectType HeapObjectRef::type() const {
AllowHandleDereference allow_handle_dereference;
// TODO(neis): When this gets called via OptimizingCompileDispatcher ->
......@@ -555,13 +551,13 @@ MapRef MapRef::FindFieldOwner(int descriptor) const {
return MapRef(broker(), owner);
}
FieldTypeRef MapRef::GetFieldType(int descriptor) const {
ObjectRef MapRef::GetFieldType(int descriptor) const {
AllowHandleAllocation handle_allocation;
AllowHandleDereference allow_handle_dereference;
Handle<FieldType> field_type(
object<Map>()->instance_descriptors()->GetFieldType(descriptor),
broker()->isolate());
return FieldTypeRef(broker(), field_type);
return ObjectRef(broker(), field_type);
}
ElementsKind JSArrayRef::GetElementsKind() const {
......
......@@ -53,38 +53,34 @@ class HeapObjectType {
Flags const flags_;
};
#define HEAP_BROKER_NORMAL_OBJECT_LIST(V) \
V(AllocationSite) \
V(Cell) \
V(Code) \
V(Context) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedArrayBase) \
V(FixedDoubleArray) \
V(HeapNumber) \
V(HeapObject) \
V(InternalizedString) \
V(JSArray) \
V(JSFunction) \
V(JSGlobalProxy) \
V(JSObject) \
V(JSRegExp) \
V(Map) \
V(Module) \
V(MutableHeapNumber) \
V(Name) \
V(NativeContext) \
V(PropertyCell) \
V(ScopeInfo) \
V(ScriptContextTable) \
V(SharedFunctionInfo) \
#define HEAP_BROKER_OBJECT_LIST(V) \
V(AllocationSite) \
V(Cell) \
V(Code) \
V(Context) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedArrayBase) \
V(FixedDoubleArray) \
V(HeapNumber) \
V(HeapObject) \
V(InternalizedString) \
V(JSArray) \
V(JSFunction) \
V(JSGlobalProxy) \
V(JSObject) \
V(JSRegExp) \
V(Map) \
V(Module) \
V(MutableHeapNumber) \
V(Name) \
V(NativeContext) \
V(PropertyCell) \
V(ScopeInfo) \
V(ScriptContextTable) \
V(SharedFunctionInfo) \
V(String)
#define HEAP_BROKER_OBJECT_LIST(V) \
HEAP_BROKER_NORMAL_OBJECT_LIST(V) \
V(FieldType)
class CompilationDependencies;
class JSHeapBroker;
class ObjectData;
......@@ -113,7 +109,7 @@ class ObjectRef {
int AsSmi() const;
#define HEAP_IS_METHOD_DECL(Name) bool Is##Name() const;
HEAP_BROKER_NORMAL_OBJECT_LIST(HEAP_IS_METHOD_DECL)
HEAP_BROKER_OBJECT_LIST(HEAP_IS_METHOD_DECL)
#undef HEAP_IS_METHOD_DECL
#define HEAP_AS_METHOD_DECL(Name) Name##Ref As##Name() const;
......@@ -132,11 +128,6 @@ class ObjectRef {
ObjectData* data_;
};
class FieldTypeRef : public ObjectRef {
public:
using ObjectRef::ObjectRef;
};
class HeapObjectRef : public ObjectRef {
public:
using ObjectRef::ObjectRef;
......@@ -319,7 +310,7 @@ class MapRef : public HeapObjectRef {
bool IsFixedCowArrayMap() const;
// Concerning the underlying instance_descriptors:
FieldTypeRef GetFieldType(int descriptor) const;
ObjectRef GetFieldType(int descriptor) const;
};
class FixedArrayBaseRef : public HeapObjectRef {
......
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