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 8271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8282 if (shape.representation_tag() == kSeqStringTag) { | 8282 if (shape.representation_tag() == kSeqStringTag) { |
8283 start = SeqTwoByteString::cast(string)->GetChars(); | 8283 start = SeqTwoByteString::cast(string)->GetChars(); |
8284 } else { | 8284 } else { |
8285 start = ExternalTwoByteString::cast(string)->GetChars(); | 8285 start = ExternalTwoByteString::cast(string)->GetChars(); |
8286 } | 8286 } |
8287 return FlatContent(start + offset, length); | 8287 return FlatContent(start + offset, length); |
8288 } | 8288 } |
8289 } | 8289 } |
8290 | 8290 |
8291 | 8291 |
| 8292 template <> |
| 8293 Vector<const uint8_t> String::GetCharVector() { |
| 8294 String::FlatContent flat = GetFlatContent(); |
| 8295 DCHECK(flat.IsOneByte()); |
| 8296 return flat.ToOneByteVector(); |
| 8297 } |
| 8298 |
| 8299 |
| 8300 template <> |
| 8301 Vector<const uc16> String::GetCharVector() { |
| 8302 String::FlatContent flat = GetFlatContent(); |
| 8303 DCHECK(flat.IsTwoByte()); |
| 8304 return flat.ToUC16Vector(); |
| 8305 } |
| 8306 |
| 8307 |
8292 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls, | 8308 SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls, |
8293 RobustnessFlag robust_flag, | 8309 RobustnessFlag robust_flag, |
8294 int offset, | 8310 int offset, |
8295 int length, | 8311 int length, |
8296 int* length_return) { | 8312 int* length_return) { |
8297 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { | 8313 if (robust_flag == ROBUST_STRING_TRAVERSAL && !LooksValid()) { |
8298 return SmartArrayPointer<char>(NULL); | 8314 return SmartArrayPointer<char>(NULL); |
8299 } | 8315 } |
8300 // Negative length means the to the end of the string. | 8316 // Negative length means the to the end of the string. |
8301 if (length < 0) length = kMaxInt - offset; | 8317 if (length < 0) length = kMaxInt - offset; |
(...skipping 8527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16829 Handle<DependentCode> codes = | 16845 Handle<DependentCode> codes = |
16830 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16846 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16831 DependentCode::kPropertyCellChangedGroup, | 16847 DependentCode::kPropertyCellChangedGroup, |
16832 info->object_wrapper()); | 16848 info->object_wrapper()); |
16833 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16849 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16834 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16850 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16835 cell, info->zone()); | 16851 cell, info->zone()); |
16836 } | 16852 } |
16837 | 16853 |
16838 } } // namespace v8::internal | 16854 } } // namespace v8::internal |
OLD | NEW |