| 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 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 holder = Handle<JSObject>(lookup->holder(), lookup->isolate()); | 1463 holder = Handle<JSObject>(lookup->holder(), lookup->isolate()); |
| 1464 } | 1464 } |
| 1465 | 1465 |
| 1466 // While normally LookupTransition gets passed the receiver, in this case we | 1466 // While normally LookupTransition gets passed the receiver, in this case we |
| 1467 // pass the holder of the property that we overwrite. This keeps the holder in | 1467 // pass the holder of the property that we overwrite. This keeps the holder in |
| 1468 // the LookupResult intact so we can later use it to generate a prototype | 1468 // the LookupResult intact so we can later use it to generate a prototype |
| 1469 // chain check. This avoids a double lookup, but requires us to pass in the | 1469 // chain check. This avoids a double lookup, but requires us to pass in the |
| 1470 // receiver when trying to fetch extra information from the transition. | 1470 // receiver when trying to fetch extra information from the transition. |
| 1471 receiver->map()->LookupTransition(*holder, *name, lookup); | 1471 receiver->map()->LookupTransition(*holder, *name, lookup); |
| 1472 if (!lookup->IsTransition()) return false; | 1472 if (!lookup->IsTransition()) return false; |
| 1473 PropertyDetails target_details = | 1473 PropertyDetails target_details = lookup->GetTransitionDetails(); |
| 1474 lookup->GetTransitionDetails(receiver->map()); | |
| 1475 if (target_details.IsReadOnly()) return false; | 1474 if (target_details.IsReadOnly()) return false; |
| 1476 | 1475 |
| 1477 // If the value that's being stored does not fit in the field that the | 1476 // If the value that's being stored does not fit in the field that the |
| 1478 // instance would transition to, create a new transition that fits the value. | 1477 // instance would transition to, create a new transition that fits the value. |
| 1479 // This has to be done before generating the IC, since that IC will embed the | 1478 // This has to be done before generating the IC, since that IC will embed the |
| 1480 // transition target. | 1479 // transition target. |
| 1481 // Ensure the instance and its map were migrated before trying to update the | 1480 // Ensure the instance and its map were migrated before trying to update the |
| 1482 // transition target. | 1481 // transition target. |
| 1483 ASSERT(!receiver->map()->is_deprecated()); | 1482 ASSERT(!receiver->map()->is_deprecated()); |
| 1484 if (!value->FitsRepresentation(target_details.representation())) { | 1483 if (!value->FitsRepresentation(target_details.representation())) { |
| 1485 Handle<Map> target(lookup->GetTransitionMapFromMap(receiver->map())); | 1484 Handle<Map> target(lookup->GetTransitionTarget()); |
| 1486 Map::GeneralizeRepresentation( | 1485 Map::GeneralizeRepresentation( |
| 1487 target, target->LastAdded(), | 1486 target, target->LastAdded(), |
| 1488 value->OptimalRepresentation(), FORCE_FIELD); | 1487 value->OptimalRepresentation(), FORCE_FIELD); |
| 1489 // Lookup the transition again since the transition tree may have changed | 1488 // Lookup the transition again since the transition tree may have changed |
| 1490 // entirely by the migration above. | 1489 // entirely by the migration above. |
| 1491 receiver->map()->LookupTransition(*holder, *name, lookup); | 1490 receiver->map()->LookupTransition(*holder, *name, lookup); |
| 1492 if (!lookup->IsTransition()) return false; | 1491 if (!lookup->IsTransition()) return false; |
| 1493 ic->MarkMonomorphicPrototypeFailure(); | 1492 ic->MarkMonomorphicPrototypeFailure(); |
| 1494 } | 1493 } |
| 1495 return true; | 1494 return true; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 | 1621 |
| 1623 Handle<JSObject> holder(lookup->holder()); | 1622 Handle<JSObject> holder(lookup->holder()); |
| 1624 // Handlers do not use strict mode. | 1623 // Handlers do not use strict mode. |
| 1625 StoreStubCompiler compiler(isolate(), kNonStrictMode, kind()); | 1624 StoreStubCompiler compiler(isolate(), kNonStrictMode, kind()); |
| 1626 switch (lookup->type()) { | 1625 switch (lookup->type()) { |
| 1627 case FIELD: | 1626 case FIELD: |
| 1628 return compiler.CompileStoreField(receiver, lookup, name); | 1627 return compiler.CompileStoreField(receiver, lookup, name); |
| 1629 case TRANSITION: { | 1628 case TRANSITION: { |
| 1630 // Explicitly pass in the receiver map since LookupForWrite may have | 1629 // Explicitly pass in the receiver map since LookupForWrite may have |
| 1631 // stored something else than the receiver in the holder. | 1630 // stored something else than the receiver in the holder. |
| 1632 Handle<Map> transition( | 1631 Handle<Map> transition(lookup->GetTransitionTarget()); |
| 1633 lookup->GetTransitionTarget(receiver->map()), isolate()); | 1632 PropertyDetails details = transition->GetLastDescriptorDetails(); |
| 1634 int descriptor = transition->LastAdded(); | |
| 1635 | |
| 1636 DescriptorArray* target_descriptors = transition->instance_descriptors(); | |
| 1637 PropertyDetails details = target_descriptors->GetDetails(descriptor); | |
| 1638 | 1633 |
| 1639 if (details.type() == CALLBACKS || details.attributes() != NONE) break; | 1634 if (details.type() == CALLBACKS || details.attributes() != NONE) break; |
| 1640 | 1635 |
| 1641 return compiler.CompileStoreTransition( | 1636 return compiler.CompileStoreTransition( |
| 1642 receiver, lookup, transition, name); | 1637 receiver, lookup, transition, name); |
| 1643 } | 1638 } |
| 1644 case NORMAL: | 1639 case NORMAL: |
| 1645 if (kind() == Code::KEYED_STORE_IC) break; | 1640 if (kind() == Code::KEYED_STORE_IC) break; |
| 1646 if (receiver->IsGlobalObject()) { | 1641 if (receiver->IsGlobalObject()) { |
| 1647 // The stub generated for the global object picks the value directly | 1642 // The stub generated for the global object picks the value directly |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3143 #undef ADDR | 3138 #undef ADDR |
| 3144 }; | 3139 }; |
| 3145 | 3140 |
| 3146 | 3141 |
| 3147 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 3142 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 3148 return IC_utilities[id]; | 3143 return IC_utilities[id]; |
| 3149 } | 3144 } |
| 3150 | 3145 |
| 3151 | 3146 |
| 3152 } } // namespace v8::internal | 3147 } } // namespace v8::internal |
| OLD | NEW |