| 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 5487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5498 } | 5498 } |
| 5499 return dictionary; | 5499 return dictionary; |
| 5500 } | 5500 } |
| 5501 | 5501 |
| 5502 | 5502 |
| 5503 void JSObject::RequireSlowElements(SeededNumberDictionary* dictionary) { | 5503 void JSObject::RequireSlowElements(SeededNumberDictionary* dictionary) { |
| 5504 if (dictionary->requires_slow_elements()) return; | 5504 if (dictionary->requires_slow_elements()) return; |
| 5505 dictionary->set_requires_slow_elements(); | 5505 dictionary->set_requires_slow_elements(); |
| 5506 // TODO(verwaest): Remove this hack. | 5506 // TODO(verwaest): Remove this hack. |
| 5507 if (map()->is_prototype_map()) { | 5507 if (map()->is_prototype_map()) { |
| 5508 GetHeap()->ClearAllKeyedStoreICs(); | 5508 TypeFeedbackVector::ClearAllKeyedStoreICs(GetIsolate()); |
| 5509 } | 5509 } |
| 5510 } | 5510 } |
| 5511 | 5511 |
| 5512 | 5512 |
| 5513 Handle<SeededNumberDictionary> JSObject::GetNormalizedElementDictionary( | 5513 Handle<SeededNumberDictionary> JSObject::GetNormalizedElementDictionary( |
| 5514 Handle<JSObject> object, Handle<FixedArrayBase> elements) { | 5514 Handle<JSObject> object, Handle<FixedArrayBase> elements) { |
| 5515 DCHECK(!object->HasDictionaryElements()); | 5515 DCHECK(!object->HasDictionaryElements()); |
| 5516 DCHECK(!object->HasSlowArgumentsElements()); | 5516 DCHECK(!object->HasSlowArgumentsElements()); |
| 5517 Isolate* isolate = object->GetIsolate(); | 5517 Isolate* isolate = object->GetIsolate(); |
| 5518 // Ensure that notifications fire if the array or object prototypes are | 5518 // Ensure that notifications fire if the array or object prototypes are |
| (...skipping 8821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14340 from_javascript ? REGULAR_PROTOTYPE : FAST_PROTOTYPE; | 14340 from_javascript ? REGULAR_PROTOTYPE : FAST_PROTOTYPE; |
| 14341 Handle<Map> new_map = Map::TransitionToPrototype(map, value, mode); | 14341 Handle<Map> new_map = Map::TransitionToPrototype(map, value, mode); |
| 14342 DCHECK(new_map->prototype() == *value); | 14342 DCHECK(new_map->prototype() == *value); |
| 14343 JSObject::MigrateToMap(real_receiver, new_map); | 14343 JSObject::MigrateToMap(real_receiver, new_map); |
| 14344 | 14344 |
| 14345 if (from_javascript && !dictionary_elements_in_chain && | 14345 if (from_javascript && !dictionary_elements_in_chain && |
| 14346 new_map->DictionaryElementsInPrototypeChainOnly()) { | 14346 new_map->DictionaryElementsInPrototypeChainOnly()) { |
| 14347 // If the prototype chain didn't previously have element callbacks, then | 14347 // If the prototype chain didn't previously have element callbacks, then |
| 14348 // KeyedStoreICs need to be cleared to ensure any that involve this | 14348 // KeyedStoreICs need to be cleared to ensure any that involve this |
| 14349 // map go generic. | 14349 // map go generic. |
| 14350 object->GetHeap()->ClearAllKeyedStoreICs(); | 14350 TypeFeedbackVector::ClearAllKeyedStoreICs(isolate); |
| 14351 } | 14351 } |
| 14352 | 14352 |
| 14353 heap->ClearInstanceofCache(); | 14353 heap->ClearInstanceofCache(); |
| 14354 DCHECK(size == object->Size()); | 14354 DCHECK(size == object->Size()); |
| 14355 return Just(true); | 14355 return Just(true); |
| 14356 } | 14356 } |
| 14357 | 14357 |
| 14358 | 14358 |
| 14359 void JSObject::EnsureCanContainElements(Handle<JSObject> object, | 14359 void JSObject::EnsureCanContainElements(Handle<JSObject> object, |
| 14360 Arguments* args, | 14360 Arguments* args, |
| (...skipping 2431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16792 bool used_as_prototype) { | 16792 bool used_as_prototype) { |
| 16793 DisallowHeapAllocation no_allocation; | 16793 DisallowHeapAllocation no_allocation; |
| 16794 // If the dictionary requires slow elements an element has already | 16794 // If the dictionary requires slow elements an element has already |
| 16795 // been added at a high index. | 16795 // been added at a high index. |
| 16796 if (requires_slow_elements()) return; | 16796 if (requires_slow_elements()) return; |
| 16797 // Check if this index is high enough that we should require slow | 16797 // Check if this index is high enough that we should require slow |
| 16798 // elements. | 16798 // elements. |
| 16799 if (key > kRequiresSlowElementsLimit) { | 16799 if (key > kRequiresSlowElementsLimit) { |
| 16800 if (used_as_prototype) { | 16800 if (used_as_prototype) { |
| 16801 // TODO(verwaest): Remove this hack. | 16801 // TODO(verwaest): Remove this hack. |
| 16802 GetHeap()->ClearAllKeyedStoreICs(); | 16802 TypeFeedbackVector::ClearAllKeyedStoreICs(GetIsolate()); |
| 16803 } | 16803 } |
| 16804 set_requires_slow_elements(); | 16804 set_requires_slow_elements(); |
| 16805 return; | 16805 return; |
| 16806 } | 16806 } |
| 16807 // Update max key value. | 16807 // Update max key value. |
| 16808 Object* max_index_object = get(kMaxNumberKeyIndex); | 16808 Object* max_index_object = get(kMaxNumberKeyIndex); |
| 16809 if (!max_index_object->IsSmi() || max_number_key() < key) { | 16809 if (!max_index_object->IsSmi() || max_number_key() < key) { |
| 16810 FixedArray::set(kMaxNumberKeyIndex, | 16810 FixedArray::set(kMaxNumberKeyIndex, |
| 16811 Smi::FromInt(key << kRequiresSlowElementsTagSize)); | 16811 Smi::FromInt(key << kRequiresSlowElementsTagSize)); |
| 16812 } | 16812 } |
| (...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18193 if (cell->value() != *new_value) { | 18193 if (cell->value() != *new_value) { |
| 18194 cell->set_value(*new_value); | 18194 cell->set_value(*new_value); |
| 18195 Isolate* isolate = cell->GetIsolate(); | 18195 Isolate* isolate = cell->GetIsolate(); |
| 18196 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 18196 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 18197 isolate, DependentCode::kPropertyCellChangedGroup); | 18197 isolate, DependentCode::kPropertyCellChangedGroup); |
| 18198 } | 18198 } |
| 18199 } | 18199 } |
| 18200 | 18200 |
| 18201 } // namespace internal | 18201 } // namespace internal |
| 18202 } // namespace v8 | 18202 } // namespace v8 |
| OLD | NEW |