| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/weak_code.h" | 5 #include "vm/weak_code.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 | 8 |
| 9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 code.Print(); | 101 code.Print(); |
| 102 continue; | 102 continue; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // If function uses dependent code switch it to unoptimized. | 105 // If function uses dependent code switch it to unoptimized. |
| 106 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { | 106 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { |
| 107 ReportSwitchingCode(code); | 107 ReportSwitchingCode(code); |
| 108 function.SwitchToUnoptimizedCode(); | 108 function.SwitchToUnoptimizedCode(); |
| 109 } else if (function.unoptimized_code() == code.raw()) { | 109 } else if (function.unoptimized_code() == code.raw()) { |
| 110 ReportSwitchingCode(code); | 110 ReportSwitchingCode(code); |
| 111 function.ClearICData(); | 111 function.ClearICDataArray(); |
| 112 // Remove the code object from the function. The next time the | 112 // Remove the code object from the function. The next time the |
| 113 // function is invoked, it will be compiled again. | 113 // function is invoked, it will be compiled again. |
| 114 function.ClearCode(); | 114 function.ClearCode(); |
| 115 // Invalidate the old code object so existing references to it | 115 // Invalidate the old code object so existing references to it |
| 116 // (from optimized code) will fail when invoked. | 116 // (from optimized code) will fail when invoked. |
| 117 if (!CodePatcher::IsEntryPatched(code)) { | 117 if (!CodePatcher::IsEntryPatched(code)) { |
| 118 CodePatcher::PatchEntry(code); | 118 CodePatcher::PatchEntry(code); |
| 119 } | 119 } |
| 120 } else { | 120 } else { |
| 121 // Make non-OSR code non-entrant. | 121 // Make non-OSR code non-entrant. |
| 122 if (code.GetEntryPatchPc() != 0) { | 122 if (code.GetEntryPatchPc() != 0) { |
| 123 if (!CodePatcher::IsEntryPatched(code)) { | 123 if (!CodePatcher::IsEntryPatched(code)) { |
| 124 ReportSwitchingCode(code); | 124 ReportSwitchingCode(code); |
| 125 CodePatcher::PatchEntry(code); | 125 CodePatcher::PatchEntry(code); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 } | 129 } |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace dart | 132 } // namespace dart |
| OLD | NEW |