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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 | 1497 |
1498 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, | 1498 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, |
1499 StubKind stub_kind, | 1499 StubKind stub_kind, |
1500 StrictModeFlag strict_mode, | 1500 StrictModeFlag strict_mode, |
1501 Handle<Code> generic_stub) { | 1501 Handle<Code> generic_stub) { |
1502 State ic_state = target()->ic_state(); | 1502 State ic_state = target()->ic_state(); |
1503 KeyedAccessGrowMode grow_mode = IsGrowStubKind(stub_kind) | 1503 KeyedAccessGrowMode grow_mode = IsGrowStubKind(stub_kind) |
1504 ? ALLOW_JSARRAY_GROWTH | 1504 ? ALLOW_JSARRAY_GROWTH |
1505 : DO_NOT_ALLOW_JSARRAY_GROWTH; | 1505 : DO_NOT_ALLOW_JSARRAY_GROWTH; |
1506 | 1506 |
| 1507 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS |
| 1508 // via megamorphic stubs, since they don't have a map in their relocation info |
| 1509 // and so the stubs can't be harvested for the object needed for a map check. |
| 1510 if (target()->type() != NORMAL) { |
| 1511 TRACE_GENERIC_IC("KeyedIC", "non-NORMAL target type"); |
| 1512 return generic_stub; |
| 1513 } |
| 1514 |
1507 bool monomorphic = false; | 1515 bool monomorphic = false; |
1508 MapHandleList target_receiver_maps; | 1516 MapHandleList target_receiver_maps; |
1509 if (ic_state != UNINITIALIZED && ic_state != PREMONOMORPHIC) { | 1517 if (ic_state != UNINITIALIZED && ic_state != PREMONOMORPHIC) { |
1510 GetReceiverMapsForStub(Handle<Code>(target()), &target_receiver_maps); | 1518 GetReceiverMapsForStub(Handle<Code>(target()), &target_receiver_maps); |
1511 } | 1519 } |
1512 if (!IsTransitionStubKind(stub_kind)) { | 1520 if (!IsTransitionStubKind(stub_kind)) { |
1513 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { | 1521 if (ic_state == UNINITIALIZED || ic_state == PREMONOMORPHIC) { |
1514 monomorphic = true; | 1522 monomorphic = true; |
1515 } else { | 1523 } else { |
1516 if (ic_state == MONOMORPHIC) { | 1524 if (ic_state == MONOMORPHIC) { |
(...skipping 10 matching lines...) Expand all Loading... |
1527 } | 1535 } |
1528 } | 1536 } |
1529 } | 1537 } |
1530 | 1538 |
1531 if (monomorphic) { | 1539 if (monomorphic) { |
1532 return ComputeMonomorphicStub( | 1540 return ComputeMonomorphicStub( |
1533 receiver, stub_kind, strict_mode, generic_stub); | 1541 receiver, stub_kind, strict_mode, generic_stub); |
1534 } | 1542 } |
1535 ASSERT(target() != *generic_stub); | 1543 ASSERT(target() != *generic_stub); |
1536 | 1544 |
1537 // Don't handle megamorphic property accesses for INTERCEPTORS or CALLBACKS | |
1538 // via megamorphic stubs, since they don't have a map in their relocation info | |
1539 // and so the stubs can't be harvested for the object needed for a map check. | |
1540 if (target()->type() != NORMAL) { | |
1541 TRACE_GENERIC_IC("KeyedIC", "non-NORMAL target type"); | |
1542 return generic_stub; | |
1543 } | |
1544 | |
1545 // Determine the list of receiver maps that this call site has seen, | 1545 // Determine the list of receiver maps that this call site has seen, |
1546 // adding the map that was just encountered. | 1546 // adding the map that was just encountered. |
1547 Handle<Map> receiver_map(receiver->map()); | 1547 Handle<Map> receiver_map(receiver->map()); |
1548 bool map_added = | 1548 bool map_added = |
1549 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); | 1549 AddOneReceiverMapIfMissing(&target_receiver_maps, receiver_map); |
1550 if (IsTransitionStubKind(stub_kind)) { | 1550 if (IsTransitionStubKind(stub_kind)) { |
1551 Handle<Map> new_map = ComputeTransitionedMap(receiver, stub_kind); | 1551 Handle<Map> new_map = ComputeTransitionedMap(receiver, stub_kind); |
1552 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map); | 1552 map_added |= AddOneReceiverMapIfMissing(&target_receiver_maps, new_map); |
1553 } | 1553 } |
1554 if (!map_added) { | 1554 if (!map_added) { |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 #undef ADDR | 2526 #undef ADDR |
2527 }; | 2527 }; |
2528 | 2528 |
2529 | 2529 |
2530 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2530 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2531 return IC_utilities[id]; | 2531 return IC_utilities[id]; |
2532 } | 2532 } |
2533 | 2533 |
2534 | 2534 |
2535 } } // namespace v8::internal | 2535 } } // namespace v8::internal |
OLD | NEW |