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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 fail when invoked. |
119 if (!CodePatcher::IsEntryPatched(code)) { | 119 if (!CodePatcher::IsEntryPatched(code)) { |
120 CodePatcher::PatchEntry(code); | 120 CodePatcher::PatchEntry( |
| 121 code, Code::Handle(StubCode::FixCallersTarget_entry()->code())); |
121 } | 122 } |
122 } else { | 123 } else { |
123 // Make non-OSR code non-entrant. | 124 // Make non-OSR code non-entrant. |
124 if (code.GetEntryPatchPc() != 0) { | 125 if (!CodePatcher::IsEntryPatched(code)) { |
125 if (!CodePatcher::IsEntryPatched(code)) { | 126 ReportSwitchingCode(code); |
126 ReportSwitchingCode(code); | 127 CodePatcher::PatchEntry( |
127 CodePatcher::PatchEntry(code); | 128 code, Code::Handle(StubCode::FixCallersTarget_entry()->code())); |
128 } | |
129 } | 129 } |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 | 133 |
134 } // namespace dart | 134 } // namespace dart |
OLD | NEW |