| 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 14683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14694 | 14694 |
| 14695 | 14695 |
| 14696 template<typename Derived, typename Shape, typename Key> | 14696 template<typename Derived, typename Shape, typename Key> |
| 14697 Handle<Derived> HashTable<Derived, Shape, Key>::New( | 14697 Handle<Derived> HashTable<Derived, Shape, Key>::New( |
| 14698 Isolate* isolate, | 14698 Isolate* isolate, |
| 14699 int at_least_space_for, | 14699 int at_least_space_for, |
| 14700 MinimumCapacity capacity_option, | 14700 MinimumCapacity capacity_option, |
| 14701 PretenureFlag pretenure) { | 14701 PretenureFlag pretenure) { |
| 14702 DCHECK(0 <= at_least_space_for); | 14702 DCHECK(0 <= at_least_space_for); |
| 14703 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for)); | 14703 DCHECK(!capacity_option || base::bits::IsPowerOfTwo32(at_least_space_for)); |
| 14704 |
| 14704 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) | 14705 int capacity = (capacity_option == USE_CUSTOM_MINIMUM_CAPACITY) |
| 14705 ? at_least_space_for | 14706 ? at_least_space_for |
| 14706 : isolate->serializer_enabled() | 14707 : isolate->creating_default_snapshot() |
| 14707 ? ComputeCapacityForSerialization(at_least_space_for) | 14708 ? ComputeCapacityForSerialization(at_least_space_for) |
| 14708 : ComputeCapacity(at_least_space_for); | 14709 : ComputeCapacity(at_least_space_for); |
| 14709 if (capacity > HashTable::kMaxCapacity) { | 14710 if (capacity > HashTable::kMaxCapacity) { |
| 14710 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); | 14711 v8::internal::Heap::FatalProcessOutOfMemory("invalid table size", true); |
| 14711 } | 14712 } |
| 14712 | 14713 |
| 14713 Factory* factory = isolate->factory(); | 14714 Factory* factory = isolate->factory(); |
| 14714 int length = EntryToIndex(capacity); | 14715 int length = EntryToIndex(capacity); |
| 14715 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure); | 14716 Handle<FixedArray> array = factory->NewFixedArray(length, pretenure); |
| 14716 array->set_map_no_write_barrier(*factory->hash_table_map()); | 14717 array->set_map_no_write_barrier(*factory->hash_table_map()); |
| (...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15689 // Add the new string and return it along with the string table. | 15690 // Add the new string and return it along with the string table. |
| 15690 entry = table->FindInsertionEntry(key->Hash()); | 15691 entry = table->FindInsertionEntry(key->Hash()); |
| 15691 table->set(EntryToIndex(entry), *string); | 15692 table->set(EntryToIndex(entry), *string); |
| 15692 table->ElementAdded(); | 15693 table->ElementAdded(); |
| 15693 | 15694 |
| 15694 isolate->factory()->set_string_table(table); | 15695 isolate->factory()->set_string_table(table); |
| 15695 return Handle<String>::cast(string); | 15696 return Handle<String>::cast(string); |
| 15696 } | 15697 } |
| 15697 | 15698 |
| 15698 | 15699 |
| 15700 String* StringTable::LookupKeyIfExists(Isolate* isolate, HashTableKey* key) { |
| 15701 Handle<StringTable> table = isolate->factory()->string_table(); |
| 15702 int entry = table->FindEntry(key); |
| 15703 if (entry != kNotFound) return String::cast(table->KeyAt(entry)); |
| 15704 return NULL; |
| 15705 } |
| 15706 |
| 15707 |
| 15699 Handle<Object> CompilationCacheTable::Lookup(Handle<String> src, | 15708 Handle<Object> CompilationCacheTable::Lookup(Handle<String> src, |
| 15700 Handle<Context> context, | 15709 Handle<Context> context, |
| 15701 LanguageMode language_mode) { | 15710 LanguageMode language_mode) { |
| 15702 Isolate* isolate = GetIsolate(); | 15711 Isolate* isolate = GetIsolate(); |
| 15703 Handle<SharedFunctionInfo> shared(context->closure()->shared()); | 15712 Handle<SharedFunctionInfo> shared(context->closure()->shared()); |
| 15704 StringSharedKey key(src, shared, language_mode, RelocInfo::kNoPosition); | 15713 StringSharedKey key(src, shared, language_mode, RelocInfo::kNoPosition); |
| 15705 int entry = FindEntry(&key); | 15714 int entry = FindEntry(&key); |
| 15706 if (entry == kNotFound) return isolate->factory()->undefined_value(); | 15715 if (entry == kNotFound) return isolate->factory()->undefined_value(); |
| 15707 int index = EntryToIndex(entry); | 15716 int index = EntryToIndex(entry); |
| 15708 if (!get(index)->IsFixedArray()) return isolate->factory()->undefined_value(); | 15717 if (!get(index)->IsFixedArray()) return isolate->factory()->undefined_value(); |
| (...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17258 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, | 17267 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, |
| 17259 Handle<Object> new_value) { | 17268 Handle<Object> new_value) { |
| 17260 if (cell->value() != *new_value) { | 17269 if (cell->value() != *new_value) { |
| 17261 cell->set_value(*new_value); | 17270 cell->set_value(*new_value); |
| 17262 Isolate* isolate = cell->GetIsolate(); | 17271 Isolate* isolate = cell->GetIsolate(); |
| 17263 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 17272 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 17264 isolate, DependentCode::kPropertyCellChangedGroup); | 17273 isolate, DependentCode::kPropertyCellChangedGroup); |
| 17265 } | 17274 } |
| 17266 } | 17275 } |
| 17267 } } // namespace v8::internal | 17276 } } // namespace v8::internal |
| OLD | NEW |