| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 code.Print(); | 106 code.Print(); |
| 107 continue; | 107 continue; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // If function uses dependent code switch it to unoptimized. | 110 // If function uses dependent code switch it to unoptimized. |
| 111 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { | 111 if (code.is_optimized() && (function.CurrentCode() == code.raw())) { |
| 112 ReportSwitchingCode(code); | 112 ReportSwitchingCode(code); |
| 113 function.SwitchToUnoptimizedCode(); | 113 function.SwitchToUnoptimizedCode(); |
| 114 } else if (function.unoptimized_code() == code.raw()) { | 114 } else if (function.unoptimized_code() == code.raw()) { |
| 115 ReportSwitchingCode(code); | 115 ReportSwitchingCode(code); |
| 116 function.set_was_compiled(false); |
| 116 function.ClearICDataArray(); | 117 function.ClearICDataArray(); |
| 117 // Remove the code object from the function. The next time the | 118 // Remove the code object from the function. The next time the |
| 118 // function is invoked, it will be compiled again. | 119 // function is invoked, it will be compiled again. |
| 119 function.ClearCode(); | 120 function.ClearCode(); |
| 120 // Invalidate the old code object so existing references to it | 121 // Invalidate the old code object so existing references to it |
| 121 // (from optimized code) will be patched when invoked. | 122 // (from optimized code) will be patched when invoked. |
| 122 if (!code.IsDisabled()) { | 123 if (!code.IsDisabled()) { |
| 123 code.DisableDartCode(); | 124 code.DisableDartCode(); |
| 124 } | 125 } |
| 125 } else { | 126 } else { |
| 126 // Make non-OSR code non-entrant. | 127 // Make non-OSR code non-entrant. |
| 127 if (!code.IsDisabled()) { | 128 if (!code.IsDisabled()) { |
| 128 ReportSwitchingCode(code); | 129 ReportSwitchingCode(code); |
| 129 code.DisableDartCode(); | 130 code.DisableDartCode(); |
| 130 } | 131 } |
| 131 } | 132 } |
| 132 } | 133 } |
| 133 } | 134 } |
| 134 | 135 |
| 135 } // namespace dart | 136 } // namespace dart |
| OLD | NEW |