| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 weak_property ^= dependent_code.At(i); | 54 weak_property ^= dependent_code.At(i); |
| 55 if (code.raw() == weak_property.key()) { | 55 if (code.raw() == weak_property.key()) { |
| 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 const Array& code_objects = Array::Handle(array_.raw()); | 64 Thread* thread = Thread::Current(); |
| 65 const Array& code_objects = Array::Handle(thread->zone(), array_.raw()); |
| 65 if (code_objects.IsNull()) { | 66 if (code_objects.IsNull()) { |
| 66 return; | 67 return; |
| 67 } | 68 } |
| 68 ASSERT(!FLAG_precompiled_runtime); | 69 ASSERT(!FLAG_precompiled_runtime); |
| 69 UpdateArrayTo(Object::null_array()); | 70 UpdateArrayTo(Object::null_array()); |
| 70 // Disable all code on stack. | 71 // Disable all code on stack. |
| 71 Code& code = Code::Handle(); | 72 Code& code = Code::Handle(); |
| 72 { | 73 { |
| 73 DartFrameIterator iterator; | 74 DartFrameIterator iterator(thread, |
| 75 StackFrameIterator::kNoCrossThreadIteration); |
| 74 StackFrame* frame = iterator.NextFrame(); | 76 StackFrame* frame = iterator.NextFrame(); |
| 75 while (frame != NULL) { | 77 while (frame != NULL) { |
| 76 code = frame->LookupDartCode(); | 78 code = frame->LookupDartCode(); |
| 77 if (IsOptimizedCode(code_objects, code)) { | 79 if (IsOptimizedCode(code_objects, code)) { |
| 78 ReportDeoptimization(code); | 80 ReportDeoptimization(code); |
| 79 DeoptimizeAt(code, frame); | 81 DeoptimizeAt(code, frame); |
| 80 } | 82 } |
| 81 frame = iterator.NextFrame(); | 83 frame = iterator.NextFrame(); |
| 82 } | 84 } |
| 83 } | 85 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // Make non-OSR code non-entrant. | 128 // Make non-OSR code non-entrant. |
| 127 if (!code.IsDisabled()) { | 129 if (!code.IsDisabled()) { |
| 128 ReportSwitchingCode(code); | 130 ReportSwitchingCode(code); |
| 129 code.DisableDartCode(); | 131 code.DisableDartCode(); |
| 130 } | 132 } |
| 131 } | 133 } |
| 132 } | 134 } |
| 133 } | 135 } |
| 134 | 136 |
| 135 } // namespace dart | 137 } // namespace dart |
| OLD | NEW |