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

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

Issue 1657153002: Clean up global variables related to precompilation. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« runtime/vm/code_descriptors.cc ('K') | « runtime/vm/object.cc ('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 DECLARE_FLAG(bool, precompilation);
18
17 bool WeakCodeReferences::HasCodes() const { 19 bool WeakCodeReferences::HasCodes() const {
18 return !array_.IsNull() && (array_.Length() > 0); 20 return !array_.IsNull() && (array_.Length() > 0);
19 } 21 }
20 22
21 23
22 void WeakCodeReferences::Register(const Code& value) { 24 void WeakCodeReferences::Register(const Code& value) {
23 if (!array_.IsNull()) { 25 if (!array_.IsNull()) {
24 // Try to find and reuse cleared WeakProperty to avoid allocating new one. 26 // Try to find and reuse cleared WeakProperty to avoid allocating new one.
25 WeakProperty& weak_property = WeakProperty::Handle(); 27 WeakProperty& weak_property = WeakProperty::Handle();
26 for (intptr_t i = 0; i < array_.Length(); i++) { 28 for (intptr_t i = 0; i < array_.Length(); i++) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return false; 62 return false;
61 } 63 }
62 64
63 65
64 void WeakCodeReferences::DisableCode() { 66 void WeakCodeReferences::DisableCode() {
65 IncrementInvalidationGen(); 67 IncrementInvalidationGen();
66 const Array& code_objects = Array::Handle(array_.raw()); 68 const Array& code_objects = Array::Handle(array_.raw());
67 if (code_objects.IsNull()) { 69 if (code_objects.IsNull()) {
68 return; 70 return;
69 } 71 }
70 ASSERT(Compiler::allow_recompilation()); 72 ASSERT(!FLAG_precompilation);
71 UpdateArrayTo(Object::null_array()); 73 UpdateArrayTo(Object::null_array());
72 // Disable all code on stack. 74 // Disable all code on stack.
73 Code& code = Code::Handle(); 75 Code& code = Code::Handle();
74 { 76 {
75 DartFrameIterator iterator; 77 DartFrameIterator iterator;
76 StackFrame* frame = iterator.NextFrame(); 78 StackFrame* frame = iterator.NextFrame();
77 while (frame != NULL) { 79 while (frame != NULL) {
78 code = frame->LookupDartCode(); 80 code = frame->LookupDartCode();
79 if (IsOptimizedCode(code_objects, code)) { 81 if (IsOptimizedCode(code_objects, code)) {
80 ReportDeoptimization(code); 82 ReportDeoptimization(code);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Make non-OSR code non-entrant. 131 // Make non-OSR code non-entrant.
130 if (!code.IsDisabled()) { 132 if (!code.IsDisabled()) {
131 ReportSwitchingCode(code); 133 ReportSwitchingCode(code);
132 code.DisableDartCode(); 134 code.DisableDartCode();
133 } 135 }
134 } 136 }
135 } 137 }
136 } 138 }
137 139
138 } // namespace dart 140 } // namespace dart
OLDNEW
« runtime/vm/code_descriptors.cc ('K') | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698