Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: src/builtins.cc

Issue 2027003002: [builtins] Migrate escape/unescape from uri.js to C++. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Minor refactoring Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.h ('k') | src/js/uri.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 46f8819ab489ed424f3095c3a83d56c58c50d992..07817fe8c0899444decbddebeb73acd90d6a5e6c 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -2156,6 +2156,28 @@ BUILTIN(GlobalEncodeURIComponent) {
Uri::EncodeUriComponent(isolate, uri_component));
}
+// ES6 section B.2.1.1 escape (string)
+BUILTIN(GlobalEscape) {
+ HandleScope scope(isolate);
+ Handle<String> string;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, string,
+ Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
+
+ RETURN_RESULT_OR_FAILURE(isolate, Uri::Escape(isolate, string));
+}
+
+// ES6 section B.2.1.2 unescape (string)
+BUILTIN(GlobalUnescape) {
+ HandleScope scope(isolate);
+ Handle<String> string;
+ ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
+ isolate, string,
+ Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
+
+ RETURN_RESULT_OR_FAILURE(isolate, Uri::Unescape(isolate, string));
+}
+
namespace {
bool CodeGenerationFromStringsAllowed(Isolate* isolate,
« no previous file with comments | « src/builtins.h ('k') | src/js/uri.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698