OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 AppendAscii("true"); | 427 AppendAscii("true"); |
428 return SUCCESS; | 428 return SUCCESS; |
429 case Oddball::kNull: | 429 case Oddball::kNull: |
430 if (deferred_string_key) SerializeDeferredKey(comma, key); | 430 if (deferred_string_key) SerializeDeferredKey(comma, key); |
431 AppendAscii("null"); | 431 AppendAscii("null"); |
432 return SUCCESS; | 432 return SUCCESS; |
433 default: | 433 default: |
434 return UNCHANGED; | 434 return UNCHANGED; |
435 } | 435 } |
436 case JS_ARRAY_TYPE: | 436 case JS_ARRAY_TYPE: |
| 437 if (object->IsAccessCheckNeeded()) break; |
437 if (deferred_string_key) SerializeDeferredKey(comma, key); | 438 if (deferred_string_key) SerializeDeferredKey(comma, key); |
438 return SerializeJSArray(Handle<JSArray>::cast(object)); | 439 return SerializeJSArray(Handle<JSArray>::cast(object)); |
439 case JS_VALUE_TYPE: | 440 case JS_VALUE_TYPE: |
440 if (deferred_string_key) SerializeDeferredKey(comma, key); | 441 if (deferred_string_key) SerializeDeferredKey(comma, key); |
441 return SerializeJSValue(Handle<JSValue>::cast(object)); | 442 return SerializeJSValue(Handle<JSValue>::cast(object)); |
442 case JS_FUNCTION_TYPE: | 443 case JS_FUNCTION_TYPE: |
443 return UNCHANGED; | 444 return UNCHANGED; |
444 default: | 445 default: |
445 if (object->IsString()) { | 446 if (object->IsString()) { |
446 if (deferred_string_key) SerializeDeferredKey(comma, key); | 447 if (deferred_string_key) SerializeDeferredKey(comma, key); |
447 SerializeString(Handle<String>::cast(object)); | 448 SerializeString(Handle<String>::cast(object)); |
448 return SUCCESS; | 449 return SUCCESS; |
449 } else if (object->IsJSObject()) { | 450 } else if (object->IsJSObject()) { |
| 451 if (object->IsAccessCheckNeeded()) break; |
450 if (deferred_string_key) SerializeDeferredKey(comma, key); | 452 if (deferred_string_key) SerializeDeferredKey(comma, key); |
451 return SerializeJSObject(Handle<JSObject>::cast(object)); | 453 return SerializeJSObject(Handle<JSObject>::cast(object)); |
452 } else { | |
453 return SerializeGeneric(object, key, comma, deferred_string_key); | |
454 } | 454 } |
455 } | 455 } |
| 456 |
| 457 return SerializeGeneric(object, key, comma, deferred_string_key); |
456 } | 458 } |
457 | 459 |
458 | 460 |
459 BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric( | 461 BasicJsonStringifier::Result BasicJsonStringifier::SerializeGeneric( |
460 Handle<Object> object, | 462 Handle<Object> object, |
461 Handle<Object> key, | 463 Handle<Object> key, |
462 bool deferred_comma, | 464 bool deferred_comma, |
463 bool deferred_key) { | 465 bool deferred_key) { |
464 Handle<JSObject> builtins(isolate_->native_context()->builtins()); | 466 Handle<JSObject> builtins(isolate_->native_context()->builtins()); |
465 Handle<JSFunction> builtin = | 467 Handle<JSFunction> builtin = |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 SerializeString_<false, uint8_t>(object); | 842 SerializeString_<false, uint8_t>(object); |
841 } else { | 843 } else { |
842 SerializeString_<false, uc16>(object); | 844 SerializeString_<false, uc16>(object); |
843 } | 845 } |
844 } | 846 } |
845 } | 847 } |
846 | 848 |
847 } } // namespace v8::internal | 849 } } // namespace v8::internal |
848 | 850 |
849 #endif // V8_JSON_STRINGIFIER_H_ | 851 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |