| 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 case FAST_SMI_ELEMENTS: { | 553 case FAST_SMI_ELEMENTS: { |
| 554 Handle<FixedArray> elements( | 554 Handle<FixedArray> elements( |
| 555 FixedArray::cast(object->elements()), isolate_); | 555 FixedArray::cast(object->elements()), isolate_); |
| 556 for (uint32_t i = 0; i < length; i++) { | 556 for (uint32_t i = 0; i < length; i++) { |
| 557 if (i > 0) Append(','); | 557 if (i > 0) Append(','); |
| 558 SerializeSmi(Smi::cast(elements->get(i))); | 558 SerializeSmi(Smi::cast(elements->get(i))); |
| 559 } | 559 } |
| 560 break; | 560 break; |
| 561 } | 561 } |
| 562 case FAST_DOUBLE_ELEMENTS: { | 562 case FAST_DOUBLE_ELEMENTS: { |
| 563 // Empty array is FixedArray but not FixedDoubleArray. |
| 564 if (length == 0) break; |
| 563 Handle<FixedDoubleArray> elements( | 565 Handle<FixedDoubleArray> elements( |
| 564 FixedDoubleArray::cast(object->elements()), isolate_); | 566 FixedDoubleArray::cast(object->elements()), isolate_); |
| 565 for (uint32_t i = 0; i < length; i++) { | 567 for (uint32_t i = 0; i < length; i++) { |
| 566 if (i > 0) Append(','); | 568 if (i > 0) Append(','); |
| 567 SerializeDouble(elements->get_scalar(i)); | 569 SerializeDouble(elements->get_scalar(i)); |
| 568 } | 570 } |
| 569 break; | 571 break; |
| 570 } | 572 } |
| 571 case FAST_ELEMENTS: { | 573 case FAST_ELEMENTS: { |
| 572 Handle<FixedArray> elements( | 574 Handle<FixedArray> elements( |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 SerializeString_<false, uint8_t>(object); | 877 SerializeString_<false, uint8_t>(object); |
| 876 } else { | 878 } else { |
| 877 SerializeString_<false, uc16>(object); | 879 SerializeString_<false, uc16>(object); |
| 878 } | 880 } |
| 879 } | 881 } |
| 880 } | 882 } |
| 881 | 883 |
| 882 } } // namespace v8::internal | 884 } } // namespace v8::internal |
| 883 | 885 |
| 884 #endif // V8_JSON_STRINGIFIER_H_ | 886 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |