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

Side by Side Diff: src/builtins.cc

Issue 1994733003: Rewrite decodeURL as builtin function, remove now unused runtime functions. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments 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 unified diff | Download patch
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 2085 matching lines...) Expand 10 before | Expand all | Expand 10 after
2096 HandleScope scope(isolate); 2096 HandleScope scope(isolate);
2097 Handle<Object> object = args.atOrUndefined(isolate, 1); 2097 Handle<Object> object = args.atOrUndefined(isolate, 1);
2098 if (object->IsJSReceiver()) { 2098 if (object->IsJSReceiver()) {
2099 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), 2099 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object),
2100 SEALED, Object::THROW_ON_ERROR), 2100 SEALED, Object::THROW_ON_ERROR),
2101 isolate->heap()->exception()); 2101 isolate->heap()->exception());
2102 } 2102 }
2103 return *object; 2103 return *object;
2104 } 2104 }
2105 2105
2106 // ES6 section 18.2.6.2 decodeURI (encodedURI)
2107 BUILTIN(GlobalDecodeURI) {
2108 HandleScope scope(isolate);
2109 Handle<String> encoded_uri;
2110 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2111 isolate, encoded_uri,
2112 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2113
2114 Handle<Object> result;
2115 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
2116 Uri::DecodeUri(isolate, encoded_uri));
2117 return *result;
2118 }
2119
2120 // ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent)
2121 BUILTIN(GlobalDecodeURIComponent) {
2122 HandleScope scope(isolate);
2123 Handle<String> encoded_uri_component;
2124 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2125 isolate, encoded_uri_component,
2126 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2127
2128 Handle<Object> result;
2129 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2130 isolate, result, Uri::DecodeUriComponent(isolate, encoded_uri_component));
2131 return *result;
2132 }
2133
2106 // ES6 section 18.2.6.4 encodeURI (uri) 2134 // ES6 section 18.2.6.4 encodeURI (uri)
2107 BUILTIN(GlobalEncodeURI) { 2135 BUILTIN(GlobalEncodeURI) {
2108 HandleScope scope(isolate); 2136 HandleScope scope(isolate);
2109 Handle<String> uri; 2137 Handle<String> uri;
2110 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2138 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2111 isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1))); 2139 isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2112 2140
2113 return Uri::EncodeUri(isolate, uri); 2141 Handle<Object> result;
2142 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result,
2143 Uri::EncodeUri(isolate, uri));
2144 return *result;
2114 } 2145 }
2115 2146
2116 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent) 2147 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
2117 BUILTIN(GlobalEncodeURIComponent) { 2148 BUILTIN(GlobalEncodeURIComponent) {
2118 HandleScope scope(isolate); 2149 HandleScope scope(isolate);
2119 Handle<String> uriComponent; 2150 Handle<String> uri_component;
2120 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( 2151 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2121 isolate, uriComponent, 2152 isolate, uri_component,
2122 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); 2153 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2123 2154
2124 return Uri::EncodeUriComponent(isolate, uriComponent); 2155 Handle<Object> result;
2156 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2157 isolate, result, Uri::EncodeUriComponent(isolate, uri_component));
2158 return *result;
2125 } 2159 }
2126 2160
2127 namespace { 2161 namespace {
2128 2162
2129 bool CodeGenerationFromStringsAllowed(Isolate* isolate, 2163 bool CodeGenerationFromStringsAllowed(Isolate* isolate,
2130 Handle<Context> context) { 2164 Handle<Context> context) {
2131 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); 2165 DCHECK(context->allow_code_gen_from_strings()->IsFalse());
2132 // Check with callback if set. 2166 // Check with callback if set.
2133 AllowCodeGenerationFromStringsCallback callback = 2167 AllowCodeGenerationFromStringsCallback callback =
2134 isolate->allow_code_gen_callback(); 2168 isolate->allow_code_gen_callback();
(...skipping 3444 matching lines...) Expand 10 before | Expand all | Expand 10 after
5579 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5613 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5580 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5614 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5581 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5615 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5582 #undef DEFINE_BUILTIN_ACCESSOR_C 5616 #undef DEFINE_BUILTIN_ACCESSOR_C
5583 #undef DEFINE_BUILTIN_ACCESSOR_A 5617 #undef DEFINE_BUILTIN_ACCESSOR_A
5584 #undef DEFINE_BUILTIN_ACCESSOR_T 5618 #undef DEFINE_BUILTIN_ACCESSOR_T
5585 #undef DEFINE_BUILTIN_ACCESSOR_H 5619 #undef DEFINE_BUILTIN_ACCESSOR_H
5586 5620
5587 } // namespace internal 5621 } // namespace internal
5588 } // namespace v8 5622 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/crankshaft/hydrogen.h » ('j') | src/uri.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698