Commit a67e37e6 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Give each ObjectRef subclass its own object() getter.

This lets us remove the unsafe object<T>() getter.

Bug: v8:7790
Change-Id: Ie438c68d4c96f1525eee5afd252523b222dc8f53
Reviewed-on: https://chromium-review.googlesource.com/c/1288411Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarMaya Lekova <mslekova@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56761}
parent 06d4d1e8
...@@ -31,15 +31,15 @@ class InitialMapDependency final : public CompilationDependencies::Dependency { ...@@ -31,15 +31,15 @@ class InitialMapDependency final : public CompilationDependencies::Dependency {
} }
bool IsValid() const override { bool IsValid() const override {
Handle<JSFunction> function = function_.object<JSFunction>(); Handle<JSFunction> function = function_.object();
return function->has_initial_map() && return function->has_initial_map() &&
function->initial_map() == *initial_map_.object<Map>(); function->initial_map() == *initial_map_.object();
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(function_.isolate(), code, DependentCode::InstallDependency(function_.isolate(), code,
initial_map_.object<Map>(), initial_map_.object(),
DependentCode::kInitialMapChangedGroup); DependentCode::kInitialMapChangedGroup);
} }
...@@ -62,7 +62,7 @@ class PrototypePropertyDependency final ...@@ -62,7 +62,7 @@ class PrototypePropertyDependency final
} }
bool IsValid() const override { bool IsValid() const override {
Handle<JSFunction> function = function_.object<JSFunction>(); Handle<JSFunction> function = function_.object();
return function->has_prototype_slot() && function->has_prototype() && return function->has_prototype_slot() && function->has_prototype() &&
!function->PrototypeRequiresRuntimeLookup() && !function->PrototypeRequiresRuntimeLookup() &&
function->prototype() == *prototype_.object(); function->prototype() == *prototype_.object();
...@@ -70,7 +70,7 @@ class PrototypePropertyDependency final ...@@ -70,7 +70,7 @@ class PrototypePropertyDependency final
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
Handle<JSFunction> function = function_.object<JSFunction>(); Handle<JSFunction> function = function_.object();
if (!function->has_initial_map()) JSFunction::EnsureHasInitialMap(function); if (!function->has_initial_map()) JSFunction::EnsureHasInitialMap(function);
Handle<Map> initial_map(function->initial_map(), function_.isolate()); Handle<Map> initial_map(function->initial_map(), function_.isolate());
DependentCode::InstallDependency(function_.isolate(), code, initial_map, DependentCode::InstallDependency(function_.isolate(), code, initial_map,
...@@ -88,11 +88,11 @@ class StableMapDependency final : public CompilationDependencies::Dependency { ...@@ -88,11 +88,11 @@ class StableMapDependency final : public CompilationDependencies::Dependency {
DCHECK(map_.is_stable()); DCHECK(map_.is_stable());
} }
bool IsValid() const override { return map_.object<Map>()->is_stable(); } bool IsValid() const override { return map_.object()->is_stable(); }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(map_.isolate(), code, map_.object<Map>(), DependentCode::InstallDependency(map_.isolate(), code, map_.object(),
DependentCode::kPrototypeCheckGroup); DependentCode::kPrototypeCheckGroup);
} }
...@@ -106,11 +106,11 @@ class TransitionDependency final : public CompilationDependencies::Dependency { ...@@ -106,11 +106,11 @@ class TransitionDependency final : public CompilationDependencies::Dependency {
DCHECK(!map_.is_deprecated()); DCHECK(!map_.is_deprecated());
} }
bool IsValid() const override { return !map_.object<Map>()->is_deprecated(); } bool IsValid() const override { return !map_.object()->is_deprecated(); }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(map_.isolate(), code, map_.object<Map>(), DependentCode::InstallDependency(map_.isolate(), code, map_.object(),
DependentCode::kTransitionGroup); DependentCode::kTransitionGroup);
} }
...@@ -129,13 +129,13 @@ class PretenureModeDependency final ...@@ -129,13 +129,13 @@ class PretenureModeDependency final
} }
bool IsValid() const override { bool IsValid() const override {
return mode_ == site_.object<AllocationSite>()->GetPretenureMode(); return mode_ == site_.object()->GetPretenureMode();
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency( DependentCode::InstallDependency(
site_.isolate(), code, site_.object<AllocationSite>(), site_.isolate(), code, site_.object(),
DependentCode::kAllocationSiteTenuringChangedGroup); DependentCode::kAllocationSiteTenuringChangedGroup);
} }
...@@ -157,15 +157,14 @@ class FieldTypeDependency final : public CompilationDependencies::Dependency { ...@@ -157,15 +157,14 @@ class FieldTypeDependency final : public CompilationDependencies::Dependency {
bool IsValid() const override { bool IsValid() const override {
DisallowHeapAllocation no_heap_allocation; DisallowHeapAllocation no_heap_allocation;
Handle<Map> owner = owner_.object<Map>(); Handle<Map> owner = owner_.object();
Handle<FieldType> type = type_.object<FieldType>(); Handle<Object> type = type_.object();
return *type == owner->instance_descriptors()->GetFieldType(descriptor_); return *type == owner->instance_descriptors()->GetFieldType(descriptor_);
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(owner_.isolate(), code, DependentCode::InstallDependency(owner_.isolate(), code, owner_.object(),
owner_.object<Map>(),
DependentCode::kFieldOwnerGroup); DependentCode::kFieldOwnerGroup);
} }
...@@ -188,15 +187,14 @@ class GlobalPropertyDependency final ...@@ -188,15 +187,14 @@ class GlobalPropertyDependency final
} }
bool IsValid() const override { bool IsValid() const override {
Handle<PropertyCell> cell = cell_.object<PropertyCell>(); Handle<PropertyCell> cell = cell_.object();
return type_ == cell->property_details().cell_type() && return type_ == cell->property_details().cell_type() &&
read_only_ == cell->property_details().IsReadOnly(); read_only_ == cell->property_details().IsReadOnly();
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(cell_.isolate(), code, DependentCode::InstallDependency(cell_.isolate(), code, cell_.object(),
cell_.object<PropertyCell>(),
DependentCode::kPropertyCellChangedGroup); DependentCode::kPropertyCellChangedGroup);
} }
...@@ -213,14 +211,13 @@ class ProtectorDependency final : public CompilationDependencies::Dependency { ...@@ -213,14 +211,13 @@ class ProtectorDependency final : public CompilationDependencies::Dependency {
} }
bool IsValid() const override { bool IsValid() const override {
Handle<PropertyCell> cell = cell_.object<PropertyCell>(); Handle<PropertyCell> cell = cell_.object();
return cell->value() == Smi::FromInt(Isolate::kProtectorValid); return cell->value() == Smi::FromInt(Isolate::kProtectorValid);
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency(cell_.isolate(), code, DependentCode::InstallDependency(cell_.isolate(), code, cell_.object(),
cell_.object<PropertyCell>(),
DependentCode::kPropertyCellChangedGroup); DependentCode::kPropertyCellChangedGroup);
} }
...@@ -242,7 +239,7 @@ class ElementsKindDependency final ...@@ -242,7 +239,7 @@ class ElementsKindDependency final
} }
bool IsValid() const override { bool IsValid() const override {
Handle<AllocationSite> site = site_.object<AllocationSite>(); Handle<AllocationSite> site = site_.object();
ElementsKind kind = site->PointsToLiteral() ElementsKind kind = site->PointsToLiteral()
? site->boilerplate()->GetElementsKind() ? site->boilerplate()->GetElementsKind()
: site->GetElementsKind(); : site->GetElementsKind();
...@@ -252,7 +249,7 @@ class ElementsKindDependency final ...@@ -252,7 +249,7 @@ class ElementsKindDependency final
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
SLOW_DCHECK(IsValid()); SLOW_DCHECK(IsValid());
DependentCode::InstallDependency( DependentCode::InstallDependency(
site_.isolate(), code, site_.object<AllocationSite>(), site_.isolate(), code, site_.object(),
DependentCode::kAllocationSiteTransitionChangedGroup); DependentCode::kAllocationSiteTransitionChangedGroup);
} }
...@@ -271,17 +268,16 @@ class InitialMapInstanceSizePredictionDependency final ...@@ -271,17 +268,16 @@ class InitialMapInstanceSizePredictionDependency final
bool IsValid() const override { bool IsValid() const override {
// The dependency is valid if the prediction is the same as the current // The dependency is valid if the prediction is the same as the current
// slack tracking result. // slack tracking result.
if (!function_.object<JSFunction>()->has_initial_map()) return false; if (!function_.object()->has_initial_map()) return false;
int instance_size = int instance_size = function_.object()->ComputeInstanceSizeWithMinSlack(
function_.object<JSFunction>()->ComputeInstanceSizeWithMinSlack( function_.isolate());
function_.isolate());
return instance_size == instance_size_; return instance_size == instance_size_;
} }
void Install(const MaybeObjectHandle& code) override { void Install(const MaybeObjectHandle& code) override {
DCHECK(IsValid()); DCHECK(IsValid());
// Finish the slack tracking. // Finish the slack tracking.
function_.object<JSFunction>()->CompleteInobjectSlackTrackingIfActive(); function_.object()->CompleteInobjectSlackTrackingIfActive();
} }
private: private:
......
...@@ -1652,7 +1652,7 @@ Node* JSCreateLowering::AllocateFastLiteral(Node* effect, Node* control, ...@@ -1652,7 +1652,7 @@ Node* JSCreateLowering::AllocateFastLiteral(Node* effect, Node* control,
NameRef property_name = boilerplate_map.GetPropertyKey(i); NameRef property_name = boilerplate_map.GetPropertyKey(i);
FieldIndex index = boilerplate_map.GetFieldIndexFor(i); FieldIndex index = boilerplate_map.GetFieldIndexFor(i);
FieldAccess access = { FieldAccess access = {
kTaggedBase, index.offset(), property_name.object<Name>(), kTaggedBase, index.offset(), property_name.object(),
MaybeHandle<Map>(), Type::Any(), MachineType::AnyTagged(), MaybeHandle<Map>(), Type::Any(), MachineType::AnyTagged(),
kFullWriteBarrier}; kFullWriteBarrier};
Node* value; Node* value;
...@@ -1739,7 +1739,7 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control, ...@@ -1739,7 +1739,7 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control,
boilerplate.EnsureElementsTenured(); boilerplate.EnsureElementsTenured();
boilerplate_elements = boilerplate.elements(); boilerplate_elements = boilerplate.elements();
} }
return jsgraph()->HeapConstant(boilerplate_elements.object<HeapObject>()); return jsgraph()->HeapConstant(boilerplate_elements.object());
} }
// Compute the elements to store first (might have effects). // Compute the elements to store first (might have effects).
...@@ -1768,7 +1768,7 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control, ...@@ -1768,7 +1768,7 @@ Node* JSCreateLowering::AllocateFastLiteralElements(Node* effect, Node* control,
// Allocate the backing store array and store the elements. // Allocate the backing store array and store the elements.
AllocationBuilder builder(jsgraph(), effect, control); AllocationBuilder builder(jsgraph(), effect, control);
builder.AllocateArray(elements_length, elements_map.object<Map>(), pretenure); builder.AllocateArray(elements_length, elements_map.object(), pretenure);
ElementAccess const access = ElementAccess const access =
(elements_map.instance_type() == FIXED_DOUBLE_ARRAY_TYPE) (elements_map.instance_type() == FIXED_DOUBLE_ARRAY_TYPE)
? AccessBuilder::ForFixedDoubleArrayElement() ? AccessBuilder::ForFixedDoubleArrayElement()
......
...@@ -73,24 +73,23 @@ Node* JSGraph::Constant(const ObjectRef& ref) { ...@@ -73,24 +73,23 @@ Node* JSGraph::Constant(const ObjectRef& ref) {
if (ref.IsHeapNumber()) { if (ref.IsHeapNumber()) {
return Constant(ref.AsHeapNumber().value()); return Constant(ref.AsHeapNumber().value());
} else if (oddball_type == OddballType::kUndefined) { } else if (oddball_type == OddballType::kUndefined) {
DCHECK( DCHECK(ref.object().equals(isolate()->factory()->undefined_value()));
ref.object<Object>().equals(isolate()->factory()->undefined_value()));
return UndefinedConstant(); return UndefinedConstant();
} else if (oddball_type == OddballType::kNull) { } else if (oddball_type == OddballType::kNull) {
DCHECK(ref.object<Object>().equals(isolate()->factory()->null_value())); DCHECK(ref.object().equals(isolate()->factory()->null_value()));
return NullConstant(); return NullConstant();
} else if (oddball_type == OddballType::kHole) { } else if (oddball_type == OddballType::kHole) {
DCHECK(ref.object<Object>().equals(isolate()->factory()->the_hole_value())); DCHECK(ref.object().equals(isolate()->factory()->the_hole_value()));
return TheHoleConstant(); return TheHoleConstant();
} else if (oddball_type == OddballType::kBoolean) { } else if (oddball_type == OddballType::kBoolean) {
if (ref.object<Object>().equals(isolate()->factory()->true_value())) { if (ref.object().equals(isolate()->factory()->true_value())) {
return TrueConstant(); return TrueConstant();
} else { } else {
DCHECK(ref.object<Object>().equals(isolate()->factory()->false_value())); DCHECK(ref.object().equals(isolate()->factory()->false_value()));
return FalseConstant(); return FalseConstant();
} }
} else { } else {
return HeapConstant(ref.object<HeapObject>()); return HeapConstant(ref.AsHeapObject().object());
} }
} }
......
This diff is collapsed.
...@@ -16,6 +16,16 @@ ...@@ -16,6 +16,16 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
class BytecodeArray;
class FixedDoubleArray;
class InternalizedString;
class JSGlobalProxy;
class JSRegExp;
class JSTypedArray;
class NativeContext;
class ScriptContextTable;
namespace compiler { namespace compiler {
enum class OddballType : uint8_t { enum class OddballType : uint8_t {
...@@ -71,6 +81,7 @@ enum class OddballType : uint8_t { ...@@ -71,6 +81,7 @@ enum class OddballType : uint8_t {
class CompilationDependencies; class CompilationDependencies;
class JSHeapBroker; class JSHeapBroker;
class ObjectData; class ObjectData;
class PerIsolateCompilerCache;
#define FORWARD_DECL(Name) class Name##Ref; #define FORWARD_DECL(Name) class Name##Ref;
HEAP_BROKER_OBJECT_LIST(FORWARD_DECL) HEAP_BROKER_OBJECT_LIST(FORWARD_DECL)
#undef FORWARD_DECL #undef FORWARD_DECL
...@@ -79,18 +90,13 @@ class ObjectRef { ...@@ -79,18 +90,13 @@ class ObjectRef {
public: public:
ObjectRef(JSHeapBroker* broker, Handle<Object> object); ObjectRef(JSHeapBroker* broker, Handle<Object> object);
ObjectRef(JSHeapBroker* broker, ObjectData* data) ObjectRef(JSHeapBroker* broker, ObjectData* data)
: broker_(broker), data_(data) { : data_(data), broker_(broker) {
CHECK_NOT_NULL(data_); CHECK_NOT_NULL(data_);
} }
bool equals(const ObjectRef& other) const;
Handle<Object> object() const; Handle<Object> object() const;
// TODO(neis): Remove eventually.
template <typename T> bool equals(const ObjectRef& other) const;
Handle<T> object() const {
return Handle<T>(reinterpret_cast<T**>(object().address()));
}
bool IsSmi() const; bool IsSmi() const;
int AsSmi() const; int AsSmi() const;
...@@ -111,10 +117,12 @@ class ObjectRef { ...@@ -111,10 +117,12 @@ class ObjectRef {
protected: protected:
JSHeapBroker* broker() const; JSHeapBroker* broker() const;
ObjectData* data() const; ObjectData* data() const;
ObjectData* data_; // Should be used only by object() getters.
private: private:
JSHeapBroker* broker_; JSHeapBroker* broker_;
ObjectData* data_;
protected:
}; };
// Temporary class that carries information from a Map. We'd like to remove // Temporary class that carries information from a Map. We'd like to remove
...@@ -155,6 +163,7 @@ class HeapObjectType { ...@@ -155,6 +163,7 @@ class HeapObjectType {
class HeapObjectRef : public ObjectRef { class HeapObjectRef : public ObjectRef {
public: public:
using ObjectRef::ObjectRef; using ObjectRef::ObjectRef;
Handle<HeapObject> object() const;
MapRef map() const; MapRef map() const;
...@@ -165,6 +174,7 @@ class HeapObjectRef : public ObjectRef { ...@@ -165,6 +174,7 @@ class HeapObjectRef : public ObjectRef {
class PropertyCellRef : public HeapObjectRef { class PropertyCellRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<PropertyCell> object() const;
PropertyDetails property_details() const; PropertyDetails property_details() const;
ObjectRef value() const; ObjectRef value() const;
...@@ -173,6 +183,7 @@ class PropertyCellRef : public HeapObjectRef { ...@@ -173,6 +183,7 @@ class PropertyCellRef : public HeapObjectRef {
class JSObjectRef : public HeapObjectRef { class JSObjectRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<JSObject> object() const;
double RawFastDoublePropertyAt(FieldIndex index) const; double RawFastDoublePropertyAt(FieldIndex index) const;
ObjectRef RawFastPropertyAt(FieldIndex index) const; ObjectRef RawFastPropertyAt(FieldIndex index) const;
...@@ -188,6 +199,7 @@ class JSObjectRef : public HeapObjectRef { ...@@ -188,6 +199,7 @@ class JSObjectRef : public HeapObjectRef {
class JSFunctionRef : public JSObjectRef { class JSFunctionRef : public JSObjectRef {
public: public:
using JSObjectRef::JSObjectRef; using JSObjectRef::JSObjectRef;
Handle<JSFunction> object() const;
bool has_initial_map() const; bool has_initial_map() const;
bool has_prototype() const; bool has_prototype() const;
...@@ -206,6 +218,7 @@ class JSFunctionRef : public JSObjectRef { ...@@ -206,6 +218,7 @@ class JSFunctionRef : public JSObjectRef {
class JSRegExpRef : public JSObjectRef { class JSRegExpRef : public JSObjectRef {
public: public:
using JSObjectRef::JSObjectRef; using JSObjectRef::JSObjectRef;
Handle<JSRegExp> object() const;
ObjectRef raw_properties_or_hash() const; ObjectRef raw_properties_or_hash() const;
ObjectRef data() const; ObjectRef data() const;
...@@ -217,6 +230,7 @@ class JSRegExpRef : public JSObjectRef { ...@@ -217,6 +230,7 @@ class JSRegExpRef : public JSObjectRef {
class HeapNumberRef : public HeapObjectRef { class HeapNumberRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<HeapNumber> object() const;
double value() const; double value() const;
}; };
...@@ -224,6 +238,7 @@ class HeapNumberRef : public HeapObjectRef { ...@@ -224,6 +238,7 @@ class HeapNumberRef : public HeapObjectRef {
class MutableHeapNumberRef : public HeapObjectRef { class MutableHeapNumberRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<MutableHeapNumber> object() const;
double value() const; double value() const;
}; };
...@@ -231,8 +246,9 @@ class MutableHeapNumberRef : public HeapObjectRef { ...@@ -231,8 +246,9 @@ class MutableHeapNumberRef : public HeapObjectRef {
class ContextRef : public HeapObjectRef { class ContextRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
void Serialize(); Handle<Context> object() const;
void Serialize();
ContextRef previous() const; ContextRef previous() const;
ObjectRef get(int index) const; ObjectRef get(int index) const;
}; };
...@@ -279,6 +295,8 @@ class ContextRef : public HeapObjectRef { ...@@ -279,6 +295,8 @@ class ContextRef : public HeapObjectRef {
class NativeContextRef : public ContextRef { class NativeContextRef : public ContextRef {
public: public:
using ContextRef::ContextRef; using ContextRef::ContextRef;
Handle<NativeContext> object() const;
void Serialize(); void Serialize();
#define DECL_ACCESSOR(type, name) type##Ref name() const; #define DECL_ACCESSOR(type, name) type##Ref name() const;
...@@ -293,11 +311,13 @@ class NativeContextRef : public ContextRef { ...@@ -293,11 +311,13 @@ class NativeContextRef : public ContextRef {
class NameRef : public HeapObjectRef { class NameRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<Name> object() const;
}; };
class ScriptContextTableRef : public HeapObjectRef { class ScriptContextTableRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<ScriptContextTable> object() const;
struct LookupResult { struct LookupResult {
ContextRef context; ContextRef context;
...@@ -311,11 +331,13 @@ class ScriptContextTableRef : public HeapObjectRef { ...@@ -311,11 +331,13 @@ class ScriptContextTableRef : public HeapObjectRef {
class DescriptorArrayRef : public HeapObjectRef { class DescriptorArrayRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<DescriptorArray> object() const;
}; };
class FeedbackVectorRef : public HeapObjectRef { class FeedbackVectorRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<FeedbackVector> object() const;
ObjectRef get(FeedbackSlot slot) const; ObjectRef get(FeedbackSlot slot) const;
...@@ -325,6 +347,7 @@ class FeedbackVectorRef : public HeapObjectRef { ...@@ -325,6 +347,7 @@ class FeedbackVectorRef : public HeapObjectRef {
class AllocationSiteRef : public HeapObjectRef { class AllocationSiteRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<AllocationSite> object() const;
bool PointsToLiteral() const; bool PointsToLiteral() const;
PretenureFlag GetPretenureMode() const; PretenureFlag GetPretenureMode() const;
...@@ -346,6 +369,7 @@ class AllocationSiteRef : public HeapObjectRef { ...@@ -346,6 +369,7 @@ class AllocationSiteRef : public HeapObjectRef {
class MapRef : public HeapObjectRef { class MapRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<Map> object() const;
int instance_size() const; int instance_size() const;
InstanceType instance_type() const; InstanceType instance_type() const;
...@@ -394,6 +418,7 @@ class MapRef : public HeapObjectRef { ...@@ -394,6 +418,7 @@ class MapRef : public HeapObjectRef {
class FixedArrayBaseRef : public HeapObjectRef { class FixedArrayBaseRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<FixedArrayBase> object() const;
int length() const; int length() const;
}; };
...@@ -401,6 +426,7 @@ class FixedArrayBaseRef : public HeapObjectRef { ...@@ -401,6 +426,7 @@ class FixedArrayBaseRef : public HeapObjectRef {
class FixedArrayRef : public FixedArrayBaseRef { class FixedArrayRef : public FixedArrayBaseRef {
public: public:
using FixedArrayBaseRef::FixedArrayBaseRef; using FixedArrayBaseRef::FixedArrayBaseRef;
Handle<FixedArray> object() const;
ObjectRef get(int i) const; ObjectRef get(int i) const;
}; };
...@@ -408,6 +434,7 @@ class FixedArrayRef : public FixedArrayBaseRef { ...@@ -408,6 +434,7 @@ class FixedArrayRef : public FixedArrayBaseRef {
class FixedDoubleArrayRef : public FixedArrayBaseRef { class FixedDoubleArrayRef : public FixedArrayBaseRef {
public: public:
using FixedArrayBaseRef::FixedArrayBaseRef; using FixedArrayBaseRef::FixedArrayBaseRef;
Handle<FixedDoubleArray> object() const;
double get_scalar(int i) const; double get_scalar(int i) const;
bool is_the_hole(int i) const; bool is_the_hole(int i) const;
...@@ -416,6 +443,7 @@ class FixedDoubleArrayRef : public FixedArrayBaseRef { ...@@ -416,6 +443,7 @@ class FixedDoubleArrayRef : public FixedArrayBaseRef {
class BytecodeArrayRef : public FixedArrayBaseRef { class BytecodeArrayRef : public FixedArrayBaseRef {
public: public:
using FixedArrayBaseRef::FixedArrayBaseRef; using FixedArrayBaseRef::FixedArrayBaseRef;
Handle<BytecodeArray> object() const;
int register_count() const; int register_count() const;
}; };
...@@ -423,6 +451,7 @@ class BytecodeArrayRef : public FixedArrayBaseRef { ...@@ -423,6 +451,7 @@ class BytecodeArrayRef : public FixedArrayBaseRef {
class JSArrayRef : public JSObjectRef { class JSArrayRef : public JSObjectRef {
public: public:
using JSObjectRef::JSObjectRef; using JSObjectRef::JSObjectRef;
Handle<JSArray> object() const;
ObjectRef length() const; ObjectRef length() const;
}; };
...@@ -430,6 +459,7 @@ class JSArrayRef : public JSObjectRef { ...@@ -430,6 +459,7 @@ class JSArrayRef : public JSObjectRef {
class ScopeInfoRef : public HeapObjectRef { class ScopeInfoRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<ScopeInfo> object() const;
int ContextLength() const; int ContextLength() const;
}; };
...@@ -451,6 +481,7 @@ class ScopeInfoRef : public HeapObjectRef { ...@@ -451,6 +481,7 @@ class ScopeInfoRef : public HeapObjectRef {
class SharedFunctionInfoRef : public HeapObjectRef { class SharedFunctionInfoRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<SharedFunctionInfo> object() const;
int builtin_id() const; int builtin_id() const;
BytecodeArrayRef GetBytecodeArray() const; BytecodeArrayRef GetBytecodeArray() const;
...@@ -462,6 +493,7 @@ class SharedFunctionInfoRef : public HeapObjectRef { ...@@ -462,6 +493,7 @@ class SharedFunctionInfoRef : public HeapObjectRef {
class StringRef : public NameRef { class StringRef : public NameRef {
public: public:
using NameRef::NameRef; using NameRef::NameRef;
Handle<String> object() const;
int length() const; int length() const;
uint16_t GetFirstChar(); uint16_t GetFirstChar();
...@@ -473,6 +505,7 @@ class StringRef : public NameRef { ...@@ -473,6 +505,7 @@ class StringRef : public NameRef {
class JSTypedArrayRef : public JSObjectRef { class JSTypedArrayRef : public JSObjectRef {
public: public:
using JSObjectRef::JSObjectRef; using JSObjectRef::JSObjectRef;
Handle<JSTypedArray> object() const;
bool is_on_heap() const; bool is_on_heap() const;
size_t length_value() const; size_t length_value() const;
...@@ -486,6 +519,7 @@ class JSTypedArrayRef : public JSObjectRef { ...@@ -486,6 +519,7 @@ class JSTypedArrayRef : public JSObjectRef {
class ModuleRef : public HeapObjectRef { class ModuleRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<Module> object() const;
void Serialize(); void Serialize();
...@@ -495,6 +529,7 @@ class ModuleRef : public HeapObjectRef { ...@@ -495,6 +529,7 @@ class ModuleRef : public HeapObjectRef {
class CellRef : public HeapObjectRef { class CellRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<Cell> object() const;
ObjectRef value() const; ObjectRef value() const;
}; };
...@@ -502,20 +537,21 @@ class CellRef : public HeapObjectRef { ...@@ -502,20 +537,21 @@ class CellRef : public HeapObjectRef {
class JSGlobalProxyRef : public JSObjectRef { class JSGlobalProxyRef : public JSObjectRef {
public: public:
using JSObjectRef::JSObjectRef; using JSObjectRef::JSObjectRef;
Handle<JSGlobalProxy> object() const;
}; };
class CodeRef : public HeapObjectRef { class CodeRef : public HeapObjectRef {
public: public:
using HeapObjectRef::HeapObjectRef; using HeapObjectRef::HeapObjectRef;
Handle<Code> object() const;
}; };
class InternalizedStringRef : public StringRef { class InternalizedStringRef : public StringRef {
public: public:
using StringRef::StringRef; using StringRef::StringRef;
Handle<InternalizedString> object() const;
}; };
class PerIsolateCompilerCache;
class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) { class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
public: public:
JSHeapBroker(Isolate* isolate, Zone* broker_zone); JSHeapBroker(Isolate* isolate, Zone* broker_zone);
......
...@@ -190,7 +190,7 @@ JSNativeContextSpecialization::CreateDelayedStringConstant(Node* node) { ...@@ -190,7 +190,7 @@ JSNativeContextSpecialization::CreateDelayedStringConstant(Node* node) {
if (matcher.HasValue() && matcher.Ref(broker()).IsString()) { if (matcher.HasValue() && matcher.Ref(broker()).IsString()) {
StringRef s = matcher.Ref(broker()).AsString(); StringRef s = matcher.Ref(broker()).AsString();
return new (shared_zone()) return new (shared_zone())
StringLiteral(s.object<String>(), static_cast<size_t>(s.length())); StringLiteral(s.object(), static_cast<size_t>(s.length()));
} else { } else {
UNREACHABLE(); UNREACHABLE();
} }
...@@ -403,9 +403,8 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) { ...@@ -403,9 +403,8 @@ Reduction JSNativeContextSpecialization::ReduceJSInstanceOf(Node* node) {
// Compute property access info for @@hasInstance on {receiver}. // Compute property access info for @@hasInstance on {receiver}.
PropertyAccessInfo access_info; PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(
native_context().object<Context>(), broker(), dependencies(), native_context().object(), graph()->zone());
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo( if (!access_info_factory.ComputePropertyAccessInfo(
receiver_map, factory()->has_instance_symbol(), AccessMode::kLoad, receiver_map, factory()->has_instance_symbol(), AccessMode::kLoad,
&access_info)) { &access_info)) {
...@@ -695,9 +694,8 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) { ...@@ -695,9 +694,8 @@ Reduction JSNativeContextSpecialization::ReduceJSResolvePromise(Node* node) {
// Compute property access info for "then" on {resolution}. // Compute property access info for "then" on {resolution}.
PropertyAccessInfo access_info; PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(
native_context().object<Context>(), broker(), dependencies(), native_context().object(), graph()->zone());
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo( if (!access_info_factory.ComputePropertyAccessInfo(
MapHandles(resolution_maps.begin(), resolution_maps.end()), MapHandles(resolution_maps.begin(), resolution_maps.end()),
factory()->then_string(), AccessMode::kLoad, &access_info)) { factory()->then_string(), AccessMode::kLoad, &access_info)) {
...@@ -852,7 +850,7 @@ Reduction JSNativeContextSpecialization::ReduceGlobalAccess( ...@@ -852,7 +850,7 @@ Reduction JSNativeContextSpecialization::ReduceGlobalAccess(
// mutated without the cell state being updated. // mutated without the cell state being updated.
if (property_cell_value_map.is_stable()) { if (property_cell_value_map.is_stable()) {
dependencies()->DependOnStableMap(property_cell_value_map); dependencies()->DependOnStableMap(property_cell_value_map);
map = property_cell_value_map.object<Map>(); map = property_cell_value_map.object();
} }
} }
} }
...@@ -968,7 +966,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) { ...@@ -968,7 +966,7 @@ Reduction JSNativeContextSpecialization::ReduceJSLoadGlobal(Node* node) {
} }
// Lookup the {name} on the global object instead. // Lookup the {name} on the global object instead.
return ReduceGlobalAccess(node, nullptr, nullptr, name.object<Name>(), return ReduceGlobalAccess(node, nullptr, nullptr, name.object(),
AccessMode::kLoad); AccessMode::kLoad);
} }
...@@ -997,7 +995,7 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) { ...@@ -997,7 +995,7 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreGlobal(Node* node) {
} }
// Lookup the {name} on the global object instead. // Lookup the {name} on the global object instead.
return ReduceGlobalAccess(node, nullptr, value, name.object<Name>(), return ReduceGlobalAccess(node, nullptr, value, name.object(),
AccessMode::kStore); AccessMode::kStore);
} }
...@@ -1025,7 +1023,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -1025,7 +1023,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
// Detached global proxies have |null| as their constructor. // Detached global proxies have |null| as their constructor.
if (maybe_constructor->IsJSFunction() && if (maybe_constructor->IsJSFunction() &&
JSFunction::cast(maybe_constructor)->native_context() == JSFunction::cast(maybe_constructor)->native_context() ==
*native_context().object<Context>()) { *native_context().object()) {
return ReduceGlobalAccess(node, receiver, value, name, access_mode, return ReduceGlobalAccess(node, receiver, value, name, access_mode,
index); index);
} }
...@@ -1033,9 +1031,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess( ...@@ -1033,9 +1031,8 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
} }
// Compute property access infos for the receiver maps. // Compute property access infos for the receiver maps.
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(
native_context().object<Context>(), broker(), dependencies(), native_context().object(), graph()->zone());
graph()->zone());
ZoneVector<PropertyAccessInfo> access_infos(zone()); ZoneVector<PropertyAccessInfo> access_infos(zone());
if (!access_info_factory.ComputePropertyAccessInfos( if (!access_info_factory.ComputePropertyAccessInfos(
receiver_maps, name, access_mode, &access_infos)) { receiver_maps, name, access_mode, &access_infos)) {
...@@ -1409,9 +1406,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess( ...@@ -1409,9 +1406,8 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
} else { } else {
// Retrieve the native context from the given {node}. // Retrieve the native context from the given {node}.
// Compute element access infos for the receiver maps. // Compute element access infos for the receiver maps.
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(
native_context().object<Context>(), broker(), dependencies(), native_context().object(), graph()->zone());
graph()->zone());
ZoneVector<ElementAccessInfo> access_infos(zone()); ZoneVector<ElementAccessInfo> access_infos(zone());
if (!access_info_factory.ComputeElementAccessInfos( if (!access_info_factory.ComputeElementAccessInfos(
receiver_maps, access_mode, &access_infos)) { receiver_maps, access_mode, &access_infos)) {
...@@ -2312,9 +2308,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral( ...@@ -2312,9 +2308,8 @@ Reduction JSNativeContextSpecialization::ReduceJSStoreDataPropertyInLiteral(
isolate()); isolate());
PropertyAccessInfo access_info; PropertyAccessInfo access_info;
AccessInfoFactory access_info_factory(broker(), dependencies(), AccessInfoFactory access_info_factory(
native_context().object<Context>(), broker(), dependencies(), native_context().object(), graph()->zone());
graph()->zone());
if (!access_info_factory.ComputePropertyAccessInfo( if (!access_info_factory.ComputePropertyAccessInfo(
receiver_map, cached_name, AccessMode::kStoreInLiteral, receiver_map, cached_name, AccessMode::kStoreInLiteral,
&access_info)) { &access_info)) {
......
...@@ -381,7 +381,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( ...@@ -381,7 +381,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
if (receiver.map().is_stable()) { if (receiver.map().is_stable()) {
// The {receiver_map} is only reliable when we install a stability // The {receiver_map} is only reliable when we install a stability
// code dependency. // code dependency.
*maps_return = ZoneHandleSet<Map>(receiver.map().object<Map>()); *maps_return = ZoneHandleSet<Map>(receiver.map().object());
return kUnreliableReceiverMaps; return kUnreliableReceiverMaps;
} }
} }
...@@ -418,7 +418,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( ...@@ -418,7 +418,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
MapRef initial_map = original_constructor.initial_map(); MapRef initial_map = original_constructor.initial_map();
if (initial_map.constructor_or_backpointer().equals( if (initial_map.constructor_or_backpointer().equals(
mtarget.Ref(broker))) { mtarget.Ref(broker))) {
*maps_return = ZoneHandleSet<Map>(initial_map.object<Map>()); *maps_return = ZoneHandleSet<Map>(initial_map.object());
return result; return result;
} }
} }
...@@ -438,7 +438,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps( ...@@ -438,7 +438,7 @@ NodeProperties::InferReceiverMapsResult NodeProperties::InferReceiverMaps(
Node* const value = GetValueInput(effect, 1); Node* const value = GetValueInput(effect, 1);
HeapObjectMatcher m(value); HeapObjectMatcher m(value);
if (m.HasValue()) { if (m.HasValue()) {
*maps_return = ZoneHandleSet<Map>(m.Ref(broker).object<Map>()); *maps_return = ZoneHandleSet<Map>(m.Ref(broker).AsMap().object());
return result; return result;
} }
} }
......
...@@ -483,7 +483,7 @@ HeapConstantType::HeapConstantType(BitsetType::bitset bitset, ...@@ -483,7 +483,7 @@ HeapConstantType::HeapConstantType(BitsetType::bitset bitset,
: TypeBase(kHeapConstant), bitset_(bitset), heap_ref_(heap_ref) {} : TypeBase(kHeapConstant), bitset_(bitset), heap_ref_(heap_ref) {}
Handle<HeapObject> HeapConstantType::Value() const { Handle<HeapObject> HeapConstantType::Value() const {
return heap_ref_.object<HeapObject>(); return heap_ref_.object();
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
......
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