| 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 1548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1559 FixedArray* new_properties; | 1559 FixedArray* new_properties; |
| 1560 MaybeObject* maybe_properties = properties()->CopySize(out_of_object); | 1560 MaybeObject* maybe_properties = properties()->CopySize(out_of_object); |
| 1561 if (!maybe_properties->To(&new_properties)) return maybe_properties; | 1561 if (!maybe_properties->To(&new_properties)) return maybe_properties; |
| 1562 set_properties(new_properties); | 1562 set_properties(new_properties); |
| 1563 } | 1563 } |
| 1564 set_map(map); | 1564 set_map(map); |
| 1565 return this; | 1565 return this; |
| 1566 } | 1566 } |
| 1567 | 1567 |
| 1568 | 1568 |
| 1569 MaybeObject* JSObject::MigrateInstance() { | |
| 1570 // Converting any field to the most specific type will cause the | |
| 1571 // GeneralizeFieldRepresentation algorithm to create the most general existing | |
| 1572 // transition that matches the object. This achieves what is needed. | |
| 1573 Map* original_map = map(); | |
| 1574 MaybeObject* maybe_result = GeneralizeFieldRepresentation( | |
| 1575 0, Representation::None(), ALLOW_AS_CONSTANT); | |
| 1576 JSObject* result; | |
| 1577 if (FLAG_trace_migration && maybe_result->To(&result)) { | |
| 1578 PrintInstanceMigration(stdout, original_map, result->map()); | |
| 1579 } | |
| 1580 return maybe_result; | |
| 1581 } | |
| 1582 | |
| 1583 | |
| 1584 MaybeObject* JSObject::TryMigrateInstance() { | 1569 MaybeObject* JSObject::TryMigrateInstance() { |
| 1585 Map* new_map = map()->CurrentMapForDeprecated(); | 1570 Map* new_map = map()->CurrentMapForDeprecated(); |
| 1586 if (new_map == NULL) return Smi::FromInt(0); | 1571 if (new_map == NULL) return Smi::FromInt(0); |
| 1587 Map* original_map = map(); | 1572 Map* original_map = map(); |
| 1588 MaybeObject* maybe_result = MigrateToMap(new_map); | 1573 MaybeObject* maybe_result = MigrateToMap(new_map); |
| 1589 JSObject* result; | 1574 JSObject* result; |
| 1590 if (FLAG_trace_migration && maybe_result->To(&result)) { | 1575 if (FLAG_trace_migration && maybe_result->To(&result)) { |
| 1591 PrintInstanceMigration(stdout, original_map, result->map()); | 1576 PrintInstanceMigration(stdout, original_map, result->map()); |
| 1592 } | 1577 } |
| 1593 return maybe_result; | 1578 return maybe_result; |
| (...skipping 4699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6293 #undef WRITE_UINT32_FIELD | 6278 #undef WRITE_UINT32_FIELD |
| 6294 #undef READ_SHORT_FIELD | 6279 #undef READ_SHORT_FIELD |
| 6295 #undef WRITE_SHORT_FIELD | 6280 #undef WRITE_SHORT_FIELD |
| 6296 #undef READ_BYTE_FIELD | 6281 #undef READ_BYTE_FIELD |
| 6297 #undef WRITE_BYTE_FIELD | 6282 #undef WRITE_BYTE_FIELD |
| 6298 | 6283 |
| 6299 | 6284 |
| 6300 } } // namespace v8::internal | 6285 } } // namespace v8::internal |
| 6301 | 6286 |
| 6302 #endif // V8_OBJECTS_INL_H_ | 6287 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |