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 583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 current_part_ = handle_scope.CloseAndEscape(current_part_); | 594 current_part_ = handle_scope.CloseAndEscape(current_part_); |
595 return SUCCESS; | 595 return SUCCESS; |
596 } | 596 } |
597 | 597 |
598 | 598 |
599 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArraySlow( | 599 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArraySlow( |
600 Handle<JSArray> object, int length) { | 600 Handle<JSArray> object, int length) { |
601 for (int i = 0; i < length; i++) { | 601 for (int i = 0; i < length; i++) { |
602 if (i > 0) Append(','); | 602 if (i > 0) Append(','); |
603 Handle<Object> element = Object::GetElement(object, i); | 603 Handle<Object> element = Object::GetElement(object, i); |
| 604 RETURN_IF_EMPTY_HANDLE_VALUE(isolate_, element, EXCEPTION); |
604 if (element->IsUndefined()) { | 605 if (element->IsUndefined()) { |
605 AppendAscii("null"); | 606 AppendAscii("null"); |
606 } else { | 607 } else { |
607 Result result = SerializeElement(object->GetIsolate(), element, i); | 608 Result result = SerializeElement(object->GetIsolate(), element, i); |
608 if (result == SUCCESS) continue; | 609 if (result == SUCCESS) continue; |
609 if (result == UNCHANGED) { | 610 if (result == UNCHANGED) { |
610 AppendAscii("null"); | 611 AppendAscii("null"); |
611 } else { | 612 } else { |
612 return result; | 613 return result; |
613 } | 614 } |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 SerializeString_<false, uint8_t>(object); | 843 SerializeString_<false, uint8_t>(object); |
843 } else { | 844 } else { |
844 SerializeString_<false, uc16>(object); | 845 SerializeString_<false, uc16>(object); |
845 } | 846 } |
846 } | 847 } |
847 } | 848 } |
848 | 849 |
849 } } // namespace v8::internal | 850 } } // namespace v8::internal |
850 | 851 |
851 #endif // V8_JSON_STRINGIFIER_H_ | 852 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |