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