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