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 <iomanip> | 7 #include <iomanip> |
8 #include <sstream> | 8 #include <sstream> |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 4745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4756 } | 4756 } |
4757 return dictionary; | 4757 return dictionary; |
4758 } | 4758 } |
4759 | 4759 |
4760 | 4760 |
4761 void JSObject::RequireSlowElements(SeededNumberDictionary* dictionary) { | 4761 void JSObject::RequireSlowElements(SeededNumberDictionary* dictionary) { |
4762 if (dictionary->requires_slow_elements()) return; | 4762 if (dictionary->requires_slow_elements()) return; |
4763 dictionary->set_requires_slow_elements(); | 4763 dictionary->set_requires_slow_elements(); |
4764 // TODO(verwaest): Remove this hack. | 4764 // TODO(verwaest): Remove this hack. |
4765 if (map()->is_prototype_map()) { | 4765 if (map()->is_prototype_map()) { |
4766 GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); | 4766 GetHeap()->ClearAllKeyedStoreICs(); |
4767 } | 4767 } |
4768 } | 4768 } |
4769 | 4769 |
4770 | 4770 |
4771 Handle<SeededNumberDictionary> JSObject::GetNormalizedElementDictionary( | 4771 Handle<SeededNumberDictionary> JSObject::GetNormalizedElementDictionary( |
4772 Handle<JSObject> object, Handle<FixedArrayBase> elements) { | 4772 Handle<JSObject> object, Handle<FixedArrayBase> elements) { |
4773 DCHECK(!object->HasDictionaryElements()); | 4773 DCHECK(!object->HasDictionaryElements()); |
4774 DCHECK(!object->HasSlowArgumentsElements()); | 4774 DCHECK(!object->HasSlowArgumentsElements()); |
4775 Isolate* isolate = object->GetIsolate(); | 4775 Isolate* isolate = object->GetIsolate(); |
4776 // Ensure that notifications fire if the array or object prototypes are | 4776 // Ensure that notifications fire if the array or object prototypes are |
(...skipping 7322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12099 from_javascript ? REGULAR_PROTOTYPE : FAST_PROTOTYPE; | 12099 from_javascript ? REGULAR_PROTOTYPE : FAST_PROTOTYPE; |
12100 Handle<Map> new_map = Map::TransitionToPrototype(map, value, mode); | 12100 Handle<Map> new_map = Map::TransitionToPrototype(map, value, mode); |
12101 DCHECK(new_map->prototype() == *value); | 12101 DCHECK(new_map->prototype() == *value); |
12102 JSObject::MigrateToMap(real_receiver, new_map); | 12102 JSObject::MigrateToMap(real_receiver, new_map); |
12103 | 12103 |
12104 if (from_javascript && !dictionary_elements_in_chain && | 12104 if (from_javascript && !dictionary_elements_in_chain && |
12105 new_map->DictionaryElementsInPrototypeChainOnly()) { | 12105 new_map->DictionaryElementsInPrototypeChainOnly()) { |
12106 // If the prototype chain didn't previously have element callbacks, then | 12106 // If the prototype chain didn't previously have element callbacks, then |
12107 // KeyedStoreICs need to be cleared to ensure any that involve this | 12107 // KeyedStoreICs need to be cleared to ensure any that involve this |
12108 // map go generic. | 12108 // map go generic. |
12109 object->GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); | 12109 object->GetHeap()->ClearAllKeyedStoreICs(); |
12110 } | 12110 } |
12111 | 12111 |
12112 heap->ClearInstanceofCache(); | 12112 heap->ClearInstanceofCache(); |
12113 DCHECK(size == object->Size()); | 12113 DCHECK(size == object->Size()); |
12114 return value; | 12114 return value; |
12115 } | 12115 } |
12116 | 12116 |
12117 | 12117 |
12118 void JSObject::EnsureCanContainElements(Handle<JSObject> object, | 12118 void JSObject::EnsureCanContainElements(Handle<JSObject> object, |
12119 Arguments* args, | 12119 Arguments* args, |
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14513 bool used_as_prototype) { | 14513 bool used_as_prototype) { |
14514 DisallowHeapAllocation no_allocation; | 14514 DisallowHeapAllocation no_allocation; |
14515 // If the dictionary requires slow elements an element has already | 14515 // If the dictionary requires slow elements an element has already |
14516 // been added at a high index. | 14516 // been added at a high index. |
14517 if (requires_slow_elements()) return; | 14517 if (requires_slow_elements()) return; |
14518 // Check if this index is high enough that we should require slow | 14518 // Check if this index is high enough that we should require slow |
14519 // elements. | 14519 // elements. |
14520 if (key > kRequiresSlowElementsLimit) { | 14520 if (key > kRequiresSlowElementsLimit) { |
14521 if (used_as_prototype) { | 14521 if (used_as_prototype) { |
14522 // TODO(verwaest): Remove this hack. | 14522 // TODO(verwaest): Remove this hack. |
14523 GetHeap()->ClearAllICsByKind(Code::KEYED_STORE_IC); | 14523 GetHeap()->ClearAllKeyedStoreICs(); |
14524 } | 14524 } |
14525 set_requires_slow_elements(); | 14525 set_requires_slow_elements(); |
14526 return; | 14526 return; |
14527 } | 14527 } |
14528 // Update max key value. | 14528 // Update max key value. |
14529 Object* max_index_object = get(kMaxNumberKeyIndex); | 14529 Object* max_index_object = get(kMaxNumberKeyIndex); |
14530 if (!max_index_object->IsSmi() || max_number_key() < key) { | 14530 if (!max_index_object->IsSmi() || max_number_key() < key) { |
14531 FixedArray::set(kMaxNumberKeyIndex, | 14531 FixedArray::set(kMaxNumberKeyIndex, |
14532 Smi::FromInt(key << kRequiresSlowElementsTagSize)); | 14532 Smi::FromInt(key << kRequiresSlowElementsTagSize)); |
14533 } | 14533 } |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15700 if (cell->value() != *new_value) { | 15700 if (cell->value() != *new_value) { |
15701 cell->set_value(*new_value); | 15701 cell->set_value(*new_value); |
15702 Isolate* isolate = cell->GetIsolate(); | 15702 Isolate* isolate = cell->GetIsolate(); |
15703 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15703 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15704 isolate, DependentCode::kPropertyCellChangedGroup); | 15704 isolate, DependentCode::kPropertyCellChangedGroup); |
15705 } | 15705 } |
15706 } | 15706 } |
15707 | 15707 |
15708 } // namespace internal | 15708 } // namespace internal |
15709 } // namespace v8 | 15709 } // namespace v8 |
OLD | NEW |