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 14 matching lines...) Expand all Loading... |
25 for (intptr_t i = 0; i < array_.Length(); i++) { | 25 for (intptr_t i = 0; i < array_.Length(); i++) { |
26 weak_property ^= array_.At(i); | 26 weak_property ^= array_.At(i); |
27 if (weak_property.key() == Code::null()) { | 27 if (weak_property.key() == Code::null()) { |
28 // Empty property found. Reuse it. | 28 // Empty property found. Reuse it. |
29 weak_property.set_key(value); | 29 weak_property.set_key(value); |
30 return; | 30 return; |
31 } | 31 } |
32 } | 32 } |
33 } | 33 } |
34 | 34 |
35 const WeakProperty& weak_property = WeakProperty::Handle( | 35 const WeakProperty& weak_property = |
36 WeakProperty::New(Heap::kOld)); | 36 WeakProperty::Handle(WeakProperty::New(Heap::kOld)); |
37 weak_property.set_key(value); | 37 weak_property.set_key(value); |
38 | 38 |
39 intptr_t length = array_.IsNull() ? 0 : array_.Length(); | 39 intptr_t length = array_.IsNull() ? 0 : array_.Length(); |
40 const Array& new_array = Array::Handle( | 40 const Array& new_array = |
41 Array::Grow(array_, length + 1, Heap::kOld)); | 41 Array::Handle(Array::Grow(array_, length + 1, Heap::kOld)); |
42 new_array.SetAt(length, weak_property); | 42 new_array.SetAt(length, weak_property); |
43 UpdateArrayTo(new_array); | 43 UpdateArrayTo(new_array); |
44 } | 44 } |
45 | 45 |
46 | 46 |
47 bool WeakCodeReferences::IsOptimizedCode(const Array& dependent_code, | 47 bool WeakCodeReferences::IsOptimizedCode(const Array& dependent_code, |
48 const Code& code) { | 48 const Code& code) { |
49 if (!code.is_optimized()) { | 49 if (!code.is_optimized()) { |
50 return false; | 50 return false; |
51 } | 51 } |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 // Make non-OSR code non-entrant. | 126 // Make non-OSR code non-entrant. |
127 if (!code.IsDisabled()) { | 127 if (!code.IsDisabled()) { |
128 ReportSwitchingCode(code); | 128 ReportSwitchingCode(code); |
129 code.DisableDartCode(); | 129 code.DisableDartCode(); |
130 } | 130 } |
131 } | 131 } |
132 } | 132 } |
133 } | 133 } |
134 | 134 |
135 } // namespace dart | 135 } // namespace dart |
OLD | NEW |