| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/objects.h" | 5 #include "src/objects.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 #include <iomanip> | 8 #include <iomanip> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 1070 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 void JSObject::SetNormalizedProperty(Handle<JSObject> object, | 1081 void JSObject::SetNormalizedProperty(Handle<JSObject> object, |
| 1082 Handle<Name> name, | 1082 Handle<Name> name, |
| 1083 Handle<Object> value, | 1083 Handle<Object> value, |
| 1084 PropertyDetails details) { | 1084 PropertyDetails details) { |
| 1085 DCHECK(!object->HasFastProperties()); | 1085 DCHECK(!object->HasFastProperties()); |
| 1086 if (!name->IsUniqueName()) { | 1086 if (!name->IsUniqueName()) { |
| 1087 name = object->GetIsolate()->factory()->InternalizeString( | 1087 name = object->GetIsolate()->factory()->InternalizeString( |
| 1088 Handle<String>::cast(name)); | 1088 Handle<String>::cast(name)); |
| 1089 } | 1089 } |
| 1090 | 1090 |
| 1091 if (object->IsGlobalObject()) { | 1091 if (object->IsJSGlobalObject()) { |
| 1092 Handle<GlobalDictionary> property_dictionary(object->global_dictionary()); | 1092 Handle<GlobalDictionary> property_dictionary(object->global_dictionary()); |
| 1093 | 1093 |
| 1094 int entry = property_dictionary->FindEntry(name); | 1094 int entry = property_dictionary->FindEntry(name); |
| 1095 if (entry == GlobalDictionary::kNotFound) { | 1095 if (entry == GlobalDictionary::kNotFound) { |
| 1096 auto cell = object->GetIsolate()->factory()->NewPropertyCell(); | 1096 auto cell = object->GetIsolate()->factory()->NewPropertyCell(); |
| 1097 cell->set_value(*value); | 1097 cell->set_value(*value); |
| 1098 auto cell_type = value->IsUndefined() ? PropertyCellType::kUndefined | 1098 auto cell_type = value->IsUndefined() ? PropertyCellType::kUndefined |
| 1099 : PropertyCellType::kConstant; | 1099 : PropertyCellType::kConstant; |
| 1100 details = details.set_cell_type(cell_type); | 1100 details = details.set_cell_type(cell_type); |
| 1101 value = cell; | 1101 value = cell; |
| (...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2191 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); | 2191 return Map::CopyAddDescriptor(map, &new_constant_desc, flag); |
| 2192 } | 2192 } |
| 2193 | 2193 |
| 2194 | 2194 |
| 2195 void JSObject::AddSlowProperty(Handle<JSObject> object, | 2195 void JSObject::AddSlowProperty(Handle<JSObject> object, |
| 2196 Handle<Name> name, | 2196 Handle<Name> name, |
| 2197 Handle<Object> value, | 2197 Handle<Object> value, |
| 2198 PropertyAttributes attributes) { | 2198 PropertyAttributes attributes) { |
| 2199 DCHECK(!object->HasFastProperties()); | 2199 DCHECK(!object->HasFastProperties()); |
| 2200 Isolate* isolate = object->GetIsolate(); | 2200 Isolate* isolate = object->GetIsolate(); |
| 2201 if (object->IsGlobalObject()) { | 2201 if (object->IsJSGlobalObject()) { |
| 2202 Handle<GlobalDictionary> dict(object->global_dictionary()); | 2202 Handle<GlobalDictionary> dict(object->global_dictionary()); |
| 2203 PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell); | 2203 PropertyDetails details(attributes, DATA, 0, PropertyCellType::kNoCell); |
| 2204 int entry = dict->FindEntry(name); | 2204 int entry = dict->FindEntry(name); |
| 2205 // If there's a cell there, just invalidate and set the property. | 2205 // If there's a cell there, just invalidate and set the property. |
| 2206 if (entry != GlobalDictionary::kNotFound) { | 2206 if (entry != GlobalDictionary::kNotFound) { |
| 2207 PropertyCell::UpdateCell(dict, entry, value, details); | 2207 PropertyCell::UpdateCell(dict, entry, value, details); |
| 2208 // TODO(ishell): move this to UpdateCell. | 2208 // TODO(ishell): move this to UpdateCell. |
| 2209 // Need to adjust the details. | 2209 // Need to adjust the details. |
| 2210 int index = dict->NextEnumerationIndex(); | 2210 int index = dict->NextEnumerationIndex(); |
| 2211 dict->SetNextEnumerationIndex(index + 1); | 2211 dict->SetNextEnumerationIndex(index + 1); |
| (...skipping 2882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5094 Handle<Map> new_map = Map::Normalize(map, mode, reason); | 5094 Handle<Map> new_map = Map::Normalize(map, mode, reason); |
| 5095 | 5095 |
| 5096 MigrateToMap(object, new_map, expected_additional_properties); | 5096 MigrateToMap(object, new_map, expected_additional_properties); |
| 5097 } | 5097 } |
| 5098 | 5098 |
| 5099 | 5099 |
| 5100 void JSObject::MigrateFastToSlow(Handle<JSObject> object, | 5100 void JSObject::MigrateFastToSlow(Handle<JSObject> object, |
| 5101 Handle<Map> new_map, | 5101 Handle<Map> new_map, |
| 5102 int expected_additional_properties) { | 5102 int expected_additional_properties) { |
| 5103 // The global object is always normalized. | 5103 // The global object is always normalized. |
| 5104 DCHECK(!object->IsGlobalObject()); | 5104 DCHECK(!object->IsJSGlobalObject()); |
| 5105 // JSGlobalProxy must never be normalized | 5105 // JSGlobalProxy must never be normalized |
| 5106 DCHECK(!object->IsJSGlobalProxy()); | 5106 DCHECK(!object->IsJSGlobalProxy()); |
| 5107 | 5107 |
| 5108 Isolate* isolate = object->GetIsolate(); | 5108 Isolate* isolate = object->GetIsolate(); |
| 5109 HandleScope scope(isolate); | 5109 HandleScope scope(isolate); |
| 5110 Handle<Map> map(object->map()); | 5110 Handle<Map> map(object->map()); |
| 5111 | 5111 |
| 5112 // Allocate new content. | 5112 // Allocate new content. |
| 5113 int real_size = map->NumberOfOwnDescriptors(); | 5113 int real_size = map->NumberOfOwnDescriptors(); |
| 5114 int property_count = real_size; | 5114 int property_count = real_size; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5211 object->Print(os); | 5211 object->Print(os); |
| 5212 } | 5212 } |
| 5213 #endif | 5213 #endif |
| 5214 } | 5214 } |
| 5215 | 5215 |
| 5216 | 5216 |
| 5217 void JSObject::MigrateSlowToFast(Handle<JSObject> object, | 5217 void JSObject::MigrateSlowToFast(Handle<JSObject> object, |
| 5218 int unused_property_fields, | 5218 int unused_property_fields, |
| 5219 const char* reason) { | 5219 const char* reason) { |
| 5220 if (object->HasFastProperties()) return; | 5220 if (object->HasFastProperties()) return; |
| 5221 DCHECK(!object->IsGlobalObject()); | 5221 DCHECK(!object->IsJSGlobalObject()); |
| 5222 Isolate* isolate = object->GetIsolate(); | 5222 Isolate* isolate = object->GetIsolate(); |
| 5223 Factory* factory = isolate->factory(); | 5223 Factory* factory = isolate->factory(); |
| 5224 Handle<NameDictionary> dictionary(object->property_dictionary()); | 5224 Handle<NameDictionary> dictionary(object->property_dictionary()); |
| 5225 | 5225 |
| 5226 // Make sure we preserve dictionary representation if there are too many | 5226 // Make sure we preserve dictionary representation if there are too many |
| 5227 // descriptors. | 5227 // descriptors. |
| 5228 int number_of_elements = dictionary->NumberOfElements(); | 5228 int number_of_elements = dictionary->NumberOfElements(); |
| 5229 if (number_of_elements > kMaxNumberOfDescriptors) return; | 5229 if (number_of_elements > kMaxNumberOfDescriptors) return; |
| 5230 | 5230 |
| 5231 Handle<FixedArray> iteration_order; | 5231 Handle<FixedArray> iteration_order; |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5758 // Rebox CustomArguments::kReturnValueOffset before returning. | 5758 // Rebox CustomArguments::kReturnValueOffset before returning. |
| 5759 return handle(*result_internal, isolate); | 5759 return handle(*result_internal, isolate); |
| 5760 } | 5760 } |
| 5761 | 5761 |
| 5762 | 5762 |
| 5763 void JSObject::DeleteNormalizedProperty(Handle<JSObject> object, | 5763 void JSObject::DeleteNormalizedProperty(Handle<JSObject> object, |
| 5764 Handle<Name> name, int entry) { | 5764 Handle<Name> name, int entry) { |
| 5765 DCHECK(!object->HasFastProperties()); | 5765 DCHECK(!object->HasFastProperties()); |
| 5766 Isolate* isolate = object->GetIsolate(); | 5766 Isolate* isolate = object->GetIsolate(); |
| 5767 | 5767 |
| 5768 if (object->IsGlobalObject()) { | 5768 if (object->IsJSGlobalObject()) { |
| 5769 // If we have a global object, invalidate the cell and swap in a new one. | 5769 // If we have a global object, invalidate the cell and swap in a new one. |
| 5770 Handle<GlobalDictionary> dictionary(object->global_dictionary()); | 5770 Handle<GlobalDictionary> dictionary(object->global_dictionary()); |
| 5771 DCHECK_NE(GlobalDictionary::kNotFound, entry); | 5771 DCHECK_NE(GlobalDictionary::kNotFound, entry); |
| 5772 | 5772 |
| 5773 auto cell = PropertyCell::InvalidateEntry(dictionary, entry); | 5773 auto cell = PropertyCell::InvalidateEntry(dictionary, entry); |
| 5774 cell->set_value(isolate->heap()->the_hole_value()); | 5774 cell->set_value(isolate->heap()->the_hole_value()); |
| 5775 // TODO(ishell): InvalidateForDelete | 5775 // TODO(ishell): InvalidateForDelete |
| 5776 cell->set_property_details( | 5776 cell->set_property_details( |
| 5777 cell->property_details().set_cell_type(PropertyCellType::kInvalidated)); | 5777 cell->property_details().set_cell_type(PropertyCellType::kInvalidated)); |
| 5778 } else { | 5778 } else { |
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6958 // TODO(adamk): Extend the NormalizedMapCache to handle non-extensible maps. | 6958 // TODO(adamk): Extend the NormalizedMapCache to handle non-extensible maps. |
| 6959 Handle<Map> new_map = | 6959 Handle<Map> new_map = |
| 6960 Map::Copy(handle(object->map()), "SlowCopyForPreventExtensions"); | 6960 Map::Copy(handle(object->map()), "SlowCopyForPreventExtensions"); |
| 6961 new_map->set_is_extensible(false); | 6961 new_map->set_is_extensible(false); |
| 6962 if (!new_element_dictionary.is_null()) { | 6962 if (!new_element_dictionary.is_null()) { |
| 6963 new_map->set_elements_kind(DICTIONARY_ELEMENTS); | 6963 new_map->set_elements_kind(DICTIONARY_ELEMENTS); |
| 6964 } | 6964 } |
| 6965 JSObject::MigrateToMap(object, new_map); | 6965 JSObject::MigrateToMap(object, new_map); |
| 6966 | 6966 |
| 6967 if (attrs != NONE) { | 6967 if (attrs != NONE) { |
| 6968 if (object->IsGlobalObject()) { | 6968 if (object->IsJSGlobalObject()) { |
| 6969 ApplyAttributesToDictionary(object->global_dictionary(), attrs); | 6969 ApplyAttributesToDictionary(object->global_dictionary(), attrs); |
| 6970 } else { | 6970 } else { |
| 6971 ApplyAttributesToDictionary(object->property_dictionary(), attrs); | 6971 ApplyAttributesToDictionary(object->property_dictionary(), attrs); |
| 6972 } | 6972 } |
| 6973 } | 6973 } |
| 6974 } | 6974 } |
| 6975 | 6975 |
| 6976 // Both seal and preventExtensions always go through without modifications to | 6976 // Both seal and preventExtensions always go through without modifications to |
| 6977 // typed array elements. Freeze works only if there are no actual elements. | 6977 // typed array elements. Freeze works only if there are no actual elements. |
| 6978 if (object->HasFixedTypedArrayElements()) { | 6978 if (object->HasFixedTypedArrayElements()) { |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7520 } | 7520 } |
| 7521 | 7521 |
| 7522 } // namespace | 7522 } // namespace |
| 7523 | 7523 |
| 7524 | 7524 |
| 7525 Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object, | 7525 Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object, |
| 7526 bool cache_enum_length) { | 7526 bool cache_enum_length) { |
| 7527 Isolate* isolate = object->GetIsolate(); | 7527 Isolate* isolate = object->GetIsolate(); |
| 7528 if (object->HasFastProperties()) { | 7528 if (object->HasFastProperties()) { |
| 7529 return GetFastEnumPropertyKeys(isolate, object, cache_enum_length); | 7529 return GetFastEnumPropertyKeys(isolate, object, cache_enum_length); |
| 7530 } else if (object->IsGlobalObject()) { | 7530 } else if (object->IsJSGlobalObject()) { |
| 7531 Handle<GlobalDictionary> dictionary(object->global_dictionary()); | 7531 Handle<GlobalDictionary> dictionary(object->global_dictionary()); |
| 7532 int length = dictionary->NumberOfEnumElements(); | 7532 int length = dictionary->NumberOfEnumElements(); |
| 7533 if (length == 0) { | 7533 if (length == 0) { |
| 7534 return Handle<FixedArray>(isolate->heap()->empty_fixed_array()); | 7534 return Handle<FixedArray>(isolate->heap()->empty_fixed_array()); |
| 7535 } | 7535 } |
| 7536 Handle<FixedArray> storage = isolate->factory()->NewFixedArray(length); | 7536 Handle<FixedArray> storage = isolate->factory()->NewFixedArray(length); |
| 7537 dictionary->CopyEnumKeysTo(*storage); | 7537 dictionary->CopyEnumKeysTo(*storage); |
| 7538 return storage; | 7538 return storage; |
| 7539 } else { | 7539 } else { |
| 7540 Handle<NameDictionary> dictionary(object->property_dictionary()); | 7540 Handle<NameDictionary> dictionary(object->property_dictionary()); |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8081 return descs->GetKey(i); | 8081 return descs->GetKey(i); |
| 8082 } | 8082 } |
| 8083 } | 8083 } |
| 8084 } else if (descs->GetType(i) == DATA_CONSTANT) { | 8084 } else if (descs->GetType(i) == DATA_CONSTANT) { |
| 8085 if (descs->GetConstant(i) == value) { | 8085 if (descs->GetConstant(i) == value) { |
| 8086 return descs->GetKey(i); | 8086 return descs->GetKey(i); |
| 8087 } | 8087 } |
| 8088 } | 8088 } |
| 8089 } | 8089 } |
| 8090 return GetHeap()->undefined_value(); | 8090 return GetHeap()->undefined_value(); |
| 8091 } else if (IsGlobalObject()) { | 8091 } else if (IsJSGlobalObject()) { |
| 8092 return global_dictionary()->SlowReverseLookup(value); | 8092 return global_dictionary()->SlowReverseLookup(value); |
| 8093 } else { | 8093 } else { |
| 8094 return property_dictionary()->SlowReverseLookup(value); | 8094 return property_dictionary()->SlowReverseLookup(value); |
| 8095 } | 8095 } |
| 8096 } | 8096 } |
| 8097 | 8097 |
| 8098 | 8098 |
| 8099 Handle<Map> Map::RawCopy(Handle<Map> map, int instance_size) { | 8099 Handle<Map> Map::RawCopy(Handle<Map> map, int instance_size) { |
| 8100 Isolate* isolate = map->GetIsolate(); | 8100 Isolate* isolate = map->GetIsolate(); |
| 8101 Handle<Map> result = | 8101 Handle<Map> result = |
| (...skipping 3318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11420 if (object->RawFastPropertyAt(index)->IsJSFunction()) return true; | 11420 if (object->RawFastPropertyAt(index)->IsJSFunction()) return true; |
| 11421 } | 11421 } |
| 11422 } | 11422 } |
| 11423 return false; | 11423 return false; |
| 11424 } | 11424 } |
| 11425 | 11425 |
| 11426 | 11426 |
| 11427 // static | 11427 // static |
| 11428 void JSObject::OptimizeAsPrototype(Handle<JSObject> object, | 11428 void JSObject::OptimizeAsPrototype(Handle<JSObject> object, |
| 11429 PrototypeOptimizationMode mode) { | 11429 PrototypeOptimizationMode mode) { |
| 11430 if (object->IsGlobalObject()) return; | 11430 if (object->IsJSGlobalObject()) return; |
| 11431 if (object->IsJSGlobalProxy()) return; | 11431 if (object->IsJSGlobalProxy()) return; |
| 11432 if (mode == FAST_PROTOTYPE && PrototypeBenefitsFromNormalization(object)) { | 11432 if (mode == FAST_PROTOTYPE && PrototypeBenefitsFromNormalization(object)) { |
| 11433 // First normalize to ensure all JSFunctions are DATA_CONSTANT. | 11433 // First normalize to ensure all JSFunctions are DATA_CONSTANT. |
| 11434 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, | 11434 JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, |
| 11435 "NormalizeAsPrototype"); | 11435 "NormalizeAsPrototype"); |
| 11436 } | 11436 } |
| 11437 Handle<Map> previous_map(object->map()); | 11437 Handle<Map> previous_map(object->map()); |
| 11438 if (!object->HasFastProperties()) { | 11438 if (!object->HasFastProperties()) { |
| 11439 JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype"); | 11439 JSObject::MigrateSlowToFast(object, 0, "OptimizeAsPrototype"); |
| 11440 } | 11440 } |
| (...skipping 3427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14868 if (HasFastProperties()) { | 14868 if (HasFastProperties()) { |
| 14869 Map* map = this->map(); | 14869 Map* map = this->map(); |
| 14870 if (filter == NONE) return map->NumberOfOwnDescriptors(); | 14870 if (filter == NONE) return map->NumberOfOwnDescriptors(); |
| 14871 if (filter == DONT_SHOW) { | 14871 if (filter == DONT_SHOW) { |
| 14872 // The cached enum length was computed with filter == DONT_SHOW, so | 14872 // The cached enum length was computed with filter == DONT_SHOW, so |
| 14873 // that's the only filter for which it's valid to retrieve it. | 14873 // that's the only filter for which it's valid to retrieve it. |
| 14874 int result = map->EnumLength(); | 14874 int result = map->EnumLength(); |
| 14875 if (result != kInvalidEnumCacheSentinel) return result; | 14875 if (result != kInvalidEnumCacheSentinel) return result; |
| 14876 } | 14876 } |
| 14877 return map->NumberOfDescribedProperties(OWN_DESCRIPTORS, filter); | 14877 return map->NumberOfDescribedProperties(OWN_DESCRIPTORS, filter); |
| 14878 } else if (IsGlobalObject()) { | 14878 } else if (IsJSGlobalObject()) { |
| 14879 return global_dictionary()->NumberOfElementsFilterAttributes(filter); | 14879 return global_dictionary()->NumberOfElementsFilterAttributes(filter); |
| 14880 } else { | 14880 } else { |
| 14881 return property_dictionary()->NumberOfElementsFilterAttributes(filter); | 14881 return property_dictionary()->NumberOfElementsFilterAttributes(filter); |
| 14882 } | 14882 } |
| 14883 } | 14883 } |
| 14884 | 14884 |
| 14885 | 14885 |
| 14886 void FixedArray::SwapPairs(FixedArray* numbers, int i, int j) { | 14886 void FixedArray::SwapPairs(FixedArray* numbers, int i, int j) { |
| 14887 Object* temp = get(i); | 14887 Object* temp = get(i); |
| 14888 set(i, get(j)); | 14888 set(i, get(j)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15006 int start_index = index; | 15006 int start_index = index; |
| 15007 int real_size = map()->NumberOfOwnDescriptors(); | 15007 int real_size = map()->NumberOfOwnDescriptors(); |
| 15008 DescriptorArray* descs = map()->instance_descriptors(); | 15008 DescriptorArray* descs = map()->instance_descriptors(); |
| 15009 for (int i = 0; i < real_size; i++) { | 15009 for (int i = 0; i < real_size; i++) { |
| 15010 if ((descs->GetDetails(i).attributes() & filter) == 0 && | 15010 if ((descs->GetDetails(i).attributes() & filter) == 0 && |
| 15011 !descs->GetKey(i)->FilterKey(filter)) { | 15011 !descs->GetKey(i)->FilterKey(filter)) { |
| 15012 storage->set(index++, descs->GetKey(i)); | 15012 storage->set(index++, descs->GetKey(i)); |
| 15013 } | 15013 } |
| 15014 } | 15014 } |
| 15015 return index - start_index; | 15015 return index - start_index; |
| 15016 } else if (IsGlobalObject()) { | 15016 } else if (IsJSGlobalObject()) { |
| 15017 return global_dictionary()->CopyKeysTo(storage, index, filter, | 15017 return global_dictionary()->CopyKeysTo(storage, index, filter, |
| 15018 GlobalDictionary::UNSORTED); | 15018 GlobalDictionary::UNSORTED); |
| 15019 } else { | 15019 } else { |
| 15020 return property_dictionary()->CopyKeysTo(storage, index, filter, | 15020 return property_dictionary()->CopyKeysTo(storage, index, filter, |
| 15021 NameDictionary::UNSORTED); | 15021 NameDictionary::UNSORTED); |
| 15022 } | 15022 } |
| 15023 } | 15023 } |
| 15024 | 15024 |
| 15025 | 15025 |
| 15026 int JSObject::NumberOfOwnElements(PropertyAttributes filter) { | 15026 int JSObject::NumberOfOwnElements(PropertyAttributes filter) { |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16063 TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE) | 16063 TYPED_ARRAYS(INSTANCE_TYPE_TO_ELEMENT_SIZE) |
| 16064 #undef INSTANCE_TYPE_TO_ELEMENT_SIZE | 16064 #undef INSTANCE_TYPE_TO_ELEMENT_SIZE |
| 16065 | 16065 |
| 16066 default: | 16066 default: |
| 16067 UNREACHABLE(); | 16067 UNREACHABLE(); |
| 16068 return 0; | 16068 return 0; |
| 16069 } | 16069 } |
| 16070 } | 16070 } |
| 16071 | 16071 |
| 16072 | 16072 |
| 16073 void GlobalObject::InvalidatePropertyCell(Handle<GlobalObject> global, | 16073 void JSGlobalObject::InvalidatePropertyCell(Handle<JSGlobalObject> global, |
| 16074 Handle<Name> name) { | 16074 Handle<Name> name) { |
| 16075 DCHECK(!global->HasFastProperties()); | 16075 DCHECK(!global->HasFastProperties()); |
| 16076 auto dictionary = handle(global->global_dictionary()); | 16076 auto dictionary = handle(global->global_dictionary()); |
| 16077 int entry = dictionary->FindEntry(name); | 16077 int entry = dictionary->FindEntry(name); |
| 16078 if (entry == GlobalDictionary::kNotFound) return; | 16078 if (entry == GlobalDictionary::kNotFound) return; |
| 16079 PropertyCell::InvalidateEntry(dictionary, entry); | 16079 PropertyCell::InvalidateEntry(dictionary, entry); |
| 16080 } | 16080 } |
| 16081 | 16081 |
| 16082 | 16082 |
| 16083 // TODO(ishell): rename to EnsureEmptyPropertyCell or something. | 16083 // TODO(ishell): rename to EnsureEmptyPropertyCell or something. |
| 16084 Handle<PropertyCell> GlobalObject::EnsurePropertyCell( | 16084 Handle<PropertyCell> JSGlobalObject::EnsurePropertyCell( |
| 16085 Handle<GlobalObject> global, Handle<Name> name) { | 16085 Handle<JSGlobalObject> global, Handle<Name> name) { |
| 16086 DCHECK(!global->HasFastProperties()); | 16086 DCHECK(!global->HasFastProperties()); |
| 16087 auto dictionary = handle(global->global_dictionary()); | 16087 auto dictionary = handle(global->global_dictionary()); |
| 16088 int entry = dictionary->FindEntry(name); | 16088 int entry = dictionary->FindEntry(name); |
| 16089 Handle<PropertyCell> cell; | 16089 Handle<PropertyCell> cell; |
| 16090 if (entry != GlobalDictionary::kNotFound) { | 16090 if (entry != GlobalDictionary::kNotFound) { |
| 16091 // This call should be idempotent. | 16091 // This call should be idempotent. |
| 16092 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); | 16092 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell()); |
| 16093 cell = handle(PropertyCell::cast(dictionary->ValueAt(entry))); | 16093 cell = handle(PropertyCell::cast(dictionary->ValueAt(entry))); |
| 16094 DCHECK(cell->property_details().cell_type() == | 16094 DCHECK(cell->property_details().cell_type() == |
| 16095 PropertyCellType::kUninitialized || | 16095 PropertyCellType::kUninitialized || |
| (...skipping 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18012 if (cell->value() != *new_value) { | 18012 if (cell->value() != *new_value) { |
| 18013 cell->set_value(*new_value); | 18013 cell->set_value(*new_value); |
| 18014 Isolate* isolate = cell->GetIsolate(); | 18014 Isolate* isolate = cell->GetIsolate(); |
| 18015 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18015 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18016 isolate, DependentCode::kPropertyCellChangedGroup); | 18016 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18017 } | 18017 } |
| 18018 } | 18018 } |
| 18019 | 18019 |
| 18020 } // namespace internal | 18020 } // namespace internal |
| 18021 } // namespace v8 | 18021 } // namespace v8 |
| OLD | NEW |