}
+template <>
+inline Vector<const uint8_t> String::GetCharVector() {
+ String::FlatContent flat = GetFlatContent();
+ DCHECK(flat.IsOneByte());
+ return flat.ToOneByteVector();
+}
+
+
+template <>
+inline Vector<const uc16> String::GetCharVector() {
+ String::FlatContent flat = GetFlatContent();
+ DCHECK(flat.IsTwoByte());
+ return flat.ToUC16Vector();
+}
+
+
uint16_t SeqOneByteString::SeqOneByteStringGet(int index) {
DCHECK(index >= 0 && index < length());
return READ_BYTE_FIELD(this, kHeaderSize + index * kCharSize);
}
-template <>
-Vector<const uint8_t> String::GetCharVector() {
- String::FlatContent flat = GetFlatContent();
- DCHECK(flat.IsOneByte());
- return flat.ToOneByteVector();
-}
-
-
-template <>
-Vector<const uc16> String::GetCharVector() {
- String::FlatContent flat = GetFlatContent();
- DCHECK(flat.IsTwoByte());
- return flat.ToUC16Vector();
-}
-
-
SmartArrayPointer<char> String::ToCString(AllowNullsFlag allow_nulls,
RobustnessFlag robust_flag,
int offset,
namespace v8 {
namespace internal {
-template <typename Char>
-static INLINE(Vector<const Char> GetCharVector(Handle<String> string));
-
-
-template <>
-Vector<const uint8_t> GetCharVector(Handle<String> string) {
- String::FlatContent flat = string->GetFlatContent();
- DCHECK(flat.IsOneByte());
- return flat.ToOneByteVector();
-}
-
-
-template <>
-Vector<const uc16> GetCharVector(Handle<String> string) {
- String::FlatContent flat = string->GetFlatContent();
- DCHECK(flat.IsTwoByte());
- return flat.ToUC16Vector();
-}
-
-
class URIUnescape : public AllStatic {
public:
template <typename Char>
{
DisallowHeapAllocation no_allocation;
StringSearch<uint8_t, Char> search(isolate, STATIC_CHAR_VECTOR("%"));
- index = search.Search(GetCharVector<Char>(source), 0);
+ index = search.Search(source->GetCharVector<Char>(), 0);
if (index < 0) return source;
}
return UnescapeSlow<Char>(isolate, source, index);
int unescaped_length = 0;
{
DisallowHeapAllocation no_allocation;
- Vector<const Char> vector = GetCharVector<Char>(string);
+ Vector<const Char> vector = string->GetCharVector<Char>();
for (int i = start_index; i < length; unescaped_length++) {
int step;
if (UnescapeChar(vector, i, length, &step) >
->NewRawOneByteString(unescaped_length)
.ToHandleChecked();
DisallowHeapAllocation no_allocation;
- Vector<const Char> vector = GetCharVector<Char>(string);
+ Vector<const Char> vector = string->GetCharVector<Char>();
for (int i = start_index; i < length; dest_position++) {
int step;
dest->SeqOneByteStringSet(dest_position,
->NewRawTwoByteString(unescaped_length)
.ToHandleChecked();
DisallowHeapAllocation no_allocation;
- Vector<const Char> vector = GetCharVector<Char>(string);
+ Vector<const Char> vector = string->GetCharVector<Char>();
for (int i = start_index; i < length; dest_position++) {
int step;
dest->SeqTwoByteStringSet(dest_position,
{
DisallowHeapAllocation no_allocation;
- Vector<const Char> vector = GetCharVector<Char>(string);
+ Vector<const Char> vector = string->GetCharVector<Char>();
for (int i = 0; i < length; i++) {
uint16_t c = vector[i];
if (c >= 256) {
{
DisallowHeapAllocation no_allocation;
- Vector<const Char> vector = GetCharVector<Char>(string);
+ Vector<const Char> vector = string->GetCharVector<Char>();
for (int i = 0; i < length; i++) {
uint16_t c = vector[i];
if (c >= 256) {