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 9265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9276 if (is_index) is_index = hasher.UpdateIndex(c); | 9276 if (is_index) is_index = hasher.UpdateIndex(c); |
9277 } | 9277 } |
9278 } | 9278 } |
9279 *utf16_length_out = static_cast<int>(utf16_length); | 9279 *utf16_length_out = static_cast<int>(utf16_length); |
9280 // Must set length here so that hash computation is correct. | 9280 // Must set length here so that hash computation is correct. |
9281 hasher.length_ = utf16_length; | 9281 hasher.length_ = utf16_length; |
9282 return hasher.GetHashField(); | 9282 return hasher.GetHashField(); |
9283 } | 9283 } |
9284 | 9284 |
9285 | 9285 |
| 9286 void IteratingStringHasher::VisitConsString(ConsString* cons_string) { |
| 9287 const int max_length = String::kMaxHashCalcLength; |
| 9288 int length = std::min(cons_string->length(), max_length); |
| 9289 if (cons_string->HasOnlyOneByteChars()) { |
| 9290 uint8_t* buffer = new uint8_t[length]; |
| 9291 String::WriteToFlat(cons_string, buffer, 0, length); |
| 9292 AddCharacters(buffer, length); |
| 9293 delete[] buffer; |
| 9294 } else { |
| 9295 uint16_t* buffer = new uint16_t[length]; |
| 9296 String::WriteToFlat(cons_string, buffer, 0, length); |
| 9297 AddCharacters(buffer, length); |
| 9298 delete[] buffer; |
| 9299 } |
| 9300 } |
| 9301 |
| 9302 |
9286 void String::PrintOn(FILE* file) { | 9303 void String::PrintOn(FILE* file) { |
9287 int length = this->length(); | 9304 int length = this->length(); |
9288 for (int i = 0; i < length; i++) { | 9305 for (int i = 0; i < length; i++) { |
9289 PrintF(file, "%c", Get(i)); | 9306 PrintF(file, "%c", Get(i)); |
9290 } | 9307 } |
9291 } | 9308 } |
9292 | 9309 |
9293 | 9310 |
9294 inline static uint32_t ObjectAddressForHashing(Object* object) { | 9311 inline static uint32_t ObjectAddressForHashing(Object* object) { |
9295 uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object)); | 9312 uint32_t value = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(object)); |
(...skipping 7512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16808 Handle<DependentCode> codes = | 16825 Handle<DependentCode> codes = |
16809 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16826 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16810 DependentCode::kPropertyCellChangedGroup, | 16827 DependentCode::kPropertyCellChangedGroup, |
16811 info->object_wrapper()); | 16828 info->object_wrapper()); |
16812 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16829 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16813 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16830 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16814 cell, info->zone()); | 16831 cell, info->zone()); |
16815 } | 16832 } |
16816 | 16833 |
16817 } } // namespace v8::internal | 16834 } } // namespace v8::internal |
OLD | NEW |