Commit 541a0b75 authored by Jaroslav Sevcik's avatar Jaroslav Sevcik Committed by Commit Bot

[turbofan] Use heap broker for accesses in JSCreateLowering::ReduceJSCreateLiteralArrayOrObject.

This does not move the dependency management there, yet.

Bug: v8:7790
Change-Id: Ia8b473a89c2853ffeba4adf84ac8814f403279c9
Reviewed-on: https://chromium-review.googlesource.com/1112256
Commit-Queue: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54004}
parent 75f14dbf
This diff is collapsed.
...@@ -24,6 +24,7 @@ namespace compiler { ...@@ -24,6 +24,7 @@ namespace compiler {
class CommonOperatorBuilder; class CommonOperatorBuilder;
class JSGraph; class JSGraph;
class JSHeapBroker; class JSHeapBroker;
class JSObjectRef;
class JSOperatorBuilder; class JSOperatorBuilder;
class MachineOperatorBuilder; class MachineOperatorBuilder;
class SimplifiedOperatorBuilder; class SimplifiedOperatorBuilder;
...@@ -97,10 +98,9 @@ class V8_EXPORT_PRIVATE JSCreateLowering final ...@@ -97,10 +98,9 @@ class V8_EXPORT_PRIVATE JSCreateLowering final
std::vector<Node*> const& values, std::vector<Node*> const& values,
PretenureFlag pretenure); PretenureFlag pretenure);
Node* AllocateFastLiteral(Node* effect, Node* control, Node* AllocateFastLiteral(Node* effect, Node* control,
Handle<JSObject> boilerplate, JSObjectRef boilerplate, PretenureFlag pretenure);
PretenureFlag pretenure);
Node* AllocateFastLiteralElements(Node* effect, Node* control, Node* AllocateFastLiteralElements(Node* effect, Node* control,
Handle<JSObject> boilerplate, JSObjectRef boilerplate,
PretenureFlag pretenure); PretenureFlag pretenure);
Node* AllocateLiteralRegExp(Node* effect, Node* control, Node* AllocateLiteralRegExp(Node* effect, Node* control,
Handle<JSRegExp> boilerplate); Handle<JSRegExp> boilerplate);
......
This diff is collapsed.
...@@ -20,6 +20,7 @@ enum class OddballType : uint8_t { ...@@ -20,6 +20,7 @@ enum class OddballType : uint8_t {
kUndefined, kUndefined,
kNull, kNull,
kHole, kHole,
kUninitialized,
kOther, // Oddball, but none of the above. kOther, // Oddball, but none of the above.
kAny // Any Oddball. kAny // Any Oddball.
}; };
...@@ -53,13 +54,22 @@ class HeapObjectType { ...@@ -53,13 +54,22 @@ class HeapObjectType {
}; };
#define HEAP_BROKER_DATA_LIST(V) \ #define HEAP_BROKER_DATA_LIST(V) \
V(AllocationSite) \
V(Context) \ V(Context) \
V(FeedbackVector) \
V(FixedArray) \
V(FixedArrayBase) \
V(FixedDoubleArray) \
V(HeapNumber) \ V(HeapNumber) \
V(HeapObject) \ V(HeapObject) \
V(JSArray) \
V(JSFunction) \ V(JSFunction) \
V(JSObject) \
V(MutableHeapNumber) \
V(Name) \ V(Name) \
V(NativeContext) \ V(NativeContext) \
V(ScriptContextTable) V(ScriptContextTable) \
V(Map)
#define HEAP_BROKER_KIND_LIST(V) \ #define HEAP_BROKER_KIND_LIST(V) \
HEAP_BROKER_DATA_LIST(V) \ HEAP_BROKER_DATA_LIST(V) \
...@@ -105,6 +115,8 @@ class HeapObjectRef : public ObjectRef { ...@@ -105,6 +115,8 @@ class HeapObjectRef : public ObjectRef {
explicit HeapObjectRef(Handle<Object> object); explicit HeapObjectRef(Handle<Object> object);
HeapObjectType type(const JSHeapBroker* broker) const; HeapObjectType type(const JSHeapBroker* broker) const;
MapRef map(const JSHeapBroker* broker) const;
private: private:
friend class JSHeapBroker; friend class JSHeapBroker;
}; };
...@@ -129,7 +141,20 @@ class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -129,7 +141,20 @@ class V8_EXPORT_PRIVATE JSHeapBroker : public NON_EXPORTED_BASE(ZoneObject) {
Isolate* const isolate_; Isolate* const isolate_;
}; };
class JSFunctionRef : public HeapObjectRef { class JSObjectRef : public HeapObjectRef {
public:
explicit JSObjectRef(Handle<Object> object) : HeapObjectRef(object) {}
bool IsUnboxedDoubleField(FieldIndex index) const;
double RawFastDoublePropertyAt(FieldIndex index) const;
ObjectRef RawFastPropertyAt(const JSHeapBroker* broker,
FieldIndex index) const;
FixedArrayBaseRef elements(const JSHeapBroker* broker) const;
void EnsureElementsTenured(const JSHeapBroker* broker);
};
class JSFunctionRef : public JSObjectRef {
public: public:
explicit JSFunctionRef(Handle<Object> object); explicit JSFunctionRef(Handle<Object> object);
bool HasBuiltinFunctionId() const; bool HasBuiltinFunctionId() const;
...@@ -142,6 +167,12 @@ class HeapNumberRef : public HeapObjectRef { ...@@ -142,6 +167,12 @@ class HeapNumberRef : public HeapObjectRef {
double value() const; double value() const;
}; };
class MutableHeapNumberRef : public HeapObjectRef {
public:
explicit MutableHeapNumberRef(Handle<Object> object);
double value() const;
};
class ContextRef : public HeapObjectRef { class ContextRef : public HeapObjectRef {
public: public:
explicit ContextRef(Handle<Object> object); explicit ContextRef(Handle<Object> object);
...@@ -173,6 +204,73 @@ class ScriptContextTableRef : public HeapObjectRef { ...@@ -173,6 +204,73 @@ class ScriptContextTableRef : public HeapObjectRef {
base::Optional<LookupResult> lookup(const NameRef& name) const; base::Optional<LookupResult> lookup(const NameRef& name) const;
}; };
class FeedbackVectorRef : public HeapObjectRef {
public:
explicit FeedbackVectorRef(Handle<Object> object) : HeapObjectRef(object) {}
ObjectRef get(const JSHeapBroker* broker, FeedbackSlot slot) const;
};
class AllocationSiteRef : public HeapObjectRef {
public:
explicit AllocationSiteRef(Handle<HeapObject> object)
: HeapObjectRef(object) {}
JSObjectRef boilerplate(const JSHeapBroker* broker) const;
PretenureFlag GetPretenureMode() const;
bool IsFastLiteral(const JSHeapBroker* broker);
};
class MapRef : public HeapObjectRef {
public:
explicit MapRef(Handle<HeapObject> object) : HeapObjectRef(object) {}
int instance_size() const;
InstanceType instance_type() const;
int GetInObjectProperties() const;
int NumberOfOwnDescriptors() const;
PropertyDetails GetPropertyDetails(int i) const;
NameRef GetPropertyKey(const JSHeapBroker* broker, int i) const;
FieldIndex GetFieldIndexFor(int i) const;
bool IsJSArrayMap() const;
bool IsFixedCowArrayMap(const JSHeapBroker* broker) const;
};
class FixedArrayBaseRef : public HeapObjectRef {
public:
explicit FixedArrayBaseRef(Handle<HeapObject> object)
: HeapObjectRef(object) {}
int length() const;
};
class FixedArrayRef : public FixedArrayBaseRef {
public:
explicit FixedArrayRef(Handle<HeapObject> object)
: FixedArrayBaseRef(object) {}
bool is_the_hole(const JSHeapBroker* broker, int i) const;
ObjectRef get(const JSHeapBroker* broker, int i) const;
};
class FixedDoubleArrayRef : public FixedArrayBaseRef {
public:
explicit FixedDoubleArrayRef(Handle<HeapObject> object)
: FixedArrayBaseRef(object) {}
bool is_the_hole(int i) const;
double get_scalar(int i) const;
};
class JSArrayRef : public JSObjectRef {
public:
explicit JSArrayRef(Handle<Object> object) : JSObjectRef(object) {}
ElementsKind GetElementsKind() const;
ObjectRef length(const JSHeapBroker* broker) const;
};
} // namespace compiler } // namespace compiler
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -164,6 +164,8 @@ Type::bitset BitsetType::Lub(HeapObjectType const& type) { ...@@ -164,6 +164,8 @@ Type::bitset BitsetType::Lub(HeapObjectType const& type) {
return kBigInt; return kBigInt;
case ODDBALL_TYPE: case ODDBALL_TYPE:
switch (type.oddball_type()) { switch (type.oddball_type()) {
case OddballType::kNone:
break;
case OddballType::kHole: case OddballType::kHole:
return kHole; return kHole;
case OddballType::kBoolean: case OddballType::kBoolean:
...@@ -172,14 +174,14 @@ Type::bitset BitsetType::Lub(HeapObjectType const& type) { ...@@ -172,14 +174,14 @@ Type::bitset BitsetType::Lub(HeapObjectType const& type) {
return kNull; return kNull;
case OddballType::kUndefined: case OddballType::kUndefined:
return kUndefined; return kUndefined;
case OddballType::kUninitialized:
case OddballType::kOther: case OddballType::kOther:
// TODO(neis): We should add a kOtherOddball type. // TODO(neis): We should add a kOtherOddball type.
return kOtherInternal; return kOtherInternal;
case OddballType::kAny: case OddballType::kAny:
return kOddball | kOtherInternal; return kOddball | kOtherInternal;
default:
UNREACHABLE();
} }
UNREACHABLE();
case HEAP_NUMBER_TYPE: case HEAP_NUMBER_TYPE:
return kNumber; return kNumber;
case JS_OBJECT_TYPE: case JS_OBJECT_TYPE:
......
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