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

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

Issue 10826230: Added def-use chain to the intermediate language. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed comments for def-use chain. Created 8 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/dart_entry.h" 8 #include "vm/dart_entry.h"
9 #include "vm/flow_graph_allocator.h" 9 #include "vm/flow_graph_allocator.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
11 #include "vm/flow_graph_compiler.h" 11 #include "vm/flow_graph_compiler.h"
12 #include "vm/locations.h" 12 #include "vm/locations.h"
13 #include "vm/object.h" 13 #include "vm/object.h"
14 #include "vm/os.h" 14 #include "vm/os.h"
15 #include "vm/scopes.h" 15 #include "vm/scopes.h"
16 #include "vm/stub_code.h" 16 #include "vm/stub_code.h"
17 #include "vm/symbols.h" 17 #include "vm/symbols.h"
18 18
19 namespace dart { 19 namespace dart {
20 20
21 DECLARE_FLAG(bool, enable_type_checks); 21 DECLARE_FLAG(bool, enable_type_checks);
22 22
23 UseVal::UseVal(Definition* definition)
24 : definition_(definition), next_use_(NULL), previous_use_(NULL) {
25 AddToUseList();
26 }
27
28 void UseVal::SetDefinition(Definition* definition) {
29 ASSERT(definition != NULL);
30 RemoveFromUseList();
31 definition_ = definition;
32 AddToUseList();
33 }
34
Florian Schneider 2012/08/10 12:28:00 Add an empty line here.
35 void UseVal::RemoveFromUseList() {
36 ASSERT(definition_ != NULL);
37 if (next_use_ != NULL) {
38 next_use_->previous_use_ = previous_use_;
39 }
40 if (previous_use_ != NULL) {
41 previous_use_->next_use_ = next_use_;
42 } else {
43 // This is the head of the list.
44 ASSERT(definition_->use_list() == this);
45 definition_->set_use_list(next_use_);
46 }
47 previous_use_ = next_use_ = NULL;
48 definition_ = NULL;
49 }
50
Florian Schneider 2012/08/10 12:28:00 Add an empty line here.
51 void UseVal::AddToUseList() {
52 ASSERT(next_use_ == NULL && previous_use_ == NULL && definition_ != NULL);
53 UseVal* head = definition_->use_list();
54 if (head != NULL) {
55 next_use_ = head;
56 head->previous_use_ = this;
57 }
58 definition_->set_use_list(this);
59 }
60
23 61
24 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( 62 MethodRecognizer::Kind MethodRecognizer::RecognizeKind(
25 const Function& function) { 63 const Function& function) {
26 // Only core library methods can be recognized. 64 // Only core library methods can be recognized.
27 const Library& core_lib = Library::Handle(Library::CoreLibrary()); 65 const Library& core_lib = Library::Handle(Library::CoreLibrary());
28 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); 66 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary());
29 const Class& function_class = Class::Handle(function.owner()); 67 const Class& function_class = Class::Handle(function.owner());
30 if ((function_class.library() != core_lib.raw()) && 68 if ((function_class.library() != core_lib.raw()) &&
31 (function_class.library() != core_impl_lib.raw())) { 69 (function_class.library() != core_impl_lib.raw())) {
32 return kUnknown; 70 return kUnknown;
(...skipping 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 locations_[i] = Location::NoLocation(); 1258 locations_[i] = Location::NoLocation();
1221 } 1259 }
1222 } 1260 }
1223 } 1261 }
1224 } 1262 }
1225 1263
1226 1264
1227 #undef __ 1265 #undef __
1228 1266
1229 } // namespace dart 1267 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698