| 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 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1560 } | 1560 } |
| 1561 set_map(map); | 1561 set_map(map); |
| 1562 return this; | 1562 return this; |
| 1563 } | 1563 } |
| 1564 | 1564 |
| 1565 | 1565 |
| 1566 MaybeObject* JSObject::MigrateInstance() { | 1566 MaybeObject* JSObject::MigrateInstance() { |
| 1567 // Converting any field to the most specific type will cause the | 1567 // Converting any field to the most specific type will cause the |
| 1568 // GeneralizeFieldRepresentation algorithm to create the most general existing | 1568 // GeneralizeFieldRepresentation algorithm to create the most general existing |
| 1569 // transition that matches the object. This achieves what is needed. | 1569 // transition that matches the object. This achieves what is needed. |
| 1570 return GeneralizeFieldRepresentation(0, Representation::None()); | 1570 Map* original_map = map(); |
| 1571 MaybeObject* maybe_result = GeneralizeFieldRepresentation( |
| 1572 0, Representation::None()); |
| 1573 JSObject* result; |
| 1574 if (FLAG_trace_migration && maybe_result->To(&result)) { |
| 1575 PrintInstanceMigration(stdout, original_map, result->map()); |
| 1576 } |
| 1577 return maybe_result; |
| 1571 } | 1578 } |
| 1572 | 1579 |
| 1573 | 1580 |
| 1574 MaybeObject* JSObject::TryMigrateInstance() { | 1581 MaybeObject* JSObject::TryMigrateInstance() { |
| 1575 Map* new_map = map()->CurrentMapForDeprecated(); | 1582 Map* new_map = map()->CurrentMapForDeprecated(); |
| 1576 if (new_map == NULL) return Smi::FromInt(0); | 1583 if (new_map == NULL) return Smi::FromInt(0); |
| 1577 return MigrateToMap(new_map); | 1584 Map* original_map = map(); |
| 1585 MaybeObject* maybe_result = MigrateToMap(new_map); |
| 1586 JSObject* result; |
| 1587 if (FLAG_trace_migration && maybe_result->To(&result)) { |
| 1588 PrintInstanceMigration(stdout, original_map, result->map()); |
| 1589 } |
| 1590 return maybe_result; |
| 1578 } | 1591 } |
| 1579 | 1592 |
| 1580 | 1593 |
| 1581 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1594 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
| 1582 DisallowHeapAllocation no_gc; | 1595 DisallowHeapAllocation no_gc; |
| 1583 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1596 if (!map->HasTransitionArray()) return Handle<String>::null(); |
| 1584 TransitionArray* transitions = map->transitions(); | 1597 TransitionArray* transitions = map->transitions(); |
| 1585 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1598 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
| 1586 int transition = TransitionArray::kSimpleTransitionIndex; | 1599 int transition = TransitionArray::kSimpleTransitionIndex; |
| 1587 PropertyDetails details = transitions->GetTargetDetails(transition); | 1600 PropertyDetails details = transitions->GetTargetDetails(transition); |
| (...skipping 4656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6244 #undef WRITE_UINT32_FIELD | 6257 #undef WRITE_UINT32_FIELD |
| 6245 #undef READ_SHORT_FIELD | 6258 #undef READ_SHORT_FIELD |
| 6246 #undef WRITE_SHORT_FIELD | 6259 #undef WRITE_SHORT_FIELD |
| 6247 #undef READ_BYTE_FIELD | 6260 #undef READ_BYTE_FIELD |
| 6248 #undef WRITE_BYTE_FIELD | 6261 #undef WRITE_BYTE_FIELD |
| 6249 | 6262 |
| 6250 | 6263 |
| 6251 } } // namespace v8::internal | 6264 } } // namespace v8::internal |
| 6252 | 6265 |
| 6253 #endif // V8_OBJECTS_INL_H_ | 6266 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |