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->is_debug_break()) return; |
351 | 350 |
352 switch (target->kind()) { | 351 switch (target->kind()) { |
353 case Code::LOAD_IC: return LoadIC::Clear(address, target); | 352 case Code::LOAD_IC: return LoadIC::Clear(address, target); |
354 case Code::KEYED_LOAD_IC: | 353 case Code::KEYED_LOAD_IC: |
355 return KeyedLoadIC::Clear(address, target); | 354 return KeyedLoadIC::Clear(address, target); |
356 case Code::STORE_IC: return StoreIC::Clear(address, target); | 355 case Code::STORE_IC: return StoreIC::Clear(address, target); |
357 case Code::KEYED_STORE_IC: | 356 case Code::KEYED_STORE_IC: |
358 return KeyedStoreIC::Clear(address, target); | 357 return KeyedStoreIC::Clear(address, target); |
359 case Code::CALL_IC: return CallIC::Clear(address, target); | 358 case Code::CALL_IC: return CallIC::Clear(address, target); |
360 case Code::KEYED_CALL_IC: return KeyedCallIC::Clear(address, target); | 359 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: { | 762 case MEGAMORPHIC: { |
764 // Cache code holding map should be consistent with | 763 // Cache code holding map should be consistent with |
765 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. | 764 // GenerateMonomorphicCacheProbe. It is not the map which holds the stub. |
766 Handle<JSObject> cache_object = object->IsJSObject() | 765 Handle<JSObject> cache_object = object->IsJSObject() |
767 ? Handle<JSObject>::cast(object) | 766 ? Handle<JSObject>::cast(object) |
768 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); | 767 : Handle<JSObject>(JSObject::cast(object->GetPrototype())); |
769 // Update the stub cache. | 768 // Update the stub cache. |
770 isolate()->stub_cache()->Set(*name, cache_object->map(), *code); | 769 isolate()->stub_cache()->Set(*name, cache_object->map(), *code); |
771 break; | 770 break; |
772 } | 771 } |
773 case DEBUG_BREAK: | 772 case DEBUG_STUB: |
774 case DEBUG_PREPARE_STEP_IN: | |
775 break; | 773 break; |
776 case POLYMORPHIC: | 774 case POLYMORPHIC: |
777 UNREACHABLE(); | 775 UNREACHABLE(); |
778 break; | 776 break; |
779 } | 777 } |
780 | 778 |
781 TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC", | 779 TRACE_IC(kind_ == Code::CALL_IC ? "CallIC" : "KeyedCallIC", |
782 name, state, target()); | 780 name, state, target()); |
783 } | 781 } |
784 | 782 |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1059 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1057 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
1060 | 1058 |
1061 set_target(*megamorphic_stub()); | 1059 set_target(*megamorphic_stub()); |
1062 } | 1060 } |
1063 break; | 1061 break; |
1064 case MEGAMORPHIC: | 1062 case MEGAMORPHIC: |
1065 // Cache code holding map should be consistent with | 1063 // Cache code holding map should be consistent with |
1066 // GenerateMonomorphicCacheProbe. | 1064 // GenerateMonomorphicCacheProbe. |
1067 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1065 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
1068 break; | 1066 break; |
1069 case DEBUG_BREAK: | 1067 case DEBUG_STUB: |
1070 case DEBUG_PREPARE_STEP_IN: | |
1071 break; | 1068 break; |
1072 case POLYMORPHIC: | 1069 case POLYMORPHIC: |
1073 UNREACHABLE(); | 1070 UNREACHABLE(); |
1074 break; | 1071 break; |
1075 } | 1072 } |
1076 | 1073 |
1077 TRACE_IC("LoadIC", name, state, target()); | 1074 TRACE_IC("LoadIC", name, state, target()); |
1078 } | 1075 } |
1079 | 1076 |
1080 | 1077 |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1332 case POLYMORPHIC: | 1329 case POLYMORPHIC: |
1333 set_target(*code); | 1330 set_target(*code); |
1334 break; | 1331 break; |
1335 case MONOMORPHIC: | 1332 case MONOMORPHIC: |
1336 // Only move to megamorphic if the target changes. | 1333 // Only move to megamorphic if the target changes. |
1337 if (target() != *code) { | 1334 if (target() != *code) { |
1338 set_target(*megamorphic_stub()); | 1335 set_target(*megamorphic_stub()); |
1339 } | 1336 } |
1340 break; | 1337 break; |
1341 case MEGAMORPHIC: | 1338 case MEGAMORPHIC: |
1342 case DEBUG_BREAK: | 1339 case DEBUG_STUB: |
1343 case DEBUG_PREPARE_STEP_IN: | |
1344 break; | 1340 break; |
1345 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1341 case MONOMORPHIC_PROTOTYPE_FAILURE: |
1346 UNREACHABLE(); | 1342 UNREACHABLE(); |
1347 break; | 1343 break; |
1348 } | 1344 } |
1349 | 1345 |
1350 TRACE_IC("KeyedLoadIC", name, state, target()); | 1346 TRACE_IC("KeyedLoadIC", name, state, target()); |
1351 } | 1347 } |
1352 | 1348 |
1353 | 1349 |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1604 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
1609 set_target((strict_mode == kStrictMode) | 1605 set_target((strict_mode == kStrictMode) |
1610 ? megamorphic_stub_strict() | 1606 ? megamorphic_stub_strict() |
1611 : megamorphic_stub()); | 1607 : megamorphic_stub()); |
1612 } | 1608 } |
1613 break; | 1609 break; |
1614 case MEGAMORPHIC: | 1610 case MEGAMORPHIC: |
1615 // Update the stub cache. | 1611 // Update the stub cache. |
1616 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1612 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
1617 break; | 1613 break; |
1618 case DEBUG_BREAK: | 1614 case DEBUG_STUB: |
1619 case DEBUG_PREPARE_STEP_IN: | |
1620 break; | 1615 break; |
1621 case POLYMORPHIC: | 1616 case POLYMORPHIC: |
1622 UNREACHABLE(); | 1617 UNREACHABLE(); |
1623 break; | 1618 break; |
1624 } | 1619 } |
1625 | 1620 |
1626 TRACE_IC("StoreIC", name, state, target()); | 1621 TRACE_IC("StoreIC", name, state, target()); |
1627 } | 1622 } |
1628 | 1623 |
1629 | 1624 |
(...skipping 30 matching lines...) Expand all Loading... |
1660 ASSERT(object->IsMap()); | 1655 ASSERT(object->IsMap()); |
1661 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); | 1656 AddOneReceiverMapIfMissing(result, Handle<Map>::cast(object)); |
1662 } | 1657 } |
1663 break; | 1658 break; |
1664 } | 1659 } |
1665 case MEGAMORPHIC: | 1660 case MEGAMORPHIC: |
1666 break; | 1661 break; |
1667 case UNINITIALIZED: | 1662 case UNINITIALIZED: |
1668 case PREMONOMORPHIC: | 1663 case PREMONOMORPHIC: |
1669 case MONOMORPHIC_PROTOTYPE_FAILURE: | 1664 case MONOMORPHIC_PROTOTYPE_FAILURE: |
1670 case DEBUG_BREAK: | 1665 case DEBUG_STUB: |
1671 case DEBUG_PREPARE_STEP_IN: | |
1672 UNREACHABLE(); | 1666 UNREACHABLE(); |
1673 break; | 1667 break; |
1674 } | 1668 } |
1675 } | 1669 } |
1676 } | 1670 } |
1677 | 1671 |
1678 | 1672 |
1679 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, | 1673 Handle<Code> KeyedIC::ComputeStub(Handle<JSObject> receiver, |
1680 StubKind stub_kind, | 1674 StubKind stub_kind, |
1681 StrictModeFlag strict_mode, | 1675 StrictModeFlag strict_mode, |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2107 break; | 2101 break; |
2108 case MONOMORPHIC: | 2102 case MONOMORPHIC: |
2109 // Only move to megamorphic if the target changes. | 2103 // Only move to megamorphic if the target changes. |
2110 if (target() != *code) { | 2104 if (target() != *code) { |
2111 set_target((strict_mode == kStrictMode) | 2105 set_target((strict_mode == kStrictMode) |
2112 ? *megamorphic_stub_strict() | 2106 ? *megamorphic_stub_strict() |
2113 : *megamorphic_stub()); | 2107 : *megamorphic_stub()); |
2114 } | 2108 } |
2115 break; | 2109 break; |
2116 case MEGAMORPHIC: | 2110 case MEGAMORPHIC: |
2117 case DEBUG_BREAK: | 2111 case DEBUG_STUB: |
2118 case DEBUG_PREPARE_STEP_IN: | |
2119 break; | 2112 break; |
2120 case MONOMORPHIC_PROTOTYPE_FAILURE: | 2113 case MONOMORPHIC_PROTOTYPE_FAILURE: |
2121 UNREACHABLE(); | 2114 UNREACHABLE(); |
2122 break; | 2115 break; |
2123 } | 2116 } |
2124 | 2117 |
2125 TRACE_IC("KeyedStoreIC", name, state, target()); | 2118 TRACE_IC("KeyedStoreIC", name, state, target()); |
2126 } | 2119 } |
2127 | 2120 |
2128 | 2121 |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2864 #undef ADDR | 2857 #undef ADDR |
2865 }; | 2858 }; |
2866 | 2859 |
2867 | 2860 |
2868 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2861 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2869 return IC_utilities[id]; | 2862 return IC_utilities[id]; |
2870 } | 2863 } |
2871 | 2864 |
2872 | 2865 |
2873 } } // namespace v8::internal | 2866 } } // namespace v8::internal |
OLD | NEW |