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

Side by Side 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, 6 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 unified diff | Download patch
« no previous file with comments | « src/builtins.h ('k') | src/js/uri.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api-arguments.h" 7 #include "src/api-arguments.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after
2149 HandleScope scope(isolate); 2149 HandleScope scope(isolate);
2150 Handle<String> uri_component; 2150 Handle<String> uri_component;
2151 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2151 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2152 isolate, uri_component, 2152 isolate, uri_component,
2153 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); 2153 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2154 2154
2155 RETURN_RESULT_OR_FAILURE(isolate, 2155 RETURN_RESULT_OR_FAILURE(isolate,
2156 Uri::EncodeUriComponent(isolate, uri_component)); 2156 Uri::EncodeUriComponent(isolate, uri_component));
2157 } 2157 }
2158 2158
2159 // ES6 section B.2.1.1 escape (string)
2160 BUILTIN(GlobalEscape) {
2161 HandleScope scope(isolate);
2162 Handle<String> string;
2163 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2164 isolate, string,
2165 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2166
2167 RETURN_RESULT_OR_FAILURE(isolate, Uri::Escape(isolate, string));
2168 }
2169
2170 // ES6 section B.2.1.2 unescape (string)
2171 BUILTIN(GlobalUnescape) {
2172 HandleScope scope(isolate);
2173 Handle<String> string;
2174 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2175 isolate, string,
2176 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2177
2178 RETURN_RESULT_OR_FAILURE(isolate, Uri::Unescape(isolate, string));
2179 }
2180
2159 namespace { 2181 namespace {
2160 2182
2161 bool CodeGenerationFromStringsAllowed(Isolate* isolate, 2183 bool CodeGenerationFromStringsAllowed(Isolate* isolate,
2162 Handle<Context> context) { 2184 Handle<Context> context) {
2163 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); 2185 DCHECK(context->allow_code_gen_from_strings()->IsFalse());
2164 // Check with callback if set. 2186 // Check with callback if set.
2165 AllowCodeGenerationFromStringsCallback callback = 2187 AllowCodeGenerationFromStringsCallback callback =
2166 isolate->allow_code_gen_callback(); 2188 isolate->allow_code_gen_callback();
2167 if (callback == NULL) { 2189 if (callback == NULL) {
2168 // No callback set and code generation disallowed. 2190 // No callback set and code generation disallowed.
(...skipping 3602 matching lines...) Expand 10 before | Expand all | Expand 10 after
5771 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5793 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5772 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5794 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5773 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5795 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5774 #undef DEFINE_BUILTIN_ACCESSOR_C 5796 #undef DEFINE_BUILTIN_ACCESSOR_C
5775 #undef DEFINE_BUILTIN_ACCESSOR_A 5797 #undef DEFINE_BUILTIN_ACCESSOR_A
5776 #undef DEFINE_BUILTIN_ACCESSOR_T 5798 #undef DEFINE_BUILTIN_ACCESSOR_T
5777 #undef DEFINE_BUILTIN_ACCESSOR_H 5799 #undef DEFINE_BUILTIN_ACCESSOR_H
5778 5800
5779 } // namespace internal 5801 } // namespace internal
5780 } // namespace v8 5802 } // namespace v8
OLDNEW
« 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