OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 Value* prev = previous_use(); | 492 Value* prev = previous_use(); |
493 prev->set_next_use(next); | 493 prev->set_next_use(next); |
494 if (next != NULL) next->set_previous_use(prev); | 494 if (next != NULL) next->set_previous_use(prev); |
495 } | 495 } |
496 | 496 |
497 set_previous_use(NULL); | 497 set_previous_use(NULL); |
498 set_next_use(NULL); | 498 set_next_use(NULL); |
499 } | 499 } |
500 | 500 |
501 | 501 |
| 502 // True if the definition has a single input use and is used only in |
| 503 // environments at the same instruction as that input use. |
502 bool Definition::HasOnlyUse(Value* use) const { | 504 bool Definition::HasOnlyUse(Value* use) const { |
503 return (input_use_list() == use) && | 505 if ((input_use_list() != use) || (use->next_use() != NULL)) return false; |
504 (use->next_use() == NULL) && | 506 |
505 ((env_use_list() == NULL) || | 507 Instruction* target = use->instruction(); |
506 ((env_use_list()->instruction() == use->instruction()) && | 508 for (Value::Iterator it(env_use_list()); !it.Done(); it.Advance()) { |
507 (env_use_list()->next_use() == NULL))); | 509 if (it.Current()->instruction() != target) return false; |
| 510 } |
| 511 return true; |
508 } | 512 } |
509 | 513 |
510 | 514 |
511 void Definition::ReplaceUsesWith(Definition* other) { | 515 void Definition::ReplaceUsesWith(Definition* other) { |
512 ASSERT(other != NULL); | 516 ASSERT(other != NULL); |
513 ASSERT(this != other); | 517 ASSERT(this != other); |
514 | 518 |
515 Value* current = NULL; | 519 Value* current = NULL; |
516 Value* next = input_use_list(); | 520 Value* next = input_use_list(); |
517 if (next != NULL) { | 521 if (next != NULL) { |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1487 UNREACHABLE(); | 1491 UNREACHABLE(); |
1488 return NULL; | 1492 return NULL; |
1489 } | 1493 } |
1490 | 1494 |
1491 | 1495 |
1492 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1496 void PhiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1493 UNREACHABLE(); | 1497 UNREACHABLE(); |
1494 } | 1498 } |
1495 | 1499 |
1496 | 1500 |
| 1501 LocationSummary* RedefinitionInstr::MakeLocationSummary() const { |
| 1502 UNREACHABLE(); |
| 1503 return NULL; |
| 1504 } |
| 1505 |
| 1506 |
| 1507 void RedefinitionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1508 UNREACHABLE(); |
| 1509 } |
| 1510 |
| 1511 |
1497 LocationSummary* ParameterInstr::MakeLocationSummary() const { | 1512 LocationSummary* ParameterInstr::MakeLocationSummary() const { |
1498 UNREACHABLE(); | 1513 UNREACHABLE(); |
1499 return NULL; | 1514 return NULL; |
1500 } | 1515 } |
1501 | 1516 |
1502 | 1517 |
1503 void ParameterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1518 void ParameterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
1504 UNREACHABLE(); | 1519 UNREACHABLE(); |
1505 } | 1520 } |
1506 | 1521 |
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2416 default: | 2431 default: |
2417 UNREACHABLE(); | 2432 UNREACHABLE(); |
2418 } | 2433 } |
2419 return kPowRuntimeEntry; | 2434 return kPowRuntimeEntry; |
2420 } | 2435 } |
2421 | 2436 |
2422 | 2437 |
2423 #undef __ | 2438 #undef __ |
2424 | 2439 |
2425 } // namespace dart | 2440 } // namespace dart |
OLD | NEW |