| 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 14089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14100 } | 14100 } |
| 14101 } | 14101 } |
| 14102 | 14102 |
| 14103 | 14103 |
| 14104 void StringTable::EnsureCapacityForDeserialization(Isolate* isolate, | 14104 void StringTable::EnsureCapacityForDeserialization(Isolate* isolate, |
| 14105 int expected) { | 14105 int expected) { |
| 14106 Handle<StringTable> table = isolate->factory()->string_table(); | 14106 Handle<StringTable> table = isolate->factory()->string_table(); |
| 14107 // We need a key instance for the virtual hash function. | 14107 // We need a key instance for the virtual hash function. |
| 14108 InternalizedStringKey dummy_key(Handle<String>::null()); | 14108 InternalizedStringKey dummy_key(Handle<String>::null()); |
| 14109 table = StringTable::EnsureCapacity(table, expected, &dummy_key); | 14109 table = StringTable::EnsureCapacity(table, expected, &dummy_key); |
| 14110 isolate->factory()->set_string_table(table); | 14110 isolate->heap()->SetRootStringTable(*table); |
| 14111 } | 14111 } |
| 14112 | 14112 |
| 14113 | 14113 |
| 14114 Handle<String> StringTable::LookupString(Isolate* isolate, | 14114 Handle<String> StringTable::LookupString(Isolate* isolate, |
| 14115 Handle<String> string) { | 14115 Handle<String> string) { |
| 14116 InternalizedStringKey key(string); | 14116 InternalizedStringKey key(string); |
| 14117 return LookupKey(isolate, &key); | 14117 return LookupKey(isolate, &key); |
| 14118 } | 14118 } |
| 14119 | 14119 |
| 14120 | 14120 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 14134 Handle<Object> string = key->AsHandle(isolate); | 14134 Handle<Object> string = key->AsHandle(isolate); |
| 14135 // There must be no attempts to internalize strings that could throw | 14135 // There must be no attempts to internalize strings that could throw |
| 14136 // InvalidStringLength error. | 14136 // InvalidStringLength error. |
| 14137 CHECK(!string.is_null()); | 14137 CHECK(!string.is_null()); |
| 14138 | 14138 |
| 14139 // Add the new string and return it along with the string table. | 14139 // Add the new string and return it along with the string table. |
| 14140 entry = table->FindInsertionEntry(key->Hash()); | 14140 entry = table->FindInsertionEntry(key->Hash()); |
| 14141 table->set(EntryToIndex(entry), *string); | 14141 table->set(EntryToIndex(entry), *string); |
| 14142 table->ElementAdded(); | 14142 table->ElementAdded(); |
| 14143 | 14143 |
| 14144 isolate->factory()->set_string_table(table); | 14144 isolate->heap()->SetRootStringTable(*table); |
| 14145 return Handle<String>::cast(string); | 14145 return Handle<String>::cast(string); |
| 14146 } | 14146 } |
| 14147 | 14147 |
| 14148 | 14148 |
| 14149 String* StringTable::LookupKeyIfExists(Isolate* isolate, HashTableKey* key) { | 14149 String* StringTable::LookupKeyIfExists(Isolate* isolate, HashTableKey* key) { |
| 14150 Handle<StringTable> table = isolate->factory()->string_table(); | 14150 Handle<StringTable> table = isolate->factory()->string_table(); |
| 14151 int entry = table->FindEntry(key); | 14151 int entry = table->FindEntry(key); |
| 14152 if (entry != kNotFound) return String::cast(table->KeyAt(entry)); | 14152 if (entry != kNotFound) return String::cast(table->KeyAt(entry)); |
| 14153 return NULL; | 14153 return NULL; |
| 14154 } | 14154 } |
| (...skipping 1668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15823 if (cell->value() != *new_value) { | 15823 if (cell->value() != *new_value) { |
| 15824 cell->set_value(*new_value); | 15824 cell->set_value(*new_value); |
| 15825 Isolate* isolate = cell->GetIsolate(); | 15825 Isolate* isolate = cell->GetIsolate(); |
| 15826 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 15826 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 15827 isolate, DependentCode::kPropertyCellChangedGroup); | 15827 isolate, DependentCode::kPropertyCellChangedGroup); |
| 15828 } | 15828 } |
| 15829 } | 15829 } |
| 15830 | 15830 |
| 15831 } // namespace internal | 15831 } // namespace internal |
| 15832 } // namespace v8 | 15832 } // namespace v8 |
| OLD | NEW |