[runtime] Remove redundant StoreMode enum.

BUG=v8:5495

Review-Url: https://codereview.chromium.org/2639583002
Cr-Commit-Position: refs/heads/master@{#42419}
This commit is contained in:
ishell 2017-01-17 07:41:45 -08:00 committed by Commit bot
parent 322a37856a
commit 23fb6cf07d
5 changed files with 21 additions and 35 deletions

View File

@ -150,11 +150,9 @@ Handle<Map> MapUpdater::Update() {
}
MapUpdater::State MapUpdater::CopyGeneralizeAllFields(const char* reason) {
StoreMode store_mode =
modified_descriptor_ >= 0 ? FORCE_FIELD : ALLOW_IN_DESCRIPTOR;
result_map_ = Map::CopyGeneralizeAllFields(
old_map_, new_elements_kind_, modified_descriptor_, store_mode, new_kind_,
new_attributes_, reason);
result_map_ = Map::CopyGeneralizeAllFields(old_map_, new_elements_kind_,
modified_descriptor_, new_kind_,
new_attributes_, reason);
state_ = kEnd;
return state_; // Done.
}

View File

@ -3907,8 +3907,7 @@ void DescriptorArray::GeneralizeAllFields() {
Handle<Map> Map::CopyGeneralizeAllFields(Handle<Map> map,
ElementsKind elements_kind,
int modify_index, StoreMode store_mode,
PropertyKind kind,
int modify_index, PropertyKind kind,
PropertyAttributes attributes,
const char* reason) {
Isolate* isolate = map->GetIsolate();
@ -3927,8 +3926,7 @@ Handle<Map> Map::CopyGeneralizeAllFields(Handle<Map> map,
// Unless the instance is being migrated, ensure that modify_index is a field.
if (modify_index >= 0) {
PropertyDetails details = descriptors->GetDetails(modify_index);
if (store_mode == FORCE_FIELD &&
(details.location() != kField || details.attributes() != attributes)) {
if (details.location() != kField || details.attributes() != attributes) {
int field_index = details.location() == kField
? details.field_index()
: new_map->NumberOfFields();
@ -3955,8 +3953,7 @@ Handle<Map> Map::CopyGeneralizeAllFields(Handle<Map> map,
}
map->PrintGeneralization(
stdout, reason, modify_index, new_map->NumberOfOwnDescriptors(),
new_map->NumberOfOwnDescriptors(),
details.location() == kDescriptor && store_mode == FORCE_FIELD,
new_map->NumberOfOwnDescriptors(), details.location() == kDescriptor,
details.representation(), Representation::Tagged(), field_type,
MaybeHandle<Object>(), FieldType::Any(isolate),
MaybeHandle<Object>());
@ -4161,8 +4158,7 @@ Handle<Map> Map::ReconfigureProperty(Handle<Map> map, int modify_index,
PropertyKind new_kind,
PropertyAttributes new_attributes,
Representation new_representation,
Handle<FieldType> new_field_type,
StoreMode store_mode) {
Handle<FieldType> new_field_type) {
DCHECK_EQ(kData, new_kind); // Only kData case is supported.
MapUpdater mu(map->GetIsolate(), map);
return mu.ReconfigureToDataField(modify_index, new_attributes,
@ -9258,8 +9254,8 @@ Handle<Map> Map::ReconfigureExistingProperty(Handle<Map> map, int descriptor,
if (!map->GetBackPointer()->IsMap()) {
// There is no benefit from reconstructing transition tree for maps without
// back pointers.
return CopyGeneralizeAllFields(map, map->elements_kind(), descriptor,
FORCE_FIELD, kind, attributes,
return CopyGeneralizeAllFields(map, map->elements_kind(), descriptor, kind,
attributes,
"GenAll_AttributesMismatchProtoMap");
}

View File

@ -241,10 +241,6 @@ enum WriteBarrierMode {
};
// Indicates whether a value can be loaded as a constant.
enum StoreMode { ALLOW_IN_DESCRIPTOR, FORCE_FIELD };
// PropertyNormalizationMode is used to specify whether to keep
// inobject properties when normalizing properties of a JSObject.
enum PropertyNormalizationMode {
@ -6050,8 +6046,7 @@ class Map: public HeapObject {
PropertyKind new_kind,
PropertyAttributes new_attributes,
Representation new_representation,
Handle<FieldType> new_field_type,
StoreMode store_mode);
Handle<FieldType> new_field_type);
static Handle<Map> ReconfigureElementsKind(Handle<Map> map,
ElementsKind new_elements_kind);
@ -6499,8 +6494,7 @@ class Map: public HeapObject {
// TODO(ishell): Move to MapUpdater.
static Handle<Map> CopyGeneralizeAllFields(
Handle<Map> map, ElementsKind elements_kind, int modify_index,
StoreMode store_mode, PropertyKind kind, PropertyAttributes attributes,
const char* reason);
PropertyKind kind, PropertyAttributes attributes, const char* reason);
// Fires when the layout of an object with a leaf map changes.
// This includes adding transitions to the leaf map or changing

View File

@ -455,7 +455,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) {
CHECK(expectations.Check(*map));
Handle<Map> new_map = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD);
map, 0, kData, NONE, Representation::None(), none_type);
// |map| did not change except marked unstable.
CHECK(!map->is_deprecated());
CHECK(!map->is_stable());
@ -468,7 +468,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) {
CHECK(expectations.Check(*new_map));
Handle<Map> new_map2 = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD);
map, 0, kData, NONE, Representation::None(), none_type);
CHECK_EQ(*new_map, *new_map2);
Handle<Object> value(Smi::kZero, isolate);
@ -592,7 +592,7 @@ static void TestGeneralizeRepresentation(
if (is_detached_map) {
detach_point_map = Map::ReconfigureProperty(
detach_point_map, detach_property_at_index, kData, NONE,
Representation::Tagged(), any_type, FORCE_FIELD);
Representation::Tagged(), any_type);
expectations.SetDataField(detach_property_at_index,
Representation::Tagged(), any_type);
CHECK(map->is_deprecated());
@ -607,9 +607,8 @@ static void TestGeneralizeRepresentation(
dependencies.AssumeFieldOwner(field_owner);
Handle<Map> new_map =
Map::ReconfigureProperty(map, property_index, kData, NONE,
to_representation, to_type, FORCE_FIELD);
Handle<Map> new_map = Map::ReconfigureProperty(
map, property_index, kData, NONE, to_representation, to_type);
expectations.SetDataField(property_index, expected_representation,
expected_type);
@ -900,7 +899,7 @@ TEST(GeneralizeRepresentationWithAccessorProperties) {
continue;
}
Handle<Map> new_map = Map::ReconfigureProperty(
map, i, kData, NONE, Representation::Double(), any_type, FORCE_FIELD);
map, i, kData, NONE, Representation::Double(), any_type);
maps[i] = new_map;
expectations.SetDataField(i, Representation::Double(), any_type);
@ -1854,8 +1853,7 @@ TEST(ReconfigurePropertySplitMapTransitionsOverflow) {
}
map2 = Map::ReconfigureProperty(map2, kSplitProp, kData, NONE,
Representation::Double(), any_type,
FORCE_FIELD);
Representation::Double(), any_type);
expectations.SetDataField(kSplitProp, Representation::Double(), any_type);
CHECK(expectations.Check(*split_map, kSplitProp));
@ -1954,8 +1952,8 @@ static void TestGeneralizeRepresentationWithSpecialTransition(
// Create new maps by generalizing representation of propX field.
Handle<Map> maps[kPropCount];
for (int i = 0; i < kPropCount; i++) {
Handle<Map> new_map = Map::ReconfigureProperty(
map, i, kData, NONE, to_representation, to_type, FORCE_FIELD);
Handle<Map> new_map = Map::ReconfigureProperty(map, i, kData, NONE,
to_representation, to_type);
maps[i] = new_map;
expectations.SetDataField(i, expected_representation, expected_type);

View File

@ -1534,7 +1534,7 @@ static void TestWriteBarrierObjectShiftFieldsRight(
// Shift fields right by turning constant property to a field.
Handle<Map> new_map = Map::ReconfigureProperty(
map, 0, kData, NONE, Representation::Tagged(), any_type, FORCE_FIELD);
map, 0, kData, NONE, Representation::Tagged(), any_type);
if (write_barrier_kind == OLD_TO_NEW_WRITE_BARRIER) {
TestWriteBarrier(map, new_map, 2, 1);