Commit c6effdbb authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

[objects.h splitting] Move PrototypeInfo.

BUG=v8:7754,v8:5402

Change-Id: Iccbf453e6b27e4e2604bd3f074882bf864e01070
Reviewed-on: https://chromium-review.googlesource.com/1131129Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Commit-Queue: Marja Hölttä <marja@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54399}
parent d20c1414
......@@ -2180,6 +2180,8 @@ v8_source_set("v8_base") {
"src/objects/promise.h",
"src/objects/property-descriptor-object-inl.h",
"src/objects/property-descriptor-object.h",
"src/objects/prototype-info-inl.h",
"src/objects/prototype-info.h",
"src/objects/regexp-match-info.h",
"src/objects/scope-info.cc",
"src/objects/scope-info.h",
......
......@@ -645,7 +645,6 @@ CAST_ACCESSOR(OrderedHashMap)
CAST_ACCESSOR(OrderedHashSet)
CAST_ACCESSOR(PropertyArray)
CAST_ACCESSOR(PropertyCell)
CAST_ACCESSOR(PrototypeInfo)
CAST_ACCESSOR(RegExpMatchInfo)
CAST_ACCESSOR(ScopeInfo)
CAST_ACCESSOR(SimpleNumberDictionary)
......@@ -2391,28 +2390,6 @@ SMI_ACCESSORS(AsyncGeneratorRequest, resume_mode, kResumeModeOffset)
ACCESSORS(AsyncGeneratorRequest, value, Object, kValueOffset)
ACCESSORS(AsyncGeneratorRequest, promise, Object, kPromiseOffset)
Map* PrototypeInfo::ObjectCreateMap() {
return Map::cast(object_create_map()->ToWeakHeapObject());
}
// static
void PrototypeInfo::SetObjectCreateMap(Handle<PrototypeInfo> info,
Handle<Map> map) {
info->set_object_create_map(HeapObjectReference::Weak(*map));
}
bool PrototypeInfo::HasObjectCreateMap() {
MaybeObject* cache = object_create_map();
return cache->IsWeakHeapObject();
}
ACCESSORS(PrototypeInfo, weak_cell, Object, kWeakCellOffset)
ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
WEAK_ACCESSORS(PrototypeInfo, object_create_map, kObjectCreateMapOffset)
SMI_ACCESSORS(PrototypeInfo, registry_slot, kRegistrySlotOffset)
SMI_ACCESSORS(PrototypeInfo, bit_field, kBitFieldOffset)
BOOL_ACCESSORS(PrototypeInfo, bit_field, should_be_fast_map, kShouldBeFastBit)
ACCESSORS(Tuple2, value1, Object, kValue1Offset)
ACCESSORS(Tuple2, value2, Object, kValue2Offset)
ACCESSORS(Tuple3, value3, Object, kValue3Offset)
......
......@@ -2774,60 +2774,6 @@ class AsyncGeneratorRequest : public Struct {
DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncGeneratorRequest);
};
// Container for metadata stored on each prototype map.
class PrototypeInfo : public Struct {
public:
static const int UNREGISTERED = -1;
// [weak_cell]: A WeakCell containing this prototype. ICs cache the cell here.
DECL_ACCESSORS(weak_cell, Object)
// [prototype_users]: FixedArrayOfWeakCells containing maps using this
// prototype, or Smi(0) if uninitialized.
DECL_ACCESSORS(prototype_users, Object)
// [object_create_map]: A field caching the map for Object.create(prototype).
static inline void SetObjectCreateMap(Handle<PrototypeInfo> info,
Handle<Map> map);
inline Map* ObjectCreateMap();
inline bool HasObjectCreateMap();
// [registry_slot]: Slot in prototype's user registry where this user
// is stored. Returns UNREGISTERED if this prototype has not been registered.
inline int registry_slot() const;
inline void set_registry_slot(int slot);
// [bit_field]
inline int bit_field() const;
inline void set_bit_field(int bit_field);
DECL_BOOLEAN_ACCESSORS(should_be_fast_map)
DECL_CAST(PrototypeInfo)
// Dispatched behavior.
DECL_PRINTER(PrototypeInfo)
DECL_VERIFIER(PrototypeInfo)
static const int kWeakCellOffset = HeapObject::kHeaderSize;
static const int kPrototypeUsersOffset = kWeakCellOffset + kPointerSize;
static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
static const int kObjectCreateMapOffset = kValidityCellOffset + kPointerSize;
static const int kBitFieldOffset = kObjectCreateMapOffset + kPointerSize;
static const int kSize = kBitFieldOffset + kPointerSize;
// Bit field usage.
static const int kShouldBeFastBit = 0;
class BodyDescriptor;
private:
DECL_ACCESSORS(object_create_map, MaybeObject)
DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
};
// List of builtin functions we want to identify to improve code
// generation.
//
......
......@@ -11,6 +11,7 @@
#include "src/objects-inl.h"
#include "src/objects/api-callbacks-inl.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/prototype-info-inl.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/templates-inl.h"
#include "src/property.h"
......
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_PROTOTYPE_INFO_INL_H_
#define V8_OBJECTS_PROTOTYPE_INFO_INL_H_
#include "src/objects/prototype-info.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
CAST_ACCESSOR(PrototypeInfo)
Map* PrototypeInfo::ObjectCreateMap() {
return Map::cast(object_create_map()->ToWeakHeapObject());
}
// static
void PrototypeInfo::SetObjectCreateMap(Handle<PrototypeInfo> info,
Handle<Map> map) {
info->set_object_create_map(HeapObjectReference::Weak(*map));
}
bool PrototypeInfo::HasObjectCreateMap() {
MaybeObject* cache = object_create_map();
return cache->IsWeakHeapObject();
}
ACCESSORS(PrototypeInfo, weak_cell, Object, kWeakCellOffset)
ACCESSORS(PrototypeInfo, prototype_users, Object, kPrototypeUsersOffset)
WEAK_ACCESSORS(PrototypeInfo, object_create_map, kObjectCreateMapOffset)
SMI_ACCESSORS(PrototypeInfo, registry_slot, kRegistrySlotOffset)
SMI_ACCESSORS(PrototypeInfo, bit_field, kBitFieldOffset)
BOOL_ACCESSORS(PrototypeInfo, bit_field, should_be_fast_map, kShouldBeFastBit)
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_PROTOTYPE_INFO_INL_H_
// Copyright 2018 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_OBJECTS_PROTOTYPE_INFO_H_
#define V8_OBJECTS_PROTOTYPE_INFO_H_
#include "src/objects.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
// Container for metadata stored on each prototype map.
class PrototypeInfo : public Struct {
public:
static const int UNREGISTERED = -1;
// [weak_cell]: A WeakCell containing this prototype. ICs cache the cell here.
DECL_ACCESSORS(weak_cell, Object)
// [prototype_users]: FixedArrayOfWeakCells containing maps using this
// prototype, or Smi(0) if uninitialized.
DECL_ACCESSORS(prototype_users, Object)
// [object_create_map]: A field caching the map for Object.create(prototype).
static inline void SetObjectCreateMap(Handle<PrototypeInfo> info,
Handle<Map> map);
inline Map* ObjectCreateMap();
inline bool HasObjectCreateMap();
// [registry_slot]: Slot in prototype's user registry where this user
// is stored. Returns UNREGISTERED if this prototype has not been registered.
inline int registry_slot() const;
inline void set_registry_slot(int slot);
// [bit_field]
inline int bit_field() const;
inline void set_bit_field(int bit_field);
DECL_BOOLEAN_ACCESSORS(should_be_fast_map)
DECL_CAST(PrototypeInfo)
// Dispatched behavior.
DECL_PRINTER(PrototypeInfo)
DECL_VERIFIER(PrototypeInfo)
static const int kWeakCellOffset = HeapObject::kHeaderSize;
static const int kPrototypeUsersOffset = kWeakCellOffset + kPointerSize;
static const int kRegistrySlotOffset = kPrototypeUsersOffset + kPointerSize;
static const int kValidityCellOffset = kRegistrySlotOffset + kPointerSize;
static const int kObjectCreateMapOffset = kValidityCellOffset + kPointerSize;
static const int kBitFieldOffset = kObjectCreateMapOffset + kPointerSize;
static const int kSize = kBitFieldOffset + kPointerSize;
// Bit field usage.
static const int kShouldBeFastBit = 0;
class BodyDescriptor;
private:
DECL_ACCESSORS(object_create_map, MaybeObject)
DISALLOW_IMPLICIT_CONSTRUCTORS(PrototypeInfo);
};
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_PROTOTYPE_INFO_H_
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