OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 Vector<const uc16> GetCharVector(Handle<String> string) { | 54 Vector<const uc16> GetCharVector(Handle<String> string) { |
55 String::FlatContent flat = string->GetFlatContent(); | 55 String::FlatContent flat = string->GetFlatContent(); |
56 ASSERT(flat.IsTwoByte()); | 56 ASSERT(flat.IsTwoByte()); |
57 return flat.ToUC16Vector(); | 57 return flat.ToUC16Vector(); |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 class URIUnescape : public AllStatic { | 61 class URIUnescape : public AllStatic { |
62 public: | 62 public: |
63 template<typename Char> | 63 template<typename Char> |
64 static MaybeHandle<String> Unescape(Isolate* isolate, Handle<String> source); | 64 MUST_USE_RESULT static MaybeHandle<String> Unescape(Isolate* isolate, |
| 65 Handle<String> source); |
65 | 66 |
66 private: | 67 private: |
67 static const signed char kHexValue['g']; | 68 static const signed char kHexValue['g']; |
68 | 69 |
69 template<typename Char> | 70 template<typename Char> |
70 static MaybeHandle<String> UnescapeSlow( | 71 MUST_USE_RESULT static MaybeHandle<String> UnescapeSlow( |
71 Isolate* isolate, Handle<String> string, int start_index); | 72 Isolate* isolate, Handle<String> string, int start_index); |
72 | 73 |
73 static INLINE(int TwoDigitHex(uint16_t character1, uint16_t character2)); | 74 static INLINE(int TwoDigitHex(uint16_t character1, uint16_t character2)); |
74 | 75 |
75 template <typename Char> | 76 template <typename Char> |
76 static INLINE(int UnescapeChar(Vector<const Char> vector, | 77 static INLINE(int UnescapeChar(Vector<const Char> vector, |
77 int i, | 78 int i, |
78 int length, | 79 int length, |
79 int* step)); | 80 int* step)); |
80 }; | 81 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } else { | 196 } else { |
196 *step = 1; | 197 *step = 1; |
197 return character; | 198 return character; |
198 } | 199 } |
199 } | 200 } |
200 | 201 |
201 | 202 |
202 class URIEscape : public AllStatic { | 203 class URIEscape : public AllStatic { |
203 public: | 204 public: |
204 template<typename Char> | 205 template<typename Char> |
205 static MaybeHandle<String> Escape(Isolate* isolate, Handle<String> string); | 206 MUST_USE_RESULT static MaybeHandle<String> Escape(Isolate* isolate, |
| 207 Handle<String> string); |
206 | 208 |
207 private: | 209 private: |
208 static const char kHexChars[17]; | 210 static const char kHexChars[17]; |
209 static const char kNotEscaped[256]; | 211 static const char kNotEscaped[256]; |
210 | 212 |
211 static bool IsNotEscaped(uint16_t c) { return kNotEscaped[c] != 0; } | 213 static bool IsNotEscaped(uint16_t c) { return kNotEscaped[c] != 0; } |
212 }; | 214 }; |
213 | 215 |
214 | 216 |
215 const char URIEscape::kHexChars[] = "0123456789ABCDEF"; | 217 const char URIEscape::kHexChars[] = "0123456789ABCDEF"; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 } | 304 } |
303 } | 305 } |
304 } | 306 } |
305 | 307 |
306 return dest; | 308 return dest; |
307 } | 309 } |
308 | 310 |
309 } } // namespace v8::internal | 311 } } // namespace v8::internal |
310 | 312 |
311 #endif // V8_URI_H_ | 313 #endif // V8_URI_H_ |
OLD | NEW |