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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 14149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14160 return String::cast(string)->IsOneByteEqualTo(chars); | 14160 return String::cast(string)->IsOneByteEqualTo(chars); |
14161 } | 14161 } |
14162 | 14162 |
14163 | 14163 |
14164 // InternalizedStringKey carries a string/internalized-string object as key. | 14164 // InternalizedStringKey carries a string/internalized-string object as key. |
14165 class InternalizedStringKey : public HashTableKey { | 14165 class InternalizedStringKey : public HashTableKey { |
14166 public: | 14166 public: |
14167 explicit InternalizedStringKey(Handle<String> string) | 14167 explicit InternalizedStringKey(Handle<String> string) |
14168 : string_(string) { } | 14168 : string_(string) { } |
14169 | 14169 |
14170 virtual bool IsMatch(Object* string) OVERRIDE { | 14170 bool IsMatch(Object* string) OVERRIDE { |
14171 return String::cast(string)->Equals(*string_); | 14171 return String::cast(string)->Equals(*string_); |
14172 } | 14172 } |
14173 | 14173 |
14174 virtual uint32_t Hash() OVERRIDE { return string_->Hash(); } | 14174 uint32_t Hash() OVERRIDE { return string_->Hash(); } |
14175 | 14175 |
14176 virtual uint32_t HashForObject(Object* other) OVERRIDE { | 14176 uint32_t HashForObject(Object* other) OVERRIDE { |
14177 return String::cast(other)->Hash(); | 14177 return String::cast(other)->Hash(); |
14178 } | 14178 } |
14179 | 14179 |
14180 virtual Handle<Object> AsHandle(Isolate* isolate) OVERRIDE { | 14180 Handle<Object> AsHandle(Isolate* isolate) OVERRIDE { |
14181 // Internalize the string if possible. | 14181 // Internalize the string if possible. |
14182 MaybeHandle<Map> maybe_map = | 14182 MaybeHandle<Map> maybe_map = |
14183 isolate->factory()->InternalizedStringMapForString(string_); | 14183 isolate->factory()->InternalizedStringMapForString(string_); |
14184 Handle<Map> map; | 14184 Handle<Map> map; |
14185 if (maybe_map.ToHandle(&map)) { | 14185 if (maybe_map.ToHandle(&map)) { |
14186 string_->set_map_no_write_barrier(*map); | 14186 string_->set_map_no_write_barrier(*map); |
14187 DCHECK(string_->IsInternalizedString()); | 14187 DCHECK(string_->IsInternalizedString()); |
14188 return string_; | 14188 return string_; |
14189 } | 14189 } |
14190 // Otherwise allocate a new internalized string. | 14190 // Otherwise allocate a new internalized string. |
(...skipping 2740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16931 Handle<DependentCode> codes = | 16931 Handle<DependentCode> codes = |
16932 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16932 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16933 DependentCode::kPropertyCellChangedGroup, | 16933 DependentCode::kPropertyCellChangedGroup, |
16934 info->object_wrapper()); | 16934 info->object_wrapper()); |
16935 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16935 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16936 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16936 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16937 cell, info->zone()); | 16937 cell, info->zone()); |
16938 } | 16938 } |
16939 | 16939 |
16940 } } // namespace v8::internal | 16940 } } // namespace v8::internal |
OLD | NEW |