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 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2244 } | 2244 } |
2245 | 2245 |
2246 // ES6 section 24.3.1 JSON.parse. | 2246 // ES6 section 24.3.1 JSON.parse. |
2247 BUILTIN(JsonParse) { | 2247 BUILTIN(JsonParse) { |
2248 HandleScope scope(isolate); | 2248 HandleScope scope(isolate); |
2249 Handle<Object> source = args.atOrUndefined(isolate, 1); | 2249 Handle<Object> source = args.atOrUndefined(isolate, 1); |
2250 Handle<Object> reviver = args.atOrUndefined(isolate, 2); | 2250 Handle<Object> reviver = args.atOrUndefined(isolate, 2); |
2251 Handle<String> string; | 2251 Handle<String> string; |
2252 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, string, | 2252 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, string, |
2253 Object::ToString(isolate, source)); | 2253 Object::ToString(isolate, source)); |
| 2254 string = String::Flatten(string); |
2254 RETURN_RESULT_OR_FAILURE( | 2255 RETURN_RESULT_OR_FAILURE( |
2255 isolate, string->IsSeqOneByteString() | 2256 isolate, string->IsSeqOneByteString() |
2256 ? JsonParser<true>::Parse(isolate, string, reviver) | 2257 ? JsonParser<true>::Parse(isolate, string, reviver) |
2257 : JsonParser<false>::Parse(isolate, string, reviver)); | 2258 : JsonParser<false>::Parse(isolate, string, reviver)); |
2258 } | 2259 } |
2259 | 2260 |
2260 // ES6 section 24.3.2 JSON.stringify. | 2261 // ES6 section 24.3.2 JSON.stringify. |
2261 BUILTIN(JsonStringify) { | 2262 BUILTIN(JsonStringify) { |
2262 HandleScope scope(isolate); | 2263 HandleScope scope(isolate); |
2263 JsonStringifier stringifier(isolate); | 2264 JsonStringifier stringifier(isolate); |
(...skipping 3541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5805 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) | 5806 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) |
5806 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 5807 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
5807 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 5808 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
5808 #undef DEFINE_BUILTIN_ACCESSOR_C | 5809 #undef DEFINE_BUILTIN_ACCESSOR_C |
5809 #undef DEFINE_BUILTIN_ACCESSOR_A | 5810 #undef DEFINE_BUILTIN_ACCESSOR_A |
5810 #undef DEFINE_BUILTIN_ACCESSOR_T | 5811 #undef DEFINE_BUILTIN_ACCESSOR_T |
5811 #undef DEFINE_BUILTIN_ACCESSOR_H | 5812 #undef DEFINE_BUILTIN_ACCESSOR_H |
5812 | 5813 |
5813 } // namespace internal | 5814 } // namespace internal |
5814 } // namespace v8 | 5815 } // namespace v8 |
OLD | NEW |