| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 return true; | 56 return true; |
| 57 } | 57 } |
| 58 } | 58 } |
| 59 return false; | 59 return false; |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 void WeakCodeReferences::DisableCode() { | 63 void WeakCodeReferences::DisableCode() { |
| 64 Thread* thread = Thread::Current(); | 64 Thread* thread = Thread::Current(); |
| 65 const Array& code_objects = Array::Handle(thread->zone(), array_.raw()); | 65 const Array& code_objects = Array::Handle(thread->zone(), array_.raw()); |
| 66 #if defined(DART_PRECOMPILED_RUNTIME) |
| 67 ASSERT(code_objects.IsNull()); |
| 68 return; |
| 69 #else |
| 66 if (code_objects.IsNull()) { | 70 if (code_objects.IsNull()) { |
| 67 return; | 71 return; |
| 68 } | 72 } |
| 69 ASSERT(!FLAG_precompiled_runtime); | 73 |
| 70 UpdateArrayTo(Object::null_array()); | 74 UpdateArrayTo(Object::null_array()); |
| 71 // Disable all code on stack. | 75 // Disable all code on stack. |
| 72 Code& code = Code::Handle(); | 76 Code& code = Code::Handle(); |
| 73 { | 77 { |
| 74 DartFrameIterator iterator(thread, | 78 DartFrameIterator iterator(thread, |
| 75 StackFrameIterator::kNoCrossThreadIteration); | 79 StackFrameIterator::kNoCrossThreadIteration); |
| 76 StackFrame* frame = iterator.NextFrame(); | 80 StackFrame* frame = iterator.NextFrame(); |
| 77 while (frame != NULL) { | 81 while (frame != NULL) { |
| 78 code = frame->LookupDartCode(); | 82 code = frame->LookupDartCode(); |
| 79 if (IsOptimizedCode(code_objects, code)) { | 83 if (IsOptimizedCode(code_objects, code)) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 code.DisableDartCode(); | 129 code.DisableDartCode(); |
| 126 } | 130 } |
| 127 } else { | 131 } else { |
| 128 // Make non-OSR code non-entrant. | 132 // Make non-OSR code non-entrant. |
| 129 if (!code.IsDisabled()) { | 133 if (!code.IsDisabled()) { |
| 130 ReportSwitchingCode(code); | 134 ReportSwitchingCode(code); |
| 131 code.DisableDartCode(); | 135 code.DisableDartCode(); |
| 132 } | 136 } |
| 133 } | 137 } |
| 134 } | 138 } |
| 139 #endif // defined(DART_PRECOMPILED_RUNTIME) |
| 135 } | 140 } |
| 136 | 141 |
| 137 } // namespace dart | 142 } // namespace dart |
| OLD | NEW |