| 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 17069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17080 bool SeqOneByteSubStringKey::IsMatch(Object* string) { | 17080 bool SeqOneByteSubStringKey::IsMatch(Object* string) { |
| 17081 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); | 17081 Vector<const uint8_t> chars(string_->GetChars() + from_, length_); |
| 17082 return String::cast(string)->IsOneByteEqualTo(chars); | 17082 return String::cast(string)->IsOneByteEqualTo(chars); |
| 17083 } | 17083 } |
| 17084 | 17084 |
| 17085 | 17085 |
| 17086 // InternalizedStringKey carries a string/internalized-string object as key. | 17086 // InternalizedStringKey carries a string/internalized-string object as key. |
| 17087 class InternalizedStringKey : public HashTableKey { | 17087 class InternalizedStringKey : public HashTableKey { |
| 17088 public: | 17088 public: |
| 17089 explicit InternalizedStringKey(Handle<String> string) | 17089 explicit InternalizedStringKey(Handle<String> string) |
| 17090 : string_(string) { } | 17090 : string_(String::Flatten(string)) {} |
| 17091 | 17091 |
| 17092 bool IsMatch(Object* string) override { | 17092 bool IsMatch(Object* string) override { |
| 17093 return String::cast(string)->Equals(*string_); | 17093 return String::cast(string)->Equals(*string_); |
| 17094 } | 17094 } |
| 17095 | 17095 |
| 17096 uint32_t Hash() override { return string_->Hash(); } | 17096 uint32_t Hash() override { return string_->Hash(); } |
| 17097 | 17097 |
| 17098 uint32_t HashForObject(Object* other) override { | 17098 uint32_t HashForObject(Object* other) override { |
| 17099 return String::cast(other)->Hash(); | 17099 return String::cast(other)->Hash(); |
| 17100 } | 17100 } |
| (...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 17942 DCHECK(StringShape(*result).IsInternalized()); | 17942 DCHECK(StringShape(*result).IsInternalized()); |
| 17943 return result; | 17943 return result; |
| 17944 } | 17944 } |
| 17945 } | 17945 } |
| 17946 | 17946 |
| 17947 | 17947 |
| 17948 void StringTable::EnsureCapacityForDeserialization(Isolate* isolate, | 17948 void StringTable::EnsureCapacityForDeserialization(Isolate* isolate, |
| 17949 int expected) { | 17949 int expected) { |
| 17950 Handle<StringTable> table = isolate->factory()->string_table(); | 17950 Handle<StringTable> table = isolate->factory()->string_table(); |
| 17951 // We need a key instance for the virtual hash function. | 17951 // We need a key instance for the virtual hash function. |
| 17952 InternalizedStringKey dummy_key(Handle<String>::null()); | 17952 InternalizedStringKey dummy_key(isolate->factory()->empty_string()); |
| 17953 table = StringTable::EnsureCapacity(table, expected, &dummy_key); | 17953 table = StringTable::EnsureCapacity(table, expected, &dummy_key); |
| 17954 isolate->heap()->SetRootStringTable(*table); | 17954 isolate->heap()->SetRootStringTable(*table); |
| 17955 } | 17955 } |
| 17956 | 17956 |
| 17957 | 17957 |
| 17958 Handle<String> StringTable::LookupString(Isolate* isolate, | 17958 Handle<String> StringTable::LookupString(Isolate* isolate, |
| 17959 Handle<String> string) { | 17959 Handle<String> string) { |
| 17960 InternalizedStringKey key(string); | 17960 InternalizedStringKey key(string); |
| 17961 return LookupKey(isolate, &key); | 17961 return LookupKey(isolate, &key); |
| 17962 } | 17962 } |
| (...skipping 1865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19828 if (cell->value() != *new_value) { | 19828 if (cell->value() != *new_value) { |
| 19829 cell->set_value(*new_value); | 19829 cell->set_value(*new_value); |
| 19830 Isolate* isolate = cell->GetIsolate(); | 19830 Isolate* isolate = cell->GetIsolate(); |
| 19831 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 19831 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 19832 isolate, DependentCode::kPropertyCellChangedGroup); | 19832 isolate, DependentCode::kPropertyCellChangedGroup); |
| 19833 } | 19833 } |
| 19834 } | 19834 } |
| 19835 | 19835 |
| 19836 } // namespace internal | 19836 } // namespace internal |
| 19837 } // namespace v8 | 19837 } // namespace v8 |
| OLD | NEW |