Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 406 if (value.is_null()) return ReportUnexpectedCharacter(); | 406 if (value.is_null()) return ReportUnexpectedCharacter(); |
| 407 | 407 |
| 408 if (transitioning) { | 408 if (transitioning) { |
| 409 int descriptor = map->NumberOfOwnDescriptors(); | 409 int descriptor = map->NumberOfOwnDescriptors(); |
| 410 PropertyDetails details = | 410 PropertyDetails details = |
| 411 target->instance_descriptors()->GetDetails(descriptor); | 411 target->instance_descriptors()->GetDetails(descriptor); |
| 412 Representation expected_representation = details.representation(); | 412 Representation expected_representation = details.representation(); |
| 413 | 413 |
| 414 if (value->FitsRepresentation(expected_representation)) { | 414 if (value->FitsRepresentation(expected_representation)) { |
| 415 // If the target representation is double and the value is already | 415 // If the target representation is double and the value is already |
| 416 // double, use the existing box. | 416 // double, use the existing box. |
|
Igor Sheludko
2014/03/31 11:19:05
Please update comment to match the code.
| |
| 417 if (value->IsSmi() && expected_representation.IsDouble()) { | 417 if (expected_representation.IsDouble()) { |
| 418 value = factory()->NewHeapNumber( | 418 value = factory()->NewHeapNumber(value->Number(), MUTABLE); |
| 419 Handle<Smi>::cast(value)->value()); | |
| 420 } | 419 } |
| 421 properties.Add(value, zone()); | 420 properties.Add(value, zone()); |
| 422 map = target; | 421 map = target; |
| 423 continue; | 422 continue; |
| 424 } else { | 423 } else { |
| 425 transitioning = false; | 424 transitioning = false; |
| 426 } | 425 } |
| 427 } | 426 } |
| 428 | 427 |
| 429 // Commit the intermediate state to the object and stop transitioning. | 428 // Commit the intermediate state to the object and stop transitioning. |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 800 | 799 |
| 801 ASSERT_EQ('"', c0_); | 800 ASSERT_EQ('"', c0_); |
| 802 // Advance past the last '"'. | 801 // Advance past the last '"'. |
| 803 AdvanceSkipWhitespace(); | 802 AdvanceSkipWhitespace(); |
| 804 return result; | 803 return result; |
| 805 } | 804 } |
| 806 | 805 |
| 807 } } // namespace v8::internal | 806 } } // namespace v8::internal |
| 808 | 807 |
| 809 #endif // V8_JSON_PARSER_H_ | 808 #endif // V8_JSON_PARSER_H_ |
| OLD | NEW |