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