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 1526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 if (target()->type() != Code::NORMAL) { | 1537 if (target()->type() != Code::NORMAL) { |
1538 TRACE_GENERIC_IC("KeyedIC", "non-NORMAL target type"); | 1538 TRACE_GENERIC_IC("KeyedIC", "non-NORMAL target type"); |
1539 return strict_mode == kStrictMode ? generic_stub_strict() : generic_stub(); | 1539 return strict_mode == kStrictMode ? generic_stub_strict() : generic_stub(); |
1540 } | 1540 } |
1541 | 1541 |
1542 Handle<Map> receiver_map(receiver->map()); | 1542 Handle<Map> receiver_map(receiver->map()); |
1543 MapHandleList target_receiver_maps; | 1543 MapHandleList target_receiver_maps; |
1544 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { | 1544 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { |
1545 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state | 1545 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state |
1546 // yet will do so and stay there. | 1546 // yet will do so and stay there. |
| 1547 Handle<Map> monomorphic_map = ComputeTransitionedMap(receiver, stub_kind); |
1547 stub_kind = GetNoTransitionStubKind(stub_kind); | 1548 stub_kind = GetNoTransitionStubKind(stub_kind); |
1548 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1549 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
1549 receiver_map, stub_kind, strict_mode, grow_mode); | 1550 monomorphic_map, stub_kind, strict_mode, grow_mode); |
1550 } | 1551 } |
1551 | 1552 |
1552 GetReceiverMapsForStub(Handle<Code>(target()), &target_receiver_maps); | 1553 GetReceiverMapsForStub(Handle<Code>(target()), &target_receiver_maps); |
1553 if (target_receiver_maps.length() == 0) { | 1554 if (target_receiver_maps.length() == 0) { |
1554 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state | 1555 // Optimistically assume that ICs that haven't reached the MONOMORPHIC state |
1555 // yet will do so and stay there. | 1556 // yet will do so and stay there. |
1556 stub_kind = GetNoTransitionStubKind(stub_kind); | 1557 stub_kind = GetNoTransitionStubKind(stub_kind); |
1557 return isolate()->stub_cache()->ComputeKeyedStoreElement( | 1558 return isolate()->stub_cache()->ComputeKeyedStoreElement( |
1558 receiver_map, stub_kind, strict_mode, grow_mode); | 1559 receiver_map, stub_kind, strict_mode, grow_mode); |
1559 } | 1560 } |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1626 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT: | 1627 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_OBJECT: |
1627 case STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: | 1628 case STORE_AND_GROW_TRANSITION_HOLEY_DOUBLE_TO_OBJECT: |
1628 return JSObject::GetElementsTransitionMap(receiver, | 1629 return JSObject::GetElementsTransitionMap(receiver, |
1629 FAST_HOLEY_ELEMENTS); | 1630 FAST_HOLEY_ELEMENTS); |
1630 case STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE: | 1631 case STORE_TRANSITION_HOLEY_SMI_TO_DOUBLE: |
1631 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE: | 1632 case STORE_AND_GROW_TRANSITION_HOLEY_SMI_TO_DOUBLE: |
1632 return JSObject::GetElementsTransitionMap(receiver, | 1633 return JSObject::GetElementsTransitionMap(receiver, |
1633 FAST_HOLEY_DOUBLE_ELEMENTS); | 1634 FAST_HOLEY_DOUBLE_ELEMENTS); |
1634 case STORE_NO_TRANSITION: | 1635 case STORE_NO_TRANSITION: |
1635 case STORE_AND_GROW_NO_TRANSITION: | 1636 case STORE_AND_GROW_NO_TRANSITION: |
1636 UNREACHABLE(); | 1637 return Handle<Map>(receiver->map()); |
1637 break; | |
1638 } | 1638 } |
1639 return Handle<Map>::null(); | 1639 return Handle<Map>::null(); |
1640 } | 1640 } |
1641 | 1641 |
1642 | 1642 |
1643 KeyedStoreIC::StubKind KeyedStoreIC::GetStubKind(Handle<JSObject> receiver, | 1643 KeyedStoreIC::StubKind KeyedStoreIC::GetStubKind(Handle<JSObject> receiver, |
1644 Handle<Object> key, | 1644 Handle<Object> key, |
1645 Handle<Object> value) { | 1645 Handle<Object> value) { |
1646 ASSERT(key->IsSmi()); | 1646 ASSERT(key->IsSmi()); |
1647 int index = Smi::cast(*key)->value(); | 1647 int index = Smi::cast(*key)->value(); |
(...skipping 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 #undef ADDR | 2552 #undef ADDR |
2553 }; | 2553 }; |
2554 | 2554 |
2555 | 2555 |
2556 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2556 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2557 return IC_utilities[id]; | 2557 return IC_utilities[id]; |
2558 } | 2558 } |
2559 | 2559 |
2560 | 2560 |
2561 } } // namespace v8::internal | 2561 } } // namespace v8::internal |
OLD | NEW |