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

Side by Side Diff: src/builtins.cc

Issue 1983593002: [builtins] Move EncodeURI from runtime to builtins. (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
« 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"
11 #include "src/bootstrapper.h" 11 #include "src/bootstrapper.h"
12 #include "src/code-factory.h" 12 #include "src/code-factory.h"
13 #include "src/code-stub-assembler.h" 13 #include "src/code-stub-assembler.h"
14 #include "src/dateparser-inl.h" 14 #include "src/dateparser-inl.h"
15 #include "src/elements.h" 15 #include "src/elements.h"
16 #include "src/frames-inl.h" 16 #include "src/frames-inl.h"
17 #include "src/gdb-jit.h" 17 #include "src/gdb-jit.h"
18 #include "src/ic/handler-compiler.h" 18 #include "src/ic/handler-compiler.h"
19 #include "src/ic/ic.h" 19 #include "src/ic/ic.h"
20 #include "src/isolate-inl.h" 20 #include "src/isolate-inl.h"
21 #include "src/messages.h" 21 #include "src/messages.h"
22 #include "src/profiler/cpu-profiler.h" 22 #include "src/profiler/cpu-profiler.h"
23 #include "src/property-descriptor.h" 23 #include "src/property-descriptor.h"
24 #include "src/prototype.h" 24 #include "src/prototype.h"
25 #include "src/string-builder.h" 25 #include "src/string-builder.h"
26 #include "src/uri.h"
26 #include "src/vm-state-inl.h" 27 #include "src/vm-state-inl.h"
27 28
28 namespace v8 { 29 namespace v8 {
29 namespace internal { 30 namespace internal {
30 31
31 namespace { 32 namespace {
32 33
33 // Arguments object passed to C++ builtins. 34 // Arguments object passed to C++ builtins.
34 template <BuiltinExtraArguments extra_args> 35 template <BuiltinExtraArguments extra_args>
35 class BuiltinArguments : public Arguments { 36 class BuiltinArguments : public Arguments {
(...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after
2099 HandleScope scope(isolate); 2100 HandleScope scope(isolate);
2100 Handle<Object> object = args.atOrUndefined(isolate, 1); 2101 Handle<Object> object = args.atOrUndefined(isolate, 1);
2101 if (object->IsJSReceiver()) { 2102 if (object->IsJSReceiver()) {
2102 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), 2103 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object),
2103 SEALED, Object::THROW_ON_ERROR), 2104 SEALED, Object::THROW_ON_ERROR),
2104 isolate->heap()->exception()); 2105 isolate->heap()->exception());
2105 } 2106 }
2106 return *object; 2107 return *object;
2107 } 2108 }
2108 2109
2110 // ES6 section 18.2.6.4 encodeURI (uri)
2111 BUILTIN(GlobalEncodeURI) {
2112 HandleScope scope(isolate);
2113 Handle<String> uri;
2114 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2115 isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2116
2117 return Uri::EncodeUri(isolate, uri);
2118 }
2119
2120 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent)
2121 BUILTIN(GlobalEncodeURIComponent) {
2122 HandleScope scope(isolate);
2123 Handle<String> uriComponent;
2124 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
2125 isolate, uriComponent,
2126 Object::ToString(isolate, args.atOrUndefined(isolate, 1)));
2127
2128 return Uri::EncodeUriComponent(isolate, uriComponent);
2129 }
2109 2130
2110 namespace { 2131 namespace {
2111 2132
2112 bool CodeGenerationFromStringsAllowed(Isolate* isolate, 2133 bool CodeGenerationFromStringsAllowed(Isolate* isolate,
2113 Handle<Context> context) { 2134 Handle<Context> context) {
2114 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); 2135 DCHECK(context->allow_code_gen_from_strings()->IsFalse());
2115 // Check with callback if set. 2136 // Check with callback if set.
2116 AllowCodeGenerationFromStringsCallback callback = 2137 AllowCodeGenerationFromStringsCallback callback =
2117 isolate->allow_code_gen_callback(); 2138 isolate->allow_code_gen_callback();
2118 if (callback == NULL) { 2139 if (callback == NULL) {
(...skipping 3366 matching lines...) Expand 10 before | Expand all | Expand 10 after
5485 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 5506 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
5486 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 5507 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
5487 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 5508 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
5488 #undef DEFINE_BUILTIN_ACCESSOR_C 5509 #undef DEFINE_BUILTIN_ACCESSOR_C
5489 #undef DEFINE_BUILTIN_ACCESSOR_A 5510 #undef DEFINE_BUILTIN_ACCESSOR_A
5490 #undef DEFINE_BUILTIN_ACCESSOR_T 5511 #undef DEFINE_BUILTIN_ACCESSOR_T
5491 #undef DEFINE_BUILTIN_ACCESSOR_H 5512 #undef DEFINE_BUILTIN_ACCESSOR_H
5492 5513
5493 } // namespace internal 5514 } // namespace internal
5494 } // namespace v8 5515 } // 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