OLD | NEW |
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 2075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2086 HandleScope scope(isolate); | 2086 HandleScope scope(isolate); |
2087 Handle<Object> object = args.atOrUndefined(isolate, 1); | 2087 Handle<Object> object = args.atOrUndefined(isolate, 1); |
2088 if (object->IsJSReceiver()) { | 2088 if (object->IsJSReceiver()) { |
2089 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), | 2089 MAYBE_RETURN(JSReceiver::SetIntegrityLevel(Handle<JSReceiver>::cast(object), |
2090 SEALED, Object::THROW_ON_ERROR), | 2090 SEALED, Object::THROW_ON_ERROR), |
2091 isolate->heap()->exception()); | 2091 isolate->heap()->exception()); |
2092 } | 2092 } |
2093 return *object; | 2093 return *object; |
2094 } | 2094 } |
2095 | 2095 |
| 2096 // ES6 section 18.2.6.2 decodeURI (encodedURI) |
| 2097 BUILTIN(GlobalDecodeURI) { |
| 2098 HandleScope scope(isolate); |
| 2099 Handle<String> encoded_uri; |
| 2100 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 2101 isolate, encoded_uri, |
| 2102 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
| 2103 |
| 2104 RETURN_RESULT_OR_FAILURE(isolate, Uri::DecodeUri(isolate, encoded_uri)); |
| 2105 } |
| 2106 |
| 2107 // ES6 section 18.2.6.3 decodeURIComponent (encodedURIComponent) |
| 2108 BUILTIN(GlobalDecodeURIComponent) { |
| 2109 HandleScope scope(isolate); |
| 2110 Handle<String> encoded_uri_component; |
| 2111 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
| 2112 isolate, encoded_uri_component, |
| 2113 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
| 2114 |
| 2115 RETURN_RESULT_OR_FAILURE( |
| 2116 isolate, Uri::DecodeUriComponent(isolate, encoded_uri_component)); |
| 2117 } |
| 2118 |
2096 // ES6 section 18.2.6.4 encodeURI (uri) | 2119 // ES6 section 18.2.6.4 encodeURI (uri) |
2097 BUILTIN(GlobalEncodeURI) { | 2120 BUILTIN(GlobalEncodeURI) { |
2098 HandleScope scope(isolate); | 2121 HandleScope scope(isolate); |
2099 Handle<String> uri; | 2122 Handle<String> uri; |
2100 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2123 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2101 isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1))); | 2124 isolate, uri, Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
2102 | 2125 |
2103 RETURN_RESULT_OR_FAILURE(isolate, Uri::EncodeUri(isolate, uri)); | 2126 RETURN_RESULT_OR_FAILURE(isolate, Uri::EncodeUri(isolate, uri)); |
2104 } | 2127 } |
2105 | 2128 |
2106 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent) | 2129 // ES6 section 18.2.6.5 encodeURIComponenet (uriComponent) |
2107 BUILTIN(GlobalEncodeURIComponent) { | 2130 BUILTIN(GlobalEncodeURIComponent) { |
2108 HandleScope scope(isolate); | 2131 HandleScope scope(isolate); |
2109 Handle<String> uriComponent; | 2132 Handle<String> uri_component; |
2110 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2133 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2111 isolate, uriComponent, | 2134 isolate, uri_component, |
2112 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); | 2135 Object::ToString(isolate, args.atOrUndefined(isolate, 1))); |
2113 | 2136 |
2114 RETURN_RESULT_OR_FAILURE(isolate, | 2137 RETURN_RESULT_OR_FAILURE(isolate, |
2115 Uri::EncodeUriComponent(isolate, uriComponent)); | 2138 Uri::EncodeUriComponent(isolate, uri_component)); |
2116 } | 2139 } |
2117 | 2140 |
2118 namespace { | 2141 namespace { |
2119 | 2142 |
2120 bool CodeGenerationFromStringsAllowed(Isolate* isolate, | 2143 bool CodeGenerationFromStringsAllowed(Isolate* isolate, |
2121 Handle<Context> context) { | 2144 Handle<Context> context) { |
2122 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); | 2145 DCHECK(context->allow_code_gen_from_strings()->IsFalse()); |
2123 // Check with callback if set. | 2146 // Check with callback if set. |
2124 AllowCodeGenerationFromStringsCallback callback = | 2147 AllowCodeGenerationFromStringsCallback callback = |
2125 isolate->allow_code_gen_callback(); | 2148 isolate->allow_code_gen_callback(); |
(...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5543 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | 5566 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) |
5544 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 5567 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
5545 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 5568 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
5546 #undef DEFINE_BUILTIN_ACCESSOR_C | 5569 #undef DEFINE_BUILTIN_ACCESSOR_C |
5547 #undef DEFINE_BUILTIN_ACCESSOR_A | 5570 #undef DEFINE_BUILTIN_ACCESSOR_A |
5548 #undef DEFINE_BUILTIN_ACCESSOR_T | 5571 #undef DEFINE_BUILTIN_ACCESSOR_T |
5549 #undef DEFINE_BUILTIN_ACCESSOR_H | 5572 #undef DEFINE_BUILTIN_ACCESSOR_H |
5550 | 5573 |
5551 } // namespace internal | 5574 } // namespace internal |
5552 } // namespace v8 | 5575 } // namespace v8 |
OLD | NEW |