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 #ifndef V8_JSON_STRINGIFIER_H_ | 5 #ifndef V8_JSON_STRINGIFIER_H_ |
6 #define V8_JSON_STRINGIFIER_H_ | 6 #define V8_JSON_STRINGIFIER_H_ |
7 | 7 |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #include "src/conversions.h" | 10 #include "src/conversions.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 template <bool is_ascii, typename Char> | 334 template <bool is_ascii, typename Char> |
335 void BasicJsonStringifier::Append_(const Char* chars) { | 335 void BasicJsonStringifier::Append_(const Char* chars) { |
336 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars); | 336 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars); |
337 } | 337 } |
338 | 338 |
339 | 339 |
340 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( | 340 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( |
341 Handle<Object> object, Handle<Object> key) { | 341 Handle<Object> object, Handle<Object> key) { |
342 LookupIterator it(object, tojson_string_, | 342 LookupIterator it(object, tojson_string_, |
343 LookupIterator::CHECK_DERIVED_SKIP_INTERCEPTOR); | 343 LookupIterator::PROTOTYPE_CHAIN_SKIP_INTERCEPTOR); |
344 Handle<Object> fun; | 344 Handle<Object> fun; |
345 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object); | 345 ASSIGN_RETURN_ON_EXCEPTION(isolate_, fun, Object::GetProperty(&it), Object); |
346 if (!fun->IsJSFunction()) return object; | 346 if (!fun->IsJSFunction()) return object; |
347 | 347 |
348 // Call toJSON function. | 348 // Call toJSON function. |
349 if (key->IsSmi()) key = factory_->NumberToString(key); | 349 if (key->IsSmi()) key = factory_->NumberToString(key); |
350 Handle<Object> argv[] = { key }; | 350 Handle<Object> argv[] = { key }; |
351 HandleScope scope(isolate_); | 351 HandleScope scope(isolate_); |
352 ASSIGN_RETURN_ON_EXCEPTION( | 352 ASSIGN_RETURN_ON_EXCEPTION( |
353 isolate_, object, | 353 isolate_, object, |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 SerializeString_<false, uint8_t>(object); | 869 SerializeString_<false, uint8_t>(object); |
870 } else { | 870 } else { |
871 SerializeString_<false, uc16>(object); | 871 SerializeString_<false, uc16>(object); |
872 } | 872 } |
873 } | 873 } |
874 } | 874 } |
875 | 875 |
876 } } // namespace v8::internal | 876 } } // namespace v8::internal |
877 | 877 |
878 #endif // V8_JSON_STRINGIFIER_H_ | 878 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |