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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 | 1535 |
1536 | 1536 |
1537 MaybeObject* JSObject::MigrateInstance() { | 1537 MaybeObject* JSObject::MigrateInstance() { |
1538 // Converting any field to the most specific type will cause the | 1538 // Converting any field to the most specific type will cause the |
1539 // GeneralizeFieldRepresentation algorithm to create the most general existing | 1539 // GeneralizeFieldRepresentation algorithm to create the most general existing |
1540 // transition that matches the object. This achieves what is needed. | 1540 // transition that matches the object. This achieves what is needed. |
1541 return GeneralizeFieldRepresentation(0, Representation::Smi()); | 1541 return GeneralizeFieldRepresentation(0, Representation::Smi()); |
1542 } | 1542 } |
1543 | 1543 |
1544 | 1544 |
| 1545 MaybeObject* JSObject::TryMigrateInstance() { |
| 1546 Map* new_map = map()->CurrentMapForDeprecated(); |
| 1547 if (new_map == NULL) return Smi::FromInt(0); |
| 1548 return MigrateToMap(new_map); |
| 1549 } |
| 1550 |
| 1551 |
1545 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { | 1552 Handle<String> JSObject::ExpectedTransitionKey(Handle<Map> map) { |
1546 AssertNoAllocation no_gc; | 1553 AssertNoAllocation no_gc; |
1547 if (!map->HasTransitionArray()) return Handle<String>::null(); | 1554 if (!map->HasTransitionArray()) return Handle<String>::null(); |
1548 TransitionArray* transitions = map->transitions(); | 1555 TransitionArray* transitions = map->transitions(); |
1549 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); | 1556 if (!transitions->IsSimpleTransition()) return Handle<String>::null(); |
1550 int transition = TransitionArray::kSimpleTransitionIndex; | 1557 int transition = TransitionArray::kSimpleTransitionIndex; |
1551 PropertyDetails details = transitions->GetTargetDetails(transition); | 1558 PropertyDetails details = transitions->GetTargetDetails(transition); |
1552 Name* name = transitions->GetKey(transition); | 1559 Name* name = transitions->GetKey(transition); |
1553 if (details.type() != FIELD) return Handle<String>::null(); | 1560 if (details.type() != FIELD) return Handle<String>::null(); |
1554 if (details.attributes() != NONE) return Handle<String>::null(); | 1561 if (details.attributes() != NONE) return Handle<String>::null(); |
(...skipping 4657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6212 #undef WRITE_UINT32_FIELD | 6219 #undef WRITE_UINT32_FIELD |
6213 #undef READ_SHORT_FIELD | 6220 #undef READ_SHORT_FIELD |
6214 #undef WRITE_SHORT_FIELD | 6221 #undef WRITE_SHORT_FIELD |
6215 #undef READ_BYTE_FIELD | 6222 #undef READ_BYTE_FIELD |
6216 #undef WRITE_BYTE_FIELD | 6223 #undef WRITE_BYTE_FIELD |
6217 | 6224 |
6218 | 6225 |
6219 } } // namespace v8::internal | 6226 } } // namespace v8::internal |
6220 | 6227 |
6221 #endif // V8_OBJECTS_INL_H_ | 6228 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |