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 <iomanip> | 5 #include <iomanip> |
6 #include <sstream> | 6 #include <sstream> |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
(...skipping 13420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13431 Handle<Derived> HashTable<Derived, Shape, Key>::New( | 13431 Handle<Derived> HashTable<Derived, Shape, Key>::New( |
13432 Isolate* isolate, | 13432 Isolate* isolate, |
13433 int at_least_space_for, | 13433 int at_least_space_for, |
13434 MinimumCapacity capacity_option, | 13434 MinimumCapacity capacity_option, |
13435 PretenureFlag pretenure) { | 13435 PretenureFlag pretenure) { |
13436 DCHECK(0 <= at_least_space_for); | 13436 DCHECK(0 <= at_least_space_for); |
13437 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for)); | 13437 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for)); |
13438 | 13438 |
13439 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) | 13439 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) |
13440 ? at_least_space_for | 13440 ? at_least_space_for |
13441 : isolate->creating_default_snapshot() | 13441 : ComputeCapacity(at_least_space_for); |
13442 ? ComputeCapacityForSerialization(at_least_space_for) | |
13443 : ComputeCapacity(at_least_space_for); | |
13444 if (capacity > HashTable::kMaxCapacity) { | 13442 if (capacity > HashTable::kMaxCapacity) { |
13445 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); | 13443 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); |
13446 } | 13444 } |
13447 | 13445 |
13448 Factory* factory = isolate->factory(); | 13446 Factory* factory = isolate->factory(); |
13449 int length = EntryToIndex(capacity); | 13447 int length = EntryToIndex(capacity); |
13450 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure); | 13448 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure); |
13451 array->set_map_no_write_barrier(*factory->hash_table_map()); | 13449 array->set_map_no_write_barrier(*factory->hash_table_map()); |
13452 Handle<Derived> table = Handle<Derived>::cast(array); | 13450 Handle<Derived> table = Handle<Derived>::cast(array); |
13453 | 13451 |
(...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15864 if (cell->value() != *new_value) { | 15862 if (cell->value() != *new_value) { |
15865 cell->set_value(*new_value); | 15863 cell->set_value(*new_value); |
15866 Isolate* isolate = cell->GetIsolate(); | 15864 Isolate* isolate = cell->GetIsolate(); |
15867 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15865 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
15868 isolate, DependentCode::kPropertyCellChangedGroup); | 15866 isolate, DependentCode::kPropertyCellChangedGroup); |
15869 } | 15867 } |
15870 } | 15868 } |
15871 | 15869 |
15872 } // namespace internal | 15870 } // namespace internal |
15873 } // namespace v8 | 15871 } // namespace v8 |
OLD | NEW |