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 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1010 return; | 1010 return; |
1011 } | 1011 } |
1012 } | 1012 } |
1013 | 1013 |
1014 // Patch the call site depending on the state of the cache. | 1014 // Patch the call site depending on the state of the cache. |
1015 if (state == UNINITIALIZED || | 1015 if (state == UNINITIALIZED || |
1016 state == PREMONOMORPHIC || | 1016 state == PREMONOMORPHIC || |
1017 state == MONOMORPHIC_PROTOTYPE_FAILURE) { | 1017 state == MONOMORPHIC_PROTOTYPE_FAILURE) { |
1018 set_target(*code); | 1018 set_target(*code); |
1019 } else if (state == MONOMORPHIC) { | 1019 } else if (state == MONOMORPHIC) { |
| 1020 // We are transitioning from monomorphic to megamorphic case. |
| 1021 // Place the current monomorphic stub and stub compiled for |
| 1022 // the receiver into stub cache. |
| 1023 Map* map = target()->FindFirstMap(); |
| 1024 if (map != NULL) { |
| 1025 isolate()->stub_cache()->Set(*name, map, target()); |
| 1026 } |
| 1027 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
| 1028 |
1020 set_target(*megamorphic_stub()); | 1029 set_target(*megamorphic_stub()); |
1021 } else if (state == MEGAMORPHIC) { | 1030 } else if (state == MEGAMORPHIC) { |
1022 // Cache code holding map should be consistent with | 1031 // Cache code holding map should be consistent with |
1023 // GenerateMonomorphicCacheProbe. | 1032 // GenerateMonomorphicCacheProbe. |
1024 isolate()->stub_cache()->Set(*name, receiver->map(), *code); | 1033 isolate()->stub_cache()->Set(*name, receiver->map(), *code); |
1025 } | 1034 } |
1026 | 1035 |
1027 TRACE_IC("LoadIC", name, state, target()); | 1036 TRACE_IC("LoadIC", name, state, target()); |
1028 } | 1037 } |
1029 | 1038 |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 #undef ADDR | 2577 #undef ADDR |
2569 }; | 2578 }; |
2570 | 2579 |
2571 | 2580 |
2572 Address IC::AddressFromUtilityId(IC::UtilityId id) { | 2581 Address IC::AddressFromUtilityId(IC::UtilityId id) { |
2573 return IC_utilities[id]; | 2582 return IC_utilities[id]; |
2574 } | 2583 } |
2575 | 2584 |
2576 | 2585 |
2577 } } // namespace v8::internal | 2586 } } // namespace v8::internal |
OLD | NEW |