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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 object->elements()->length() == 0) { | 532 object->elements()->length() == 0) { |
533 Handle<Map> map(object->map()); | 533 Handle<Map> map(object->map()); |
534 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 534 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
535 Handle<Name> name(map->instance_descriptors()->GetKey(i), isolate_); | 535 Handle<Name> name(map->instance_descriptors()->GetKey(i), isolate_); |
536 // TODO(rossberg): Should this throw? | 536 // TODO(rossberg): Should this throw? |
537 if (!name->IsString()) continue; | 537 if (!name->IsString()) continue; |
538 Handle<String> key = Handle<String>::cast(name); | 538 Handle<String> key = Handle<String>::cast(name); |
539 PropertyDetails details = map->instance_descriptors()->GetDetails(i); | 539 PropertyDetails details = map->instance_descriptors()->GetDetails(i); |
540 if (details.IsDontEnum()) continue; | 540 if (details.IsDontEnum()) continue; |
541 Handle<Object> property; | 541 Handle<Object> property; |
542 if (details.type() == FIELD && *map == object->map()) { | 542 if (details.type() == DATA_FIELD && *map == object->map()) { |
543 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); | 543 FieldIndex field_index = FieldIndex::ForDescriptor(*map, i); |
544 Isolate* isolate = object->GetIsolate(); | 544 Isolate* isolate = object->GetIsolate(); |
545 if (object->IsUnboxedDoubleField(field_index)) { | 545 if (object->IsUnboxedDoubleField(field_index)) { |
546 double value = object->RawFastDoublePropertyAt(field_index); | 546 double value = object->RawFastDoublePropertyAt(field_index); |
547 property = isolate->factory()->NewHeapNumber(value); | 547 property = isolate->factory()->NewHeapNumber(value); |
548 | 548 |
549 } else { | 549 } else { |
550 property = handle(object->RawFastPropertyAt(field_index), isolate); | 550 property = handle(object->RawFastPropertyAt(field_index), isolate); |
551 } | 551 } |
552 } else { | 552 } else { |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 SerializeString_<uint8_t, uc16>(object); | 677 SerializeString_<uint8_t, uc16>(object); |
678 } else { | 678 } else { |
679 SerializeString_<uc16, uc16>(object); | 679 SerializeString_<uc16, uc16>(object); |
680 } | 680 } |
681 } | 681 } |
682 } | 682 } |
683 | 683 |
684 } } // namespace v8::internal | 684 } } // namespace v8::internal |
685 | 685 |
686 #endif // V8_JSON_STRINGIFIER_H_ | 686 #endif // V8_JSON_STRINGIFIER_H_ |
OLD | NEW |