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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 return SUCCESS; | 432 return SUCCESS; |
433 } | 433 } |
434 | 434 |
435 | 435 |
436 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArray( | 436 BasicJsonStringifier::Result BasicJsonStringifier::SerializeJSArray( |
437 Handle<JSArray> object) { | 437 Handle<JSArray> object) { |
438 HandleScope handle_scope(isolate_); | 438 HandleScope handle_scope(isolate_); |
439 Result stack_push = StackPush(object); | 439 Result stack_push = StackPush(object); |
440 if (stack_push != SUCCESS) return stack_push; | 440 if (stack_push != SUCCESS) return stack_push; |
441 uint32_t length = 0; | 441 uint32_t length = 0; |
442 CHECK(object->length()->ToArrayIndex(&length)); | 442 CHECK(object->length()->ToArrayLength(&length)); |
443 builder_.AppendCharacter('['); | 443 builder_.AppendCharacter('['); |
444 switch (object->GetElementsKind()) { | 444 switch (object->GetElementsKind()) { |
445 case FAST_SMI_ELEMENTS: { | 445 case FAST_SMI_ELEMENTS: { |
446 Handle<FixedArray> elements( | 446 Handle<FixedArray> elements( |
447 FixedArray::cast(object->elements()), isolate_); | 447 FixedArray::cast(object->elements()), isolate_); |
448 for (uint32_t i = 0; i < length; i++) { | 448 for (uint32_t i = 0; i < length; i++) { |
449 if (i > 0) builder_.AppendCharacter(','); | 449 if (i > 0) builder_.AppendCharacter(','); |
450 SerializeSmi(Smi::cast(elements->get(i))); | 450 SerializeSmi(Smi::cast(elements->get(i))); |
451 } | 451 } |
452 break; | 452 break; |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 SerializeString_<uint8_t, uc16>(object); | 681 SerializeString_<uint8_t, uc16>(object); |
682 } else { | 682 } else { |
683 SerializeString_<uc16, uc16>(object); | 683 SerializeString_<uc16, uc16>(object); |
684 } | 684 } |
685 } | 685 } |
686 } | 686 } |
687 | 687 |
688 } } // namespace v8::internal | 688 } } // namespace v8::internal |
689 | 689 |
690 #endif // V8_JSON_STRINGIFIER_H_ | 690 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |