| OLD | NEW |
| 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 AddToDefUseChain(); |
| 26 } |
| 27 |
| 28 void UseVal::set_definition(Definition* definition) { |
| 29 ASSERT(definition != NULL); |
| 30 RemoveFromDefUseChain(); |
| 31 definition_ = definition; |
| 32 AddToDefUseChain(); |
| 33 } |
| 34 |
| 35 void UseVal::RemoveFromDefUseChain() { |
| 36 ASSERT(definition_ != NULL); |
| 37 if (previous_use_ == NULL) { |
| 38 ASSERT(definition_->def_use_chain() == this); |
| 39 definition_->set_def_use_chain(next_use_); |
| 40 } else { |
| 41 previous_use_->next_use_ = next_use_; |
| 42 } |
| 43 if (next_use_ != NULL) { |
| 44 next_use_->previous_use_ = previous_use_; |
| 45 } |
| 46 previous_use_ = next_use_ = NULL; |
| 47 definition_ = NULL; |
| 48 } |
| 49 |
| 50 void UseVal::AddToDefUseChain() { |
| 51 ASSERT(next_use_ == NULL && previous_use_ == NULL && definition_ != NULL); |
| 52 UseVal* chain = definition_->def_use_chain(); |
| 53 if (chain != NULL) { |
| 54 next_use_ = chain; |
| 55 chain->previous_use_ = this; |
| 56 } |
| 57 definition_->set_def_use_chain(this); |
| 58 } |
| 59 |
| 60 |
| 61 |
| 23 | 62 |
| 24 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( | 63 MethodRecognizer::Kind MethodRecognizer::RecognizeKind( |
| 25 const Function& function) { | 64 const Function& function) { |
| 26 // Only core library methods can be recognized. | 65 // Only core library methods can be recognized. |
| 27 const Library& core_lib = Library::Handle(Library::CoreLibrary()); | 66 const Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 28 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 67 const Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 29 const Class& function_class = Class::Handle(function.owner()); | 68 const Class& function_class = Class::Handle(function.owner()); |
| 30 if ((function_class.library() != core_lib.raw()) && | 69 if ((function_class.library() != core_lib.raw()) && |
| 31 (function_class.library() != core_impl_lib.raw())) { | 70 (function_class.library() != core_impl_lib.raw())) { |
| 32 return kUnknown; | 71 return kUnknown; |
| (...skipping 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1210 locations_[i] = Location::NoLocation(); | 1249 locations_[i] = Location::NoLocation(); |
| 1211 } | 1250 } |
| 1212 } | 1251 } |
| 1213 } | 1252 } |
| 1214 } | 1253 } |
| 1215 | 1254 |
| 1216 | 1255 |
| 1217 #undef __ | 1256 #undef __ |
| 1218 | 1257 |
| 1219 } // namespace dart | 1258 } // namespace dart |
| OLD | NEW |