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 "v8.h" | 8 #include "v8.h" |
9 #include "conversions.h" | 9 #include "conversions.h" |
10 #include "utils.h" | 10 #include "utils.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 template <bool is_ascii, typename Char> | 333 template <bool is_ascii, typename Char> |
334 void BasicJsonStringifier::Append_(const Char* chars) { | 334 void BasicJsonStringifier::Append_(const Char* chars) { |
335 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars); | 335 for ( ; *chars != '\0'; chars++) Append_<is_ascii, Char>(*chars); |
336 } | 336 } |
337 | 337 |
338 | 338 |
339 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( | 339 MaybeHandle<Object> BasicJsonStringifier::ApplyToJsonFunction( |
340 Handle<Object> object, Handle<Object> key) { | 340 Handle<Object> object, Handle<Object> key) { |
341 LookupResult lookup(isolate_); | 341 LookupResult lookup(isolate_); |
342 JSObject::cast(*object)->LookupRealNamedProperty(*tojson_string_, &lookup); | 342 JSObject::cast(*object)->LookupRealNamedProperty(tojson_string_, &lookup); |
343 if (!lookup.IsProperty()) return object; | 343 if (!lookup.IsProperty()) return object; |
344 PropertyAttributes attr; | 344 PropertyAttributes attr; |
345 Handle<Object> fun; | 345 Handle<Object> fun; |
346 ASSIGN_RETURN_ON_EXCEPTION( | 346 ASSIGN_RETURN_ON_EXCEPTION( |
347 isolate_, fun, | 347 isolate_, fun, |
348 Object::GetProperty(object, object, &lookup, tojson_string_, &attr), | 348 Object::GetProperty(object, object, &lookup, tojson_string_, &attr), |
349 Object); | 349 Object); |
350 if (!fun->IsJSFunction()) return object; | 350 if (!fun->IsJSFunction()) return object; |
351 | 351 |
352 // Call toJSON function. | 352 // Call toJSON function. |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
875 SerializeString_<false, uint8_t>(object); | 875 SerializeString_<false, uint8_t>(object); |
876 } else { | 876 } else { |
877 SerializeString_<false, uc16>(object); | 877 SerializeString_<false, uc16>(object); |
878 } | 878 } |
879 } | 879 } |
880 } | 880 } |
881 | 881 |
882 } } // namespace v8::internal | 882 } } // namespace v8::internal |
883 | 883 |
884 #endif // V8_JSON_STRINGIFIER_H_ | 884 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |