| 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 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 | 533 |
| 534 Append('{'); | 534 Append('{'); |
| 535 bool comma = false; | 535 bool comma = false; |
| 536 | 536 |
| 537 if (object->HasFastProperties() && | 537 if (object->HasFastProperties() && |
| 538 !object->HasIndexedInterceptor() && | 538 !object->HasIndexedInterceptor() && |
| 539 !object->HasNamedInterceptor() && | 539 !object->HasNamedInterceptor() && |
| 540 object->elements()->length() == 0) { | 540 object->elements()->length() == 0) { |
| 541 Handle<Map> map(object->map()); | 541 Handle<Map> map(object->map()); |
| 542 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 542 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
| 543 Handle<String> key(map->instance_descriptors()->GetKey(i), isolate_); | 543 Handle<Name> name(map->instance_descriptors()->GetKey(i), isolate_); |
| 544 // TODO(rossberg): Should this throw? |
| 545 if (!name->IsString()) continue; |
| 546 Handle<String> key = Handle<String>::cast(name); |
| 544 PropertyDetails details = map->instance_descriptors()->GetDetails(i); | 547 PropertyDetails details = map->instance_descriptors()->GetDetails(i); |
| 545 if (details.IsDontEnum() || details.IsDeleted()) continue; | 548 if (details.IsDontEnum() || details.IsDeleted()) continue; |
| 546 Handle<Object> property; | 549 Handle<Object> property; |
| 547 if (details.type() == FIELD && *map == object->map()) { | 550 if (details.type() == FIELD && *map == object->map()) { |
| 548 property = Handle<Object>( | 551 property = Handle<Object>( |
| 549 object->FastPropertyAt( | 552 object->FastPropertyAt( |
| 550 map->instance_descriptors()->GetFieldIndex(i)), | 553 map->instance_descriptors()->GetFieldIndex(i)), |
| 551 isolate_); | 554 isolate_); |
| 552 } else { | 555 } else { |
| 553 property = GetProperty(object, key); | 556 property = GetProperty(object, key); |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 SerializeString_<false, uint8_t>(object); | 739 SerializeString_<false, uint8_t>(object); |
| 737 } else { | 740 } else { |
| 738 SerializeString_<false, uc16>(object); | 741 SerializeString_<false, uc16>(object); |
| 739 } | 742 } |
| 740 } | 743 } |
| 741 } | 744 } |
| 742 | 745 |
| 743 } } // namespace v8::internal | 746 } } // namespace v8::internal |
| 744 | 747 |
| 745 #endif // V8_JSON_STRINGIFIER_H_ | 748 #endif // V8_JSON_STRINGIFIER_H_ |
| OLD | NEW |