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 9151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9162 one_length); | 9162 one_length); |
9163 } else { | 9163 } else { |
9164 for (int i = 0; i < one_length; i++) { | 9164 for (int i = 0; i < one_length; i++) { |
9165 if (flat1.Get(i) != flat2.Get(i)) return false; | 9165 if (flat1.Get(i) != flat2.Get(i)) return false; |
9166 } | 9166 } |
9167 return true; | 9167 return true; |
9168 } | 9168 } |
9169 } | 9169 } |
9170 | 9170 |
9171 | 9171 |
9172 bool String::MarkAsUndetectable() { | |
9173 if (StringShape(this).IsInternalized()) return false; | |
9174 | |
9175 Map* map = this->map(); | |
9176 Heap* heap = GetHeap(); | |
9177 if (map == heap->string_map()) { | |
9178 this->set_map(heap->undetectable_string_map()); | |
9179 return true; | |
9180 } else if (map == heap->one_byte_string_map()) { | |
9181 this->set_map(heap->undetectable_one_byte_string_map()); | |
9182 return true; | |
9183 } | |
9184 // Rest cannot be marked as undetectable | |
9185 return false; | |
9186 } | |
9187 | |
9188 | |
9189 bool String::IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match) { | 9172 bool String::IsUtf8EqualTo(Vector<const char> str, bool allow_prefix_match) { |
9190 int slen = length(); | 9173 int slen = length(); |
9191 // Can't check exact length equality, but we can check bounds. | 9174 // Can't check exact length equality, but we can check bounds. |
9192 int str_len = str.length(); | 9175 int str_len = str.length(); |
9193 if (!allow_prefix_match && | 9176 if (!allow_prefix_match && |
9194 (str_len < slen || | 9177 (str_len < slen || |
9195 str_len > slen*static_cast<int>(unibrow::Utf8::kMaxEncodedSize))) { | 9178 str_len > slen*static_cast<int>(unibrow::Utf8::kMaxEncodedSize))) { |
9196 return false; | 9179 return false; |
9197 } | 9180 } |
9198 int i; | 9181 int i; |
(...skipping 7741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16940 Handle<DependentCode> codes = | 16923 Handle<DependentCode> codes = |
16941 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16924 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16942 DependentCode::kPropertyCellChangedGroup, | 16925 DependentCode::kPropertyCellChangedGroup, |
16943 info->object_wrapper()); | 16926 info->object_wrapper()); |
16944 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16927 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16945 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16928 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16946 cell, info->zone()); | 16929 cell, info->zone()); |
16947 } | 16930 } |
16948 | 16931 |
16949 } } // namespace v8::internal | 16932 } } // namespace v8::internal |
OLD | NEW |