| Index: src/json-parser.h
|
| diff --git a/src/json-parser.h b/src/json-parser.h
|
| index 74850cae253aab2cabcdc5a7138052e2cf0c84c5..78c1a7a4e0ddb5e90e756bf80b7d8eefff880253 100644
|
| --- a/src/json-parser.h
|
| +++ b/src/json-parser.h
|
| @@ -404,7 +404,13 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
| JSObject::TransitionToMap(json_object, map);
|
| int length = properties.length();
|
| for (int i = 0; i < length; i++) {
|
| - json_object->FastPropertyAtPut(i, *properties[i]);
|
| + Handle<Object> value = properties[i];
|
| + Representation representation =
|
| + map->instance_descriptors()->GetDetails(i).representation();
|
| + if (representation.IsDouble() && value->IsSmi()) {
|
| + // TODO(verwaest): Allocate heap number.
|
| + }
|
| + json_object->FastPropertyAtPut(i, *value);
|
| }
|
| transitioning = false;
|
| }
|
| @@ -416,7 +422,16 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
| if (value.is_null()) return ReportUnexpectedCharacter();
|
|
|
| properties.Add(value, zone());
|
| - if (transitioning) continue;
|
| + if (transitioning) {
|
| + int field = properties.length() - 1;
|
| + Representation expected_representation =
|
| + map->instance_descriptors()->GetDetails(field).representation();
|
| + if (!value->FitsRepresentation(expected_representation)) {
|
| + map = Map::GeneralizeRepresentation(
|
| + map, field, value->OptimalRepresentation());
|
| + }
|
| + continue;
|
| + }
|
| } else {
|
| key = ParseJsonInternalizedString();
|
| if (key.is_null() || c0_ != ':') return ReportUnexpectedCharacter();
|
| @@ -438,7 +453,13 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
| JSObject::TransitionToMap(json_object, map);
|
| int length = properties.length();
|
| for (int i = 0; i < length; i++) {
|
| - json_object->FastPropertyAtPut(i, *properties[i]);
|
| + Handle<Object> value = properties[i];
|
| + Representation representation =
|
| + map->instance_descriptors()->GetDetails(i).representation();
|
| + if (representation.IsDouble() && value->IsSmi()) {
|
| + // TODO(verwaest): Allocate heap number.
|
| + }
|
| + json_object->FastPropertyAtPut(i, *value);
|
| }
|
| }
|
| }
|
|
|