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