Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(218)

Side by Side Diff: runtime/vm/weak_code.cc

Issue 1559653002: Investigate & fix issues around usage_count and deoptimization_count (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: d Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/weak_code.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "vm/compiler.h" 11 #include "vm/compiler.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 #include "vm/stack_frame.h" 13 #include "vm/stack_frame.h"
14 14
15 namespace dart { 15 namespace dart {
16 16
17 bool WeakCodeReferences::HasCodes() const {
18 return !array_.IsNull() && (array_.Length() > 0);
19 }
20
21
17 void WeakCodeReferences::Register(const Code& value) { 22 void WeakCodeReferences::Register(const Code& value) {
18 if (!array_.IsNull()) { 23 if (!array_.IsNull()) {
19 // Try to find and reuse cleared WeakProperty to avoid allocating new one. 24 // Try to find and reuse cleared WeakProperty to avoid allocating new one.
20 WeakProperty& weak_property = WeakProperty::Handle(); 25 WeakProperty& weak_property = WeakProperty::Handle();
21 for (intptr_t i = 0; i < array_.Length(); i++) { 26 for (intptr_t i = 0; i < array_.Length(); i++) {
22 weak_property ^= array_.At(i); 27 weak_property ^= array_.At(i);
23 if (weak_property.key() == Code::null()) { 28 if (weak_property.key() == Code::null()) {
24 // Empty property found. Reuse it. 29 // Empty property found. Reuse it.
25 weak_property.set_key(value); 30 weak_property.set_key(value);
26 return; 31 return;
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // Make non-OSR code non-entrant. 129 // Make non-OSR code non-entrant.
125 if (!code.IsDisabled()) { 130 if (!code.IsDisabled()) {
126 ReportSwitchingCode(code); 131 ReportSwitchingCode(code);
127 code.DisableDartCode(); 132 code.DisableDartCode();
128 } 133 }
129 } 134 }
130 } 135 }
131 } 136 }
132 137
133 } // namespace dart 138 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/weak_code.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698