| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 case UNINITIALIZED: return '0'; | 45 case UNINITIALIZED: return '0'; |
| 46 case PREMONOMORPHIC: return '.'; | 46 case PREMONOMORPHIC: return '.'; |
| 47 case MONOMORPHIC: return '1'; | 47 case MONOMORPHIC: return '1'; |
| 48 case MONOMORPHIC_PROTOTYPE_FAILURE: return '^'; | 48 case MONOMORPHIC_PROTOTYPE_FAILURE: return '^'; |
| 49 case POLYMORPHIC: return 'P'; | 49 case POLYMORPHIC: return 'P'; |
| 50 case MEGAMORPHIC: return IsGeneric() ? 'G' : 'N'; | 50 case MEGAMORPHIC: return IsGeneric() ? 'G' : 'N'; |
| 51 | 51 |
| 52 // We never see the debugger states here, because the state is | 52 // We never see the debugger states here, because the state is |
| 53 // computed from the original code - not the patched code. Let | 53 // computed from the original code - not the patched code. Let |
| 54 // these cases fall through to the unreachable code below. | 54 // these cases fall through to the unreachable code below. |
| 55 case DEBUG_BREAK: break; | 55 case DEBUG_STUB: break; |
| 56 case DEBUG_PREPARE_STEP_IN: break; | |
| 57 } | 56 } |
| 58 UNREACHABLE(); | 57 UNREACHABLE(); |
| 59 return 0; | 58 return 0; |
| 60 } | 59 } |
| 61 | 60 |
| 62 void IC::TraceIC(const char* type, | 61 void IC::TraceIC(const char* type, |
| 63 Handle<Object> name, | 62 Handle<Object> name, |
| 64 State old_state, | 63 State old_state, |
| 65 Code* new_target) { | 64 Code* new_target) { |
| 66 if (FLAG_trace_ic) { | 65 if (FLAG_trace_ic) { |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 // TODO(2029): When an optimized function is patched, it would | 339 // TODO(2029): When an optimized function is patched, it would |
| 341 // be nice to propagate the corresponding type information to its | 340 // be nice to propagate the corresponding type information to its |
| 342 // unoptimized version for the benefit of later inlining. | 341 // unoptimized version for the benefit of later inlining. |
| 343 } | 342 } |
| 344 | 343 |
| 345 | 344 |
| 346 void IC::Clear(Address address) { | 345 void IC::Clear(Address address) { |
| 347 Code* target = GetTargetAtAddress(address); | 346 Code* target = GetTargetAtAddress(address); |
| 348 | 347 |
| 349 // Don't clear debug break inline cache as it will remove the break point. | 348 // Don't clear debug break inline cache as it will remove the break point. |
| 350 if (target->ic_state() == DEBUG_BREAK) return; | 349 if (target->ic_state() == DEBUG_STUB && |
| 350 target->extra_ic_state() == DEBUG_BREAK) { |
| 351 return; |
| 352 } |
| 351 | 353 |
| 352 switch (target->kind()) { | 354 switch (target->kind()) { |
| 353 case Code::LOAD_IC: return LoadIC::Clear(address, target); | 355 case Code::LOAD_IC: return LoadIC::Clear(address, target); |
| 354 case Code::KEYED_LOAD_IC: | 356 case Code::KEYED_LOAD_IC: |
| 355 return KeyedLoadIC::Clear(address, target); | 357 return KeyedLoadIC::Clear(address, target); |
| 356 case Code::STORE_IC: return StoreIC::Clear(address, target); | 358 case Code::STORE_IC: return StoreIC::Clear(address, target); |
| 357 case Code::KEYED_STORE_IC: | 359 case Code::KEYED_STORE_IC: |
| 358 return KeyedStoreIC::Clear(address, target); | 360 return KeyedStoreIC::Clear(address, target); |
| 359 case Code::CALL_IC: return CallIC::Clear(address, target); | 361 case Code::CALL_IC: return CallIC::Clear(address, target); |
| 360 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); | 362 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 763 case MEGAMORPHIC: { | 765 case MEGAMORPHIC: { |
| 764 // Cache code holding map should be consistent with | 766 // Cache code holding map should be consistent with |
| 765 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. | 767 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. |
| 766 Handle<JSObject> cache_object = object->IsJSObject() | 768 Handle<JSObject> cache_object = object->IsJSObject() |
| 767 ? Handle<JSObject>::cast(object) | 769 ? Handle<JSObject>::cast(object) |
| 768 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); | 770 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); |
| 769 // Update the stub cache. | 771 // Update the stub cache. |
| 770 isolate()->stub_cache()->Set(*name, cache_object->map(), *code); | 772 isolate()->stub_cache()->Set(*name, cache_object->map(), *code); |
| 771 break; | 773 break; |
| 772 } | 774 } |
| 773 case DEBUG_BREAK: | 775 case DEBUG_STUB: |
| 774 case DEBUG_PREPARE_STEP_IN: | |
| 775 break; | 776 break; |
| 776 case POLYMORPHIC: | 777 case POLYMORPHIC: |
| 777 UNREACHABLE(); | 778 UNREACHABLE(); |
| 778 break; | 779 break; |
| 779 } | 780 } |
| 780 | 781 |
| 781 TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC", | 782 TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC", |
| 782 name, state, target()); | 783 name, state, target()); |
| 783 } | 784 } |
| 784 | 785 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1059 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1060 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
| 1060 | 1061 |
| 1061 set_target(*megamorphic_stub()); | 1062 set_target(*megamorphic_stub()); |
| 1062 } | 1063 } |
| 1063 break; | 1064 break; |
| 1064 case MEGAMORPHIC: | 1065 case MEGAMORPHIC: |
| 1065 // Cache code holding map should be consistent with | 1066 // Cache code holding map should be consistent with |
| 1066 // GenerateMonomorphicCacheProbe. | 1067 // GenerateMonomorphicCacheProbe. |
| 1067 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1068 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
| 1068 break; | 1069 break; |
| 1069 case DEBUG_BREAK: | 1070 case DEBUG_STUB: |
| 1070 case DEBUG_PREPARE_STEP_IN: | |
| 1071 break; | 1071 break; |
| 1072 case POLYMORPHIC: | 1072 case POLYMORPHIC: |
| 1073 UNREACHABLE(); | 1073 UNREACHABLE(); |
| 1074 break; | 1074 break; |
| 1075 } | 1075 } |
| 1076 | 1076 |
| 1077 TRACE_IC("LoadIC", name, state, target()); | 1077 TRACE_IC("LoadIC", name, state, target()); |
| 1078 } | 1078 } |
| 1079 | 1079 |
| 1080 | 1080 |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 case POLYMORPHIC: | 1332 case POLYMORPHIC: |
| 1333 set_target(*code); | 1333 set_target(*code); |
| 1334 break; | 1334 break; |
| 1335 case MONOMORPHIC: | 1335 case MONOMORPHIC: |
| 1336 // Only move to megamorphic if the target changes. | 1336 // Only move to megamorphic if the target changes. |
| 1337 if (target() != *code) { | 1337 if (target() != *code) { |
| 1338 set_target(*megamorphic_stub()); | 1338 set_target(*megamorphic_stub()); |
| 1339 } | 1339 } |
| 1340 break; | 1340 break; |
| 1341 case MEGAMORPHIC: | 1341 case MEGAMORPHIC: |
| 1342 case DEBUG_BREAK: | 1342 case DEBUG_STUB: |
| 1343 case DEBUG_PREPARE_STEP_IN: | |
| 1344 break; | 1343 break; |
| 1345 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1344 case MONOMORPHIC_PROTOTYPE_FAILURE: |
| 1346 UNREACHABLE(); | 1345 UNREACHABLE(); |
| 1347 break; | 1346 break; |
| 1348 } | 1347 } |
| 1349 | 1348 |
| 1350 TRACE_IC("KeyedLoadIC", name, state, target()); | 1349 TRACE_IC("KeyedLoadIC", name, state, target()); |
| 1351 } | 1350 } |
| 1352 | 1351 |
| 1353 | 1352 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1607 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
| 1609 set_target((strict_mode == kStrictMode) | 1608 set_target((strict_mode == kStrictMode) |
| 1610 ? megamorphic_stub_strict() | 1609 ? megamorphic_stub_strict() |
| 1611 : megamorphic_stub()); | 1610 : megamorphic_stub()); |
| 1612 } | 1611 } |
| 1613 break; | 1612 break; |
| 1614 case MEGAMORPHIC: | 1613 case MEGAMORPHIC: |
| 1615 // Update the stub cache. | 1614 // Update the stub cache. |
| 1616 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1615 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
| 1617 break; | 1616 break; |
| 1618 case DEBUG_BREAK: | 1617 case DEBUG_STUB: |
| 1619 case DEBUG_PREPARE_STEP_IN: | |
| 1620 break; | 1618 break; |
| 1621 case POLYMORPHIC: | 1619 case POLYMORPHIC: |
| 1622 UNREACHABLE(); | 1620 UNREACHABLE(); |
| 1623 break; | 1621 break; |
| 1624 } | 1622 } |
| 1625 | 1623 |
| 1626 TRACE_IC("StoreIC", name, state, target()); | 1624 TRACE_IC("StoreIC", name, state, target()); |
| 1627 } | 1625 } |
| 1628 | 1626 |
| 1629 | 1627 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1660 ASSERT(object->IsMap()); | 1658 ASSERT(object->IsMap()); |
| 1661 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); | 1659 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); |
| 1662 } | 1660 } |
| 1663 break; | 1661 break; |
| 1664 } | 1662 } |
| 1665 case MEGAMORPHIC: | 1663 case MEGAMORPHIC: |
| 1666 break; | 1664 break; |
| 1667 case UNINITIALIZED: | 1665 case UNINITIALIZED: |
| 1668 case PREMONOMORPHIC: | 1666 case PREMONOMORPHIC: |
| 1669 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1667 case MONOMORPHIC_PROTOTYPE_FAILURE: |
| 1670 case DEBUG_BREAK: | 1668 case DEBUG_STUB: |
| 1671 case DEBUG_PREPARE_STEP_IN: | |
| 1672 UNREACHABLE(); | 1669 UNREACHABLE(); |
| 1673 break; | 1670 break; |
| 1674 } | 1671 } |
| 1675 } | 1672 } |
| 1676 } | 1673 } |
| 1677 | 1674 |
| 1678 | 1675 |
| 1679 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, | 1676 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, |
| 1680 StubKind stub_kind, | 1677 StubKind stub_kind, |
| 1681 StrictModeFlag strict_mode, | 1678 StrictModeFlag strict_mode, |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 break; | 2104 break; |
| 2108 case MONOMORPHIC: | 2105 case MONOMORPHIC: |
| 2109 // Only move to megamorphic if the target changes. | 2106 // Only move to megamorphic if the target changes. |
| 2110 if (target() != *code) { | 2107 if (target() != *code) { |
| 2111 set_target((strict_mode == kStrictMode) | 2108 set_target((strict_mode == kStrictMode) |
| 2112 ? *megamorphic_stub_strict() | 2109 ? *megamorphic_stub_strict() |
| 2113 : *megamorphic_stub()); | 2110 : *megamorphic_stub()); |
| 2114 } | 2111 } |
| 2115 break; | 2112 break; |
| 2116 case MEGAMORPHIC: | 2113 case MEGAMORPHIC: |
| 2117 case DEBUG_BREAK: | 2114 case DEBUG_STUB: |
| 2118 case DEBUG_PREPARE_STEP_IN: | |
| 2119 break; | 2115 break; |
| 2120 case MONOMORPHIC_PROTOTYPE_FAILURE: | 2116 case MONOMORPHIC_PROTOTYPE_FAILURE: |
| 2121 UNREACHABLE(); | 2117 UNREACHABLE(); |
| 2122 break; | 2118 break; |
| 2123 } | 2119 } |
| 2124 | 2120 |
| 2125 TRACE_IC("KeyedStoreIC", name, state, target()); | 2121 TRACE_IC("KeyedStoreIC", name, state, target()); |
| 2126 } | 2122 } |
| 2127 | 2123 |
| 2128 | 2124 |
| (...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2864 #undef ADDR | 2860 #undef ADDR |
| 2865 }; | 2861 }; |
| 2866 | 2862 |
| 2867 | 2863 |
| 2868 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2864 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
| 2869 return IC_utilities[id]; | 2865 return IC_utilities[id]; |
| 2870 } | 2866 } |
| 2871 | 2867 |
| 2872 | 2868 |
| 2873 } } // namespace v8::internal | 2869 } } // namespace v8::internal |
| OLD | NEW |