Commit 9134c7a6 authored by ishell's avatar ishell Committed by Commit bot

PropertyType is divided into PropertyKind and PropertyStoreMode.

Review URL: https://codereview.chromium.org/786193004

Cr-Commit-Position: refs/heads/master@{#25798}
parent c535ec69
......@@ -2587,8 +2587,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
DCHECK(!to->HasFastProperties());
// Add to dictionary.
Handle<Object> callbacks(descs->GetCallbacksObject(i), isolate());
PropertyDetails d = PropertyDetails(
details.attributes(), CALLBACKS, i + 1);
PropertyDetails d(details.attributes(), CALLBACKS, i + 1);
JSObject::SetNormalizedProperty(to, key, callbacks, d);
break;
}
......
......@@ -182,7 +182,7 @@ PropertyKind.Indexed = 2;
var PropertyType = {};
PropertyType.Field = 0;
PropertyType.Constant = 1;
PropertyType.Callbacks = 2;
PropertyType.Callbacks = 3;
// Different attributes for a property.
......
......@@ -41,10 +41,24 @@ typedef TypeImpl<ZoneTypeConfig> Type;
class TypeInfo;
// Type of properties.
// Order of kinds is significant.
// Must fit in the BitField PropertyDetails::KindField.
enum PropertyKind { DATA = 0, ACCESSOR = 1 };
// Order of modes is significant.
// Must fit in the BitField PropertyDetails::StoreModeField.
enum PropertyLocation { IN_OBJECT = 0, IN_DESCRIPTOR = 1 };
// Order of properties is significant.
// Must fit in the BitField PropertyDetails::TypeField.
// A copy of this is in mirror-debugger.js.
enum PropertyType { FIELD = 0, CONSTANT = 1, CALLBACKS = 2 };
enum PropertyType {
FIELD = (IN_OBJECT << 1) | DATA,
CONSTANT = (IN_DESCRIPTOR << 1) | DATA,
CALLBACKS = (IN_DESCRIPTOR << 1) | ACCESSOR
};
class Representation {
......@@ -222,6 +236,9 @@ class PropertyDetails BASE_EMBEDDED {
return Representation::FromKind(static_cast<Representation::Kind>(bits));
}
PropertyKind kind() const { return KindField::decode(value_); }
PropertyLocation location() const { return LocationField::decode(value_); }
PropertyType type() const { return TypeField::decode(value_); }
PropertyAttributes attributes() const {
......@@ -253,7 +270,8 @@ class PropertyDetails BASE_EMBEDDED {
// Bit fields in value_ (type, shift, size). Must be public so the
// constants can be embedded in generated code.
class TypeField : public BitField<PropertyType, 0, 2> {};
class KindField : public BitField<PropertyKind, 0, 1> {};
class LocationField : public BitField<PropertyLocation, 1, 1> {};
class AttributesField : public BitField<PropertyAttributes, 2, 3> {};
// Bit fields for normalized objects.
......@@ -268,6 +286,12 @@ class PropertyDetails BASE_EMBEDDED {
: public BitField<uint32_t, 9 + kDescriptorIndexBitCount,
kDescriptorIndexBitCount> {}; // NOLINT
// NOTE: TypeField overlaps with KindField and LocationField.
class TypeField : public BitField<PropertyType, 0, 2> {};
STATIC_ASSERT(KindField::kNext == LocationField::kShift);
STATIC_ASSERT(TypeField::kShift == KindField::kShift);
STATIC_ASSERT(TypeField::kNext == LocationField::kNext);
// All bits for both fast and slow objects must fit in a smi.
STATIC_ASSERT(DictionaryStorageField::kNext <= 31);
STATIC_ASSERT(FieldIndexField::kNext <= 31);
......
......@@ -365,15 +365,11 @@ void ExternalReferenceTable::PopulateTable(Isolate* isolate) {
}
// Accessors
#define ACCESSOR_INFO_DECLARATION(name) \
Add(FUNCTION_ADDR(&Accessors::name##Getter), \
ACCESSOR, \
Accessors::k##name##Getter, \
"Accessors::" #name "Getter"); \
Add(FUNCTION_ADDR(&Accessors::name##Setter), \
ACCESSOR, \
Accessors::k##name##Setter, \
"Accessors::" #name "Setter");
#define ACCESSOR_INFO_DECLARATION(name) \
Add(FUNCTION_ADDR(&Accessors::name##Getter), ACCESSOR_CODE, \
Accessors::k##name##Getter, "Accessors::" #name "Getter"); \
Add(FUNCTION_ADDR(&Accessors::name##Setter), ACCESSOR_CODE, \
Accessors::k##name##Setter, "Accessors::" #name "Setter");
ACCESSOR_INFO_LIST(ACCESSOR_INFO_DECLARATION)
#undef ACCESSOR_INFO_DECLARATION
......
......@@ -24,7 +24,7 @@ enum TypeCode {
IC_UTILITY,
STATS_COUNTER,
TOP_ADDRESS,
ACCESSOR,
ACCESSOR_CODE,
STUB_CACHE_TABLE,
RUNTIME_ENTRY,
LAZY_DEOPTIMIZATION
......
......@@ -32,7 +32,7 @@ static double GetDoubleFieldValue(JSObject* obj, FieldIndex field_index) {
}
enum PropertyKind {
enum TestPropertyKind {
PROP_CONSTANT,
PROP_SMI,
PROP_DOUBLE,
......@@ -46,7 +46,7 @@ static Representation representations[PROP_KIND_NUMBER] = {
static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
PropertyKind* props,
TestPropertyKind* props,
int kPropsCount) {
Factory* factory = isolate->factory();
......@@ -62,7 +62,7 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
SNPrintF(buffer, "prop%d", i);
Handle<String> name = factory->InternalizeUtf8String(buffer.start());
PropertyKind kind = props[i];
TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) {
ConstantDescriptor d(name, func, NONE);
......@@ -113,7 +113,7 @@ TEST(LayoutDescriptorBasicSlow) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
// All properties tagged.
props[i] = PROP_TAGGED;
......@@ -202,7 +202,7 @@ TEST(LayoutDescriptorCreateNewFast) {
v8::HandleScope scope(CcTest::isolate());
Handle<LayoutDescriptor> layout_descriptor;
PropertyKind props[] = {
TestPropertyKind props[] = {
PROP_CONSTANT,
PROP_TAGGED, // field #0
PROP_CONSTANT,
......@@ -254,9 +254,9 @@ TEST(LayoutDescriptorCreateNewSlow) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = static_cast<PropertyKind>(i % PROP_KIND_NUMBER);
props[i] = static_cast<TestPropertyKind>(i % PROP_KIND_NUMBER);
}
Handle<DescriptorArray> descriptors =
......@@ -334,7 +334,7 @@ TEST(LayoutDescriptorCreateNewSlow) {
static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
Isolate* isolate, int inobject_properties, PropertyKind* props,
Isolate* isolate, int inobject_properties, TestPropertyKind* props,
int kPropsCount) {
Factory* factory = isolate->factory();
......@@ -355,7 +355,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
Handle<String> name = factory->InternalizeUtf8String(buffer.start());
Handle<LayoutDescriptor> layout_descriptor;
PropertyKind kind = props[i];
TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) {
ConstantDescriptor d(name, func, NONE);
layout_descriptor = LayoutDescriptor::Append(map, d.GetDetails());
......@@ -391,9 +391,9 @@ TEST(LayoutDescriptorAppend) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = static_cast<PropertyKind>(i % PROP_KIND_NUMBER);
props[i] = static_cast<TestPropertyKind>(i % PROP_KIND_NUMBER);
}
layout_descriptor =
......@@ -425,7 +425,7 @@ TEST(LayoutDescriptorAppendAllDoubles) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = PROP_DOUBLE;
}
......@@ -523,9 +523,9 @@ TEST(LayoutDescriptorAppendIfFastOrUseFull) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = static_cast<PropertyKind>(i % PROP_KIND_NUMBER);
props[i] = static_cast<TestPropertyKind>(i % PROP_KIND_NUMBER);
}
Handle<DescriptorArray> descriptors =
CreateDescriptorArray(isolate, props, kPropsCount);
......@@ -559,7 +559,7 @@ TEST(LayoutDescriptorAppendIfFastOrUseFullAllDoubles) {
Handle<LayoutDescriptor> layout_descriptor;
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = PROP_DOUBLE;
}
......@@ -610,7 +610,7 @@ TEST(Regress436816) {
v8::HandleScope scope(CcTest::isolate());
const int kPropsCount = kSmiValueSize * 3;
PropertyKind props[kPropsCount];
TestPropertyKind props[kPropsCount];
for (int i = 0; i < kPropsCount; i++) {
props[i] = PROP_DOUBLE;
}
......
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