OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 "src/runtime/runtime-utils.h" | 5 #include "src/runtime/runtime-utils.h" |
6 | 6 |
7 #include "src/arguments.h" | 7 #include "src/arguments.h" |
8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
9 #include "src/isolate-inl.h" | 9 #include "src/isolate-inl.h" |
10 #include "src/objects-inl.h" | 10 #include "src/objects-inl.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 } | 251 } |
252 } | 252 } |
253 } | 253 } |
254 | 254 |
255 return dest; | 255 return dest; |
256 } | 256 } |
257 | 257 |
258 | 258 |
259 RUNTIME_FUNCTION(Runtime_URIEscape) { | 259 RUNTIME_FUNCTION(Runtime_URIEscape) { |
260 HandleScope scope(isolate); | 260 HandleScope scope(isolate); |
261 DCHECK(args.length() == 1); | 261 DCHECK_EQ(1, args.length()); |
262 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 262 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
263 Handle<String> string = String::Flatten(source); | 263 Handle<String> source; |
264 DCHECK(string->IsFlat()); | 264 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, source, |
| 265 Object::ToString(isolate, input)); |
| 266 source = String::Flatten(source); |
265 Handle<String> result; | 267 Handle<String> result; |
266 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 268 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
267 isolate, result, string->IsOneByteRepresentationUnderneath() | 269 isolate, result, source->IsOneByteRepresentationUnderneath() |
268 ? URIEscape::Escape<uint8_t>(isolate, source) | 270 ? URIEscape::Escape<uint8_t>(isolate, source) |
269 : URIEscape::Escape<uc16>(isolate, source)); | 271 : URIEscape::Escape<uc16>(isolate, source)); |
270 return *result; | 272 return *result; |
271 } | 273 } |
272 | 274 |
273 | 275 |
274 RUNTIME_FUNCTION(Runtime_URIUnescape) { | 276 RUNTIME_FUNCTION(Runtime_URIUnescape) { |
275 HandleScope scope(isolate); | 277 HandleScope scope(isolate); |
276 DCHECK(args.length() == 1); | 278 DCHECK(args.length() == 1); |
277 CONVERT_ARG_HANDLE_CHECKED(String, source, 0); | 279 CONVERT_ARG_HANDLE_CHECKED(Object, input, 0); |
278 Handle<String> string = String::Flatten(source); | 280 Handle<String> source; |
279 DCHECK(string->IsFlat()); | 281 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, source, |
| 282 Object::ToString(isolate, input)); |
| 283 source = String::Flatten(source); |
280 Handle<String> result; | 284 Handle<String> result; |
281 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 285 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
282 isolate, result, string->IsOneByteRepresentationUnderneath() | 286 isolate, result, source->IsOneByteRepresentationUnderneath() |
283 ? URIUnescape::Unescape<uint8_t>(isolate, source) | 287 ? URIUnescape::Unescape<uint8_t>(isolate, source) |
284 : URIUnescape::Unescape<uc16>(isolate, source)); | 288 : URIUnescape::Unescape<uc16>(isolate, source)); |
285 return *result; | 289 return *result; |
286 } | 290 } |
| 291 |
287 } // namespace internal | 292 } // namespace internal |
288 } // namespace v8 | 293 } // namespace v8 |
OLD | NEW |