| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 16483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16494 if (parent_value > child1_value) break; | 16494 if (parent_value > child1_value) break; |
| 16495 content->SwapPairs(numbers, parent_index, child_index); | 16495 content->SwapPairs(numbers, parent_index, child_index); |
| 16496 parent_index = child_index; | 16496 parent_index = child_index; |
| 16497 } else { | 16497 } else { |
| 16498 if (parent_value > child2_value) break; | 16498 if (parent_value > child2_value) break; |
| 16499 content->SwapPairs(numbers, parent_index, child_index + 1); | 16499 content->SwapPairs(numbers, parent_index, child_index + 1); |
| 16500 parent_index = child_index + 1; | 16500 parent_index = child_index + 1; |
| 16501 } | 16501 } |
| 16502 } | 16502 } |
| 16503 } | 16503 } |
| 16504 // Wipe deleted entries. | |
| 16505 Heap* heap = GetHeap(); | |
| 16506 Object* the_hole = heap->the_hole_value(); | |
| 16507 Object* undefined = heap->undefined_value(); | |
| 16508 for (uint32_t current = 0; current < capacity; current++) { | |
| 16509 if (get(EntryToIndex(current)) == the_hole) { | |
| 16510 set(EntryToIndex(current), undefined); | |
| 16511 } | |
| 16512 } | |
| 16513 SetNumberOfDeletedElements(0); | |
| 16514 } | 16504 } |
| 16515 | 16505 |
| 16516 | 16506 |
| 16517 // Sort this array and the numbers as pairs wrt. the (distinct) numbers. | 16507 // Sort this array and the numbers as pairs wrt. the (distinct) numbers. |
| 16518 void FixedArray::SortPairs(FixedArray* numbers, uint32_t len) { | 16508 void FixedArray::SortPairs(FixedArray* numbers, uint32_t len) { |
| 16519 DCHECK(this->length() == numbers->length()); | 16509 DCHECK(this->length() == numbers->length()); |
| 16520 // For small arrays, simply use insertion sort. | 16510 // For small arrays, simply use insertion sort. |
| 16521 if (len <= 10) { | 16511 if (len <= 10) { |
| 16522 InsertionSortPairs(this, numbers, len); | 16512 InsertionSortPairs(this, numbers, len); |
| 16523 return; | 16513 return; |
| (...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17352 // The other element will be processed on the next iteration. | 17342 // The other element will be processed on the next iteration. |
| 17353 current--; | 17343 current--; |
| 17354 } else { | 17344 } else { |
| 17355 // The place for the current element is occupied. Leave the element | 17345 // The place for the current element is occupied. Leave the element |
| 17356 // for the next probe. | 17346 // for the next probe. |
| 17357 done = false; | 17347 done = false; |
| 17358 } | 17348 } |
| 17359 } | 17349 } |
| 17360 } | 17350 } |
| 17361 } | 17351 } |
| 17352 // Wipe deleted entries. |
| 17353 Heap* heap = GetHeap(); |
| 17354 Object* the_hole = heap->the_hole_value(); |
| 17355 Object* undefined = heap->undefined_value(); |
| 17356 for (uint32_t current = 0; current < capacity; current++) { |
| 17357 if (get(EntryToIndex(current)) == the_hole) { |
| 17358 set(EntryToIndex(current), undefined); |
| 17359 } |
| 17360 } |
| 17361 SetNumberOfDeletedElements(0); |
| 17362 } | 17362 } |
| 17363 | 17363 |
| 17364 | 17364 |
| 17365 template<typename Derived, typename Shape, typename Key> | 17365 template<typename Derived, typename Shape, typename Key> |
| 17366 Handle<Derived> HashTable<Derived, Shape, Key>::EnsureCapacity( | 17366 Handle<Derived> HashTable<Derived, Shape, Key>::EnsureCapacity( |
| 17367 Handle<Derived> table, | 17367 Handle<Derived> table, |
| 17368 int n, | 17368 int n, |
| 17369 Key key, | 17369 Key key, |
| 17370 PretenureFlag pretenure) { | 17370 PretenureFlag pretenure) { |
| 17371 Isolate* isolate = table->GetIsolate(); | 17371 Isolate* isolate = table->GetIsolate(); |
| (...skipping 2508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19880 if (cell->value() != *new_value) { | 19880 if (cell->value() != *new_value) { |
| 19881 cell->set_value(*new_value); | 19881 cell->set_value(*new_value); |
| 19882 Isolate* isolate = cell->GetIsolate(); | 19882 Isolate* isolate = cell->GetIsolate(); |
| 19883 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19883 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19884 isolate, DependentCode::kPropertyCellChangedGroup); | 19884 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19885 } | 19885 } |
| 19886 } | 19886 } |
| 19887 | 19887 |
| 19888 } // namespace internal | 19888 } // namespace internal |
| 19889 } // namespace v8 | 19889 } // namespace v8 |
| OLD | NEW |