Commit 394d198f authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[turbofan] Use precise types for ObjectData* members.

Now that we always instantiate the right ObjectData subclass, we can
give precise types to members.

R=jarin@chromium.org

Bug: v8:7790
Change-Id: Ic2194de90f458ddccbeb9f101903e5865fb4eb41
Reviewed-on: https://chromium-review.googlesource.com/1187103Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#55404}
parent 819efd1e
...@@ -54,13 +54,13 @@ class HeapObjectData : public ObjectData { ...@@ -54,13 +54,13 @@ class HeapObjectData : public ObjectData {
Handle<HeapObject> object); Handle<HeapObject> object);
HeapObjectType const type; HeapObjectType const type;
ObjectData* const map; MapData* const map;
HeapObjectData(JSHeapBroker* broker_, Handle<HeapObject> object_, HeapObjectData(JSHeapBroker* broker_, Handle<HeapObject> object_,
HeapObjectType type_) HeapObjectType type_)
: ObjectData(broker_, object_, false), : ObjectData(broker_, object_, false),
type(type_), type(type_),
map(GET_OR_CREATE(map)) { map(GET_OR_CREATE(map)->AsMap()) {
CHECK(broker_->SerializingAllowed()); CHECK(broker_->SerializingAllowed());
} }
}; };
...@@ -81,12 +81,12 @@ class JSObjectData : public HeapObjectData { ...@@ -81,12 +81,12 @@ class JSObjectData : public HeapObjectData {
class JSFunctionData : public JSObjectData { class JSFunctionData : public JSObjectData {
public: public:
ObjectData* const global_proxy; JSGlobalProxyData* const global_proxy;
ObjectData* const initial_map; // Can be nullptr. MapData* const initial_map; // Can be nullptr.
bool const has_prototype; bool const has_prototype;
ObjectData* const prototype; // Can be nullptr. ObjectData* const prototype; // Can be nullptr.
bool const PrototypeRequiresRuntimeLookup; bool const PrototypeRequiresRuntimeLookup;
ObjectData* const shared; SharedFunctionInfoData* const shared;
JSFunctionData(JSHeapBroker* broker_, Handle<JSFunction> object_, JSFunctionData(JSHeapBroker* broker_, Handle<JSFunction> object_,
HeapObjectType type_); HeapObjectType type_);
...@@ -122,14 +122,14 @@ class ContextData : public HeapObjectData { ...@@ -122,14 +122,14 @@ class ContextData : public HeapObjectData {
class NativeContextData : public ContextData { class NativeContextData : public ContextData {
public: public:
#define DECL_MEMBER(type, name) ObjectData* const name; #define DECL_MEMBER(type, name) type##Data* const name;
BROKER_NATIVE_CONTEXT_FIELDS(DECL_MEMBER) BROKER_NATIVE_CONTEXT_FIELDS(DECL_MEMBER)
#undef DECL_MEMBER #undef DECL_MEMBER
NativeContextData(JSHeapBroker* broker_, Handle<NativeContext> object_, NativeContextData(JSHeapBroker* broker_, Handle<NativeContext> object_,
HeapObjectType type_) HeapObjectType type_)
: ContextData(broker_, object_, type_) : ContextData(broker_, object_, type_)
#define INIT_MEMBER(type, name) , name(GET_OR_CREATE(name)) #define INIT_MEMBER(type, name) , name(GET_OR_CREATE(name)->As##type())
BROKER_NATIVE_CONTEXT_FIELDS(INIT_MEMBER) BROKER_NATIVE_CONTEXT_FIELDS(INIT_MEMBER)
#undef INIT_MEMBER #undef INIT_MEMBER
{ {
...@@ -327,17 +327,16 @@ MapData::MapData(JSHeapBroker* broker_, Handle<Map> object_, ...@@ -327,17 +327,16 @@ MapData::MapData(JSHeapBroker* broker_, Handle<Map> object_,
JSFunctionData::JSFunctionData(JSHeapBroker* broker_, JSFunctionData::JSFunctionData(JSHeapBroker* broker_,
Handle<JSFunction> object_, HeapObjectType type_) Handle<JSFunction> object_, HeapObjectType type_)
: JSObjectData(broker_, object_, type_), : JSObjectData(broker_, object_, type_),
global_proxy(GET_OR_CREATE(global_proxy)), global_proxy(GET_OR_CREATE(global_proxy)->AsJSGlobalProxy()),
initial_map(object_->has_prototype_slot() && object_->has_initial_map() initial_map(object_->has_prototype_slot() && object_->has_initial_map()
? GET_OR_CREATE(initial_map) ? GET_OR_CREATE(initial_map)->AsMap()
: nullptr), : nullptr),
has_prototype(object_->has_prototype_slot() && object_->has_prototype()), has_prototype(object_->has_prototype_slot() && object_->has_prototype()),
prototype(has_prototype ? GET_OR_CREATE(prototype) : nullptr), prototype(has_prototype ? GET_OR_CREATE(prototype) : nullptr),
PrototypeRequiresRuntimeLookup(object_->PrototypeRequiresRuntimeLookup()), PrototypeRequiresRuntimeLookup(object_->PrototypeRequiresRuntimeLookup()),
shared(GET_OR_CREATE(shared)) { shared(GET_OR_CREATE(shared)->AsSharedFunctionInfo()) {
if (initial_map != nullptr && if (initial_map != nullptr && initial_map->instance_type == JS_ARRAY_TYPE) {
initial_map->AsMap()->instance_type == JS_ARRAY_TYPE) { initial_map->SerializeElementsKindGeneralizations();
initial_map->AsMap()->SerializeElementsKindGeneralizations();
} }
} }
...@@ -433,7 +432,7 @@ class ScopeInfoData : public HeapObjectData { ...@@ -433,7 +432,7 @@ class ScopeInfoData : public HeapObjectData {
class SharedFunctionInfoData : public HeapObjectData { class SharedFunctionInfoData : public HeapObjectData {
public: public:
int const builtin_id; int const builtin_id;
ObjectData* const GetBytecodeArray; // Can be nullptr. BytecodeArrayData* const GetBytecodeArray; // Can be nullptr.
#define DECL_MEMBER(type, name) type const name; #define DECL_MEMBER(type, name) type const name;
BROKER_SFI_FIELDS(DECL_MEMBER) BROKER_SFI_FIELDS(DECL_MEMBER)
#undef DECL_MEMBER #undef DECL_MEMBER
...@@ -444,9 +443,10 @@ class SharedFunctionInfoData : public HeapObjectData { ...@@ -444,9 +443,10 @@ class SharedFunctionInfoData : public HeapObjectData {
: HeapObjectData(broker_, object_, type_), : HeapObjectData(broker_, object_, type_),
builtin_id(object_->HasBuiltinId() ? object_->builtin_id() builtin_id(object_->HasBuiltinId() ? object_->builtin_id()
: Builtins::kNoBuiltinId), : Builtins::kNoBuiltinId),
GetBytecodeArray(object_->HasBytecodeArray() GetBytecodeArray(
? GET_OR_CREATE(GetBytecodeArray) object_->HasBytecodeArray()
: nullptr) ? GET_OR_CREATE(GetBytecodeArray)->AsBytecodeArray()
: nullptr)
#define INIT_MEMBER(type, name) , name(object_->name()) #define INIT_MEMBER(type, name) , name(object_->name())
BROKER_SFI_FIELDS(INIT_MEMBER) BROKER_SFI_FIELDS(INIT_MEMBER)
#undef INIT_MEMBER #undef INIT_MEMBER
......
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