Commit 7cd573f4 authored by ishell's avatar ishell Committed by Commit bot

[runtime] Remove specific Descriptor subclasses and add respective factory methods instead.

This is a preliminary step for constant tracking.

BUG=v8:5495

Review-Url: https://codereview.chromium.org/2595893002
Cr-Commit-Position: refs/heads/master@{#41899}
parent 19aa7a20
This diff is collapsed.
...@@ -2686,8 +2686,8 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2686,8 +2686,8 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map,
Handle<AccessorInfo> length = Handle<AccessorInfo> length =
Accessors::FunctionLengthInfo(isolate(), roc_attribs); Accessors::FunctionLengthInfo(isolate(), roc_attribs);
{ // Add length. { // Add length.
AccessorConstantDescriptor d(Handle<Name>(Name::cast(length->name())), Descriptor d = Descriptor::AccessorConstant(
length, roc_attribs); Handle<Name>(Name::cast(length->name())), length, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -2695,22 +2695,22 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2695,22 +2695,22 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map,
Handle<AccessorInfo> name = Handle<AccessorInfo> name =
Accessors::FunctionNameInfo(isolate(), ro_attribs); Accessors::FunctionNameInfo(isolate(), ro_attribs);
{ // Add name. { // Add name.
AccessorConstantDescriptor d(Handle<Name>(Name::cast(name->name())), name, Descriptor d = Descriptor::AccessorConstant(
roc_attribs); Handle<Name>(Name::cast(name->name())), name, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
Handle<AccessorInfo> args = Handle<AccessorInfo> args =
Accessors::FunctionArgumentsInfo(isolate(), ro_attribs); Accessors::FunctionArgumentsInfo(isolate(), ro_attribs);
{ // Add arguments. { // Add arguments.
AccessorConstantDescriptor d(Handle<Name>(Name::cast(args->name())), args, Descriptor d = Descriptor::AccessorConstant(
ro_attribs); Handle<Name>(Name::cast(args->name())), args, ro_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
Handle<AccessorInfo> caller = Handle<AccessorInfo> caller =
Accessors::FunctionCallerInfo(isolate(), ro_attribs); Accessors::FunctionCallerInfo(isolate(), ro_attribs);
{ // Add caller. { // Add caller.
AccessorConstantDescriptor d(Handle<Name>(Name::cast(caller->name())), Descriptor d = Descriptor::AccessorConstant(
caller, ro_attribs); Handle<Name>(Name::cast(caller->name())), caller, ro_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
if (IsFunctionModeWithPrototype(function_mode)) { if (IsFunctionModeWithPrototype(function_mode)) {
...@@ -2719,8 +2719,8 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2719,8 +2719,8 @@ void Factory::SetFunctionInstanceDescriptor(Handle<Map> map,
} }
Handle<AccessorInfo> prototype = Handle<AccessorInfo> prototype =
Accessors::FunctionPrototypeInfo(isolate(), ro_attribs); Accessors::FunctionPrototypeInfo(isolate(), ro_attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), Descriptor d = Descriptor::AccessorConstant(
prototype, ro_attribs); Handle<Name>(Name::cast(prototype->name())), prototype, ro_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
} }
...@@ -2754,8 +2754,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2754,8 +2754,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map,
{ // Add length. { // Add length.
Handle<AccessorInfo> length = Handle<AccessorInfo> length =
Accessors::FunctionLengthInfo(isolate(), roc_attribs); Accessors::FunctionLengthInfo(isolate(), roc_attribs);
AccessorConstantDescriptor d(handle(Name::cast(length->name())), length, Descriptor d = Descriptor::AccessorConstant(
roc_attribs); handle(Name::cast(length->name())), length, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -2763,8 +2763,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2763,8 +2763,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map,
{ // Add name. { // Add name.
Handle<AccessorInfo> name = Handle<AccessorInfo> name =
Accessors::FunctionNameInfo(isolate(), roc_attribs); Accessors::FunctionNameInfo(isolate(), roc_attribs);
AccessorConstantDescriptor d(handle(Name::cast(name->name())), name, Descriptor d = Descriptor::AccessorConstant(
roc_attribs); handle(Name::cast(name->name())), name, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
if (IsFunctionModeWithPrototype(function_mode)) { if (IsFunctionModeWithPrototype(function_mode)) {
...@@ -2774,8 +2774,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map, ...@@ -2774,8 +2774,8 @@ void Factory::SetStrictFunctionInstanceDescriptor(Handle<Map> map,
: ro_attribs; : ro_attribs;
Handle<AccessorInfo> prototype = Handle<AccessorInfo> prototype =
Accessors::FunctionPrototypeInfo(isolate(), attribs); Accessors::FunctionPrototypeInfo(isolate(), attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), Descriptor d = Descriptor::AccessorConstant(
prototype, attribs); Handle<Name>(Name::cast(prototype->name())), prototype, attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
} }
...@@ -2801,8 +2801,8 @@ void Factory::SetClassFunctionInstanceDescriptor(Handle<Map> map) { ...@@ -2801,8 +2801,8 @@ void Factory::SetClassFunctionInstanceDescriptor(Handle<Map> map) {
{ // Add length. { // Add length.
Handle<AccessorInfo> length = Handle<AccessorInfo> length =
Accessors::FunctionLengthInfo(isolate(), roc_attribs); Accessors::FunctionLengthInfo(isolate(), roc_attribs);
AccessorConstantDescriptor d(handle(Name::cast(length->name())), length, Descriptor d = Descriptor::AccessorConstant(
roc_attribs); handle(Name::cast(length->name())), length, roc_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
...@@ -2810,8 +2810,8 @@ void Factory::SetClassFunctionInstanceDescriptor(Handle<Map> map) { ...@@ -2810,8 +2810,8 @@ void Factory::SetClassFunctionInstanceDescriptor(Handle<Map> map) {
// Add prototype. // Add prototype.
Handle<AccessorInfo> prototype = Handle<AccessorInfo> prototype =
Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); Accessors::FunctionPrototypeInfo(isolate(), rw_attribs);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(prototype->name())), Descriptor d = Descriptor::AccessorConstant(
prototype, rw_attribs); Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
} }
} }
......
...@@ -3208,9 +3208,9 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map, Handle<Name> name, ...@@ -3208,9 +3208,9 @@ MaybeHandle<Map> Map::CopyWithField(Handle<Map> map, Handle<Name> name,
Handle<Object> wrapped_type(WrapType(type)); Handle<Object> wrapped_type(WrapType(type));
DataDescriptor new_field_desc(name, index, wrapped_type, attributes, Descriptor d = Descriptor::DataField(name, index, wrapped_type, attributes,
representation); representation);
Handle<Map> new_map = Map::CopyAddDescriptor(map, &new_field_desc, flag); Handle<Map> new_map = Map::CopyAddDescriptor(map, &d, flag);
int unused_property_fields = new_map->unused_property_fields() - 1; int unused_property_fields = new_map->unused_property_fields() - 1;
if (unused_property_fields < 0) { if (unused_property_fields < 0) {
unused_property_fields += JSObject::kFieldsAdded; unused_property_fields += JSObject::kFieldsAdded;
...@@ -3231,8 +3231,8 @@ MaybeHandle<Map> Map::CopyWithConstant(Handle<Map> map, ...@@ -3231,8 +3231,8 @@ MaybeHandle<Map> Map::CopyWithConstant(Handle<Map> map,
} }
// Allocate new instance descriptors with (name, constant) added. // Allocate new instance descriptors with (name, constant) added.
DataConstantDescriptor new_constant_desc(name, constant, attributes); Descriptor d = Descriptor::DataConstant(name, constant, attributes);
return Map::CopyAddDescriptor(map, &new_constant_desc, flag); return Map::CopyAddDescriptor(map, &d, flag);
} }
const char* Representation::Mnemonic() const { const char* Representation::Mnemonic() const {
...@@ -3771,8 +3771,9 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations( ...@@ -3771,8 +3771,9 @@ Handle<Map> Map::CopyGeneralizeAllRepresentations(
(details.type() != DATA || details.attributes() != attributes)) { (details.type() != DATA || details.attributes() != attributes)) {
int field_index = details.type() == DATA ? details.field_index() int field_index = details.type() == DATA ? details.field_index()
: new_map->NumberOfFields(); : new_map->NumberOfFields();
DataDescriptor d(handle(descriptors->GetKey(modify_index), isolate), Descriptor d = Descriptor::DataField(
field_index, attributes, Representation::Tagged()); handle(descriptors->GetKey(modify_index), isolate), field_index,
attributes, Representation::Tagged());
descriptors->Replace(modify_index, &d); descriptors->Replace(modify_index, &d);
if (details.type() != DATA) { if (details.type() != DATA) {
int unused_property_fields = new_map->unused_property_fields() - 1; int unused_property_fields = new_map->unused_property_fields() - 1;
...@@ -3957,9 +3958,9 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name, ...@@ -3957,9 +3958,9 @@ void Map::UpdateFieldType(int descriptor, Handle<Name> name,
// Skip if already updated the shared descriptor. // Skip if already updated the shared descriptor.
if (descriptors->GetValue(descriptor) != *new_wrapped_type) { if (descriptors->GetValue(descriptor) != *new_wrapped_type) {
DataDescriptor d(name, descriptors->GetFieldIndex(descriptor), Descriptor d = Descriptor::DataField(
new_wrapped_type, details.attributes(), name, descriptors->GetFieldIndex(descriptor), new_wrapped_type,
new_representation); details.attributes(), new_representation);
descriptors->Replace(descriptor, &d); descriptors->Replace(descriptor, &d);
} }
} }
...@@ -4432,8 +4433,9 @@ Handle<Map> Map::Reconfigure(Handle<Map> old_map, ...@@ -4432,8 +4433,9 @@ Handle<Map> Map::Reconfigure(Handle<Map> old_map,
target_field_type, isolate); target_field_type, isolate);
} }
Handle<Object> wrapped_type(WrapType(next_field_type)); Handle<Object> wrapped_type(WrapType(next_field_type));
DataDescriptor d(target_key, current_offset, wrapped_type, Descriptor d =
next_attributes, next_representation); Descriptor::DataField(target_key, current_offset, wrapped_type,
next_attributes, next_representation);
current_offset += d.GetDetails().field_width_in_words(); current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d); new_descriptors->Set(i, &d);
} else { } else {
...@@ -4503,8 +4505,9 @@ Handle<Map> Map::Reconfigure(Handle<Map> old_map, ...@@ -4503,8 +4505,9 @@ Handle<Map> Map::Reconfigure(Handle<Map> old_map,
Handle<Object> wrapped_type(WrapType(next_field_type)); Handle<Object> wrapped_type(WrapType(next_field_type));
DataDescriptor d(old_key, current_offset, wrapped_type, next_attributes, Descriptor d =
next_representation); Descriptor::DataField(old_key, current_offset, wrapped_type,
next_attributes, next_representation);
current_offset += d.GetDetails().field_width_in_words(); current_offset += d.GetDetails().field_width_in_words();
new_descriptors->Set(i, &d); new_descriptors->Set(i, &d);
} else { } else {
...@@ -5206,8 +5209,9 @@ struct DescriptorArrayAppender { ...@@ -5206,8 +5209,9 @@ struct DescriptorArrayAppender {
int valid_descriptors, int valid_descriptors,
Handle<DescriptorArray> array) { Handle<DescriptorArray> array) {
DisallowHeapAllocation no_gc; DisallowHeapAllocation no_gc;
AccessorConstantDescriptor desc(key, entry, entry->property_attributes()); Descriptor d =
array->Append(&desc); Descriptor::AccessorConstant(key, entry, entry->property_attributes());
array->Append(&d);
} }
}; };
...@@ -6173,8 +6177,8 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, ...@@ -6173,8 +6177,8 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
PropertyType type = details.type(); PropertyType type = details.type();
if (value->IsJSFunction()) { if (value->IsJSFunction()) {
DataConstantDescriptor d(key, handle(value, isolate), Descriptor d = Descriptor::DataConstant(key, handle(value, isolate),
details.attributes()); details.attributes());
descriptors->Set(enumeration_index - 1, &d); descriptors->Set(enumeration_index - 1, &d);
} else if (type == DATA) { } else if (type == DATA) {
if (current_offset < inobject_props) { if (current_offset < inobject_props) {
...@@ -6184,14 +6188,15 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object, ...@@ -6184,14 +6188,15 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
int offset = current_offset - inobject_props; int offset = current_offset - inobject_props;
fields->set(offset, value); fields->set(offset, value);
} }
DataDescriptor d(key, current_offset, details.attributes(), Descriptor d = Descriptor::DataField(
// TODO(verwaest): value->OptimalRepresentation(); key, current_offset, details.attributes(),
Representation::Tagged()); // TODO(verwaest): value->OptimalRepresentation();
Representation::Tagged());
current_offset += d.GetDetails().field_width_in_words(); current_offset += d.GetDetails().field_width_in_words();
descriptors->Set(enumeration_index - 1, &d); descriptors->Set(enumeration_index - 1, &d);
} else if (type == ACCESSOR_CONSTANT) { } else if (type == ACCESSOR_CONSTANT) {
AccessorConstantDescriptor d(key, handle(value, isolate), Descriptor d = Descriptor::AccessorConstant(key, handle(value, isolate),
details.attributes()); details.attributes());
descriptors->Set(enumeration_index - 1, &d); descriptors->Set(enumeration_index - 1, &d);
} else { } else {
UNREACHABLE(); UNREACHABLE();
...@@ -9796,8 +9801,8 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map, ...@@ -9796,8 +9801,8 @@ Handle<Map> Map::TransitionToAccessorProperty(Isolate* isolate, Handle<Map> map,
pair->SetComponents(*getter, *setter); pair->SetComponents(*getter, *setter);
TransitionFlag flag = INSERT_TRANSITION; TransitionFlag flag = INSERT_TRANSITION;
AccessorConstantDescriptor new_desc(name, pair, attributes); Descriptor d = Descriptor::AccessorConstant(name, pair, attributes);
return Map::CopyInsertDescriptor(map, &new_desc, flag); return Map::CopyInsertDescriptor(map, &d, flag);
} }
......
...@@ -21,11 +21,12 @@ std::ostream& operator<<(std::ostream& os, ...@@ -21,11 +21,12 @@ std::ostream& operator<<(std::ostream& os,
return os; return os;
} }
DataDescriptor::DataDescriptor(Handle<Name> key, int field_index, Descriptor Descriptor::DataField(Handle<Name> key, int field_index,
PropertyAttributes attributes, PropertyAttributes attributes,
Representation representation) Representation representation) {
: Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA, return Descriptor(key, FieldType::Any(key->GetIsolate()), attributes, DATA,
representation, field_index) {} representation, field_index);
}
struct FastPropertyDetails { struct FastPropertyDetails {
explicit FastPropertyDetails(const PropertyDetails& v) : details(v) {} explicit FastPropertyDetails(const PropertyDetails& v) : details(v) {}
......
...@@ -18,7 +18,7 @@ namespace internal { ...@@ -18,7 +18,7 @@ namespace internal {
// Each descriptor has a key, property attributes, property type, // Each descriptor has a key, property attributes, property type,
// property index (in the actual instance-descriptor array) and // property index (in the actual instance-descriptor array) and
// optionally a piece of data. // optionally a piece of data.
class Descriptor BASE_EMBEDDED { class Descriptor final BASE_EMBEDDED {
public: public:
Handle<Name> GetKey() const { return key_; } Handle<Name> GetKey() const { return key_; }
Handle<Object> GetValue() const { return value_; } Handle<Object> GetValue() const { return value_; }
...@@ -26,6 +26,31 @@ class Descriptor BASE_EMBEDDED { ...@@ -26,6 +26,31 @@ class Descriptor BASE_EMBEDDED {
void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); } void SetSortedKeyIndex(int index) { details_ = details_.set_pointer(index); }
static Descriptor DataField(Handle<Name> key, int field_index,
PropertyAttributes attributes,
Representation representation);
static Descriptor DataField(Handle<Name> key, int field_index,
Handle<Object> wrapped_field_type,
PropertyAttributes attributes,
Representation representation) {
DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell());
return Descriptor(key, wrapped_field_type, attributes, DATA, representation,
field_index);
}
static Descriptor DataConstant(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes) {
return Descriptor(key, value, attributes, DATA_CONSTANT,
value->OptimalRepresentation());
}
static Descriptor AccessorConstant(Handle<Name> key, Handle<Object> foreign,
PropertyAttributes attributes) {
return Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT,
Representation::Tagged());
}
private: private:
Handle<Name> key_; Handle<Name> key_;
Handle<Object> value_; Handle<Object> value_;
...@@ -62,43 +87,8 @@ class Descriptor BASE_EMBEDDED { ...@@ -62,43 +87,8 @@ class Descriptor BASE_EMBEDDED {
friend class Map; friend class Map;
}; };
std::ostream& operator<<(std::ostream& os, const Descriptor& d); std::ostream& operator<<(std::ostream& os, const Descriptor& d);
class DataDescriptor final : public Descriptor {
public:
DataDescriptor(Handle<Name> key, int field_index,
PropertyAttributes attributes, Representation representation);
// The field type is either a simple type or a map wrapped in a weak cell.
DataDescriptor(Handle<Name> key, int field_index,
Handle<Object> wrapped_field_type,
PropertyAttributes attributes, Representation representation)
: Descriptor(key, wrapped_field_type, attributes, DATA, representation,
field_index) {
DCHECK(wrapped_field_type->IsSmi() || wrapped_field_type->IsWeakCell());
}
};
class DataConstantDescriptor final : public Descriptor {
public:
DataConstantDescriptor(Handle<Name> key, Handle<Object> value,
PropertyAttributes attributes)
: Descriptor(key, value, attributes, DATA_CONSTANT,
value->OptimalRepresentation()) {}
};
class AccessorConstantDescriptor final : public Descriptor {
public:
AccessorConstantDescriptor(Handle<Name> key, Handle<Object> foreign,
PropertyAttributes attributes)
: Descriptor(key, foreign, attributes, ACCESSOR_CONSTANT,
Representation::Tagged()) {}
};
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8
......
...@@ -154,8 +154,8 @@ TEST(StressJS) { ...@@ -154,8 +154,8 @@ TEST(StressJS) {
Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs); Handle<AccessorInfo> foreign = TestAccessorInfo(isolate, attrs);
Map::EnsureDescriptorSlack(map, 1); Map::EnsureDescriptorSlack(map, 1);
AccessorConstantDescriptor d(Handle<Name>(Name::cast(foreign->name())), Descriptor d = Descriptor::AccessorConstant(
foreign, attrs); Handle<Name>(Name::cast(foreign->name())), foreign, attrs);
map->AppendDescriptor(&d); map->AppendDescriptor(&d);
// Add the Foo constructor the global object. // Add the Foo constructor the global object.
......
...@@ -376,8 +376,8 @@ class Expectations { ...@@ -376,8 +376,8 @@ class Expectations {
Handle<String> name = MakeName("prop", property_index); Handle<String> name = MakeName("prop", property_index);
AccessorConstantDescriptor new_desc(name, pair, attributes); Descriptor d = Descriptor::AccessorConstant(name, pair, attributes);
return Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); return Map::CopyInsertDescriptor(map, &d, INSERT_TRANSITION);
} }
Handle<Map> AddAccessorConstant(Handle<Map> map, Handle<Map> AddAccessorConstant(Handle<Map> map,
...@@ -396,14 +396,14 @@ class Expectations { ...@@ -396,14 +396,14 @@ class Expectations {
if (!getter->IsNull(isolate_)) { if (!getter->IsNull(isolate_)) {
Handle<AccessorPair> pair = factory->NewAccessorPair(); Handle<AccessorPair> pair = factory->NewAccessorPair();
pair->SetComponents(*getter, *factory->null_value()); pair->SetComponents(*getter, *factory->null_value());
AccessorConstantDescriptor new_desc(name, pair, attributes); Descriptor d = Descriptor::AccessorConstant(name, pair, attributes);
map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); map = Map::CopyInsertDescriptor(map, &d, INSERT_TRANSITION);
} }
if (!setter->IsNull(isolate_)) { if (!setter->IsNull(isolate_)) {
Handle<AccessorPair> pair = factory->NewAccessorPair(); Handle<AccessorPair> pair = factory->NewAccessorPair();
pair->SetComponents(*getter, *setter); pair->SetComponents(*getter, *setter);
AccessorConstantDescriptor new_desc(name, pair, attributes); Descriptor d = Descriptor::AccessorConstant(name, pair, attributes);
map = Map::CopyInsertDescriptor(map, &new_desc, INSERT_TRANSITION); map = Map::CopyInsertDescriptor(map, &d, INSERT_TRANSITION);
} }
return map; return map;
} }
......
...@@ -106,13 +106,14 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate, ...@@ -106,13 +106,14 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
TestPropertyKind kind = props[i]; TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) { if (kind == PROP_CONSTANT) {
DataConstantDescriptor d(name, func, NONE); Descriptor d = Descriptor::DataConstant(name, func, NONE);
descriptors->Append(&d); descriptors->Append(&d);
} else { } else {
DataDescriptor f(name, next_field_offset, NONE, representations[kind]); Descriptor d = Descriptor::DataField(name, next_field_offset, NONE,
next_field_offset += f.GetDetails().field_width_in_words(); representations[kind]);
descriptors->Append(&f); next_field_offset += d.GetDetails().field_width_in_words();
descriptors->Append(&d);
} }
} }
return descriptors; return descriptors;
...@@ -628,18 +629,19 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend( ...@@ -628,18 +629,19 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
Handle<LayoutDescriptor> layout_descriptor; Handle<LayoutDescriptor> layout_descriptor;
TestPropertyKind kind = props[i]; TestPropertyKind kind = props[i];
if (kind == PROP_CONSTANT) { if (kind == PROP_CONSTANT) {
DataConstantDescriptor d(name, func, NONE); Descriptor d = Descriptor::DataConstant(name, func, NONE);
layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails()); layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails());
descriptors->Append(&d); descriptors->Append(&d);
} else { } else {
DataDescriptor f(name, next_field_offset, NONE, representations[kind]); Descriptor d = Descriptor::DataField(name, next_field_offset, NONE,
int field_width_in_words = f.GetDetails().field_width_in_words(); representations[kind]);
int field_width_in_words = d.GetDetails().field_width_in_words();
next_field_offset += field_width_in_words; next_field_offset += field_width_in_words;
layout_descriptor = LayoutDescriptor::ShareAppend(map, f.GetDetails()); layout_descriptor = LayoutDescriptor::ShareAppend(map, d.GetDetails());
descriptors->Append(&f); descriptors->Append(&d);
int field_index = f.GetDetails().field_index(); int field_index = d.GetDetails().field_index();
bool is_inobject = field_index < map->GetInObjectProperties(); bool is_inobject = field_index < map->GetInObjectProperties();
for (int bit = 0; bit < field_width_in_words; bit++) { for (int bit = 0; bit < field_width_in_words; bit++) {
CHECK_EQ(is_inobject && (kind == PROP_DOUBLE), CHECK_EQ(is_inobject && (kind == 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