| 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" |
| (...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 | 388 |
| 389 | 389 |
| 390 void UseVal::AddToEnvUseList() { | 390 void UseVal::AddToEnvUseList() { |
| 391 set_next_use(definition()->env_use_list()); | 391 set_next_use(definition()->env_use_list()); |
| 392 definition()->set_env_use_list(this); | 392 definition()->set_env_use_list(this); |
| 393 } | 393 } |
| 394 | 394 |
| 395 | 395 |
| 396 void Definition::ReplaceUsesWith(Definition* other) { | 396 void Definition::ReplaceUsesWith(Definition* other) { |
| 397 ASSERT(other != NULL); | 397 ASSERT(other != NULL); |
| 398 ASSERT(this != other); |
| 398 while (input_use_list_ != NULL) { | 399 while (input_use_list_ != NULL) { |
| 399 UseVal* current = input_use_list_; | 400 UseVal* current = input_use_list_; |
| 400 input_use_list_ = input_use_list_->next_use(); | 401 input_use_list_ = input_use_list_->next_use(); |
| 401 current->set_definition(other); | 402 current->set_definition(other); |
| 402 current->AddToInputUseList(); | 403 current->AddToInputUseList(); |
| 403 } | 404 } |
| 404 while (env_use_list_ != NULL) { | 405 while (env_use_list_ != NULL) { |
| 405 UseVal* current = env_use_list_; | 406 UseVal* current = env_use_list_; |
| 406 env_use_list_ = env_use_list_->next_use(); | 407 env_use_list_ = env_use_list_->next_use(); |
| 407 current->set_definition(other); | 408 current->set_definition(other); |
| (...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1527 values_.Add(UseDefinition(definitions[i])); | 1528 values_.Add(UseDefinition(definitions[i])); |
| 1528 } | 1529 } |
| 1529 } | 1530 } |
| 1530 | 1531 |
| 1531 | 1532 |
| 1532 Environment* Environment::Copy() const { | 1533 Environment* Environment::Copy() const { |
| 1533 Environment* copy = new Environment(values().length(), | 1534 Environment* copy = new Environment(values().length(), |
| 1534 fixed_parameter_count()); | 1535 fixed_parameter_count()); |
| 1535 GrowableArray<Value*>* values_copy = copy->values_ptr(); | 1536 GrowableArray<Value*>* values_copy = copy->values_ptr(); |
| 1536 for (intptr_t i = 0; i < values().length(); ++i) { | 1537 for (intptr_t i = 0; i < values().length(); ++i) { |
| 1537 Value* val = values()[i]; | 1538 values_copy->Add(values()[i]->CopyValue()); |
| 1538 values_copy->Add(val->IsUse() | |
| 1539 ? UseDefinition(values()[i]->AsUse()->definition()) | |
| 1540 : val); | |
| 1541 } | 1539 } |
| 1542 return copy; | 1540 return copy; |
| 1543 } | 1541 } |
| 1544 | 1542 |
| 1545 | 1543 |
| 1546 #undef __ | 1544 #undef __ |
| 1547 | 1545 |
| 1548 } // namespace dart | 1546 } // namespace dart |
| OLD | NEW |