Chromium Code Reviews| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 561 } | 561 } |
| 562 if (value().IsInstance()) { | 562 if (value().IsInstance()) { |
| 563 return Instance::Cast(value()).GetType(); | 563 return Instance::Cast(value()).GetType(); |
| 564 } else { | 564 } else { |
| 565 ASSERT(value().IsAbstractTypeArguments()); | 565 ASSERT(value().IsAbstractTypeArguments()); |
| 566 return AbstractType::null(); | 566 return AbstractType::null(); |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 | 569 |
| 570 | 570 |
| 571 intptr_t ConstantVal::ResultCid() const { | |
| 572 if (value().IsNull()) { | |
| 573 return kNullCid; | |
| 574 } | |
| 575 if (value().IsInstance()) { | |
| 576 return Class::Handle(value().clazz()).id(); | |
| 577 } else { | |
| 578 ASSERT(value().IsAbstractTypeArguments()); | |
| 579 return kDynamicCid; | |
| 580 } | |
| 581 } | |
| 582 | |
| 583 | |
| 571 RawAbstractType* UseVal::CompileType() const { | 584 RawAbstractType* UseVal::CompileType() const { |
| 572 if (definition()->HasPropagatedType()) { | 585 if (definition()->HasPropagatedType()) { |
| 573 return definition()->PropagatedType(); | 586 return definition()->PropagatedType(); |
| 574 } | 587 } |
| 575 // The compile type may be requested when building the flow graph, i.e. before | 588 // The compile type may be requested when building the flow graph, i.e. before |
| 576 // type propagation has occurred. To avoid repeatedly computing the compile | 589 // type propagation has occurred. To avoid repeatedly computing the compile |
| 577 // type of the definition, we store it as initial propagated type. | 590 // type of the definition, we store it as initial propagated type. |
| 578 AbstractType& type = AbstractType::Handle(definition()->CompileType()); | 591 AbstractType& type = AbstractType::Handle(definition()->CompileType()); |
| 579 definition()->SetPropagatedType(type); | 592 definition()->SetPropagatedType(type); |
| 580 return type.raw(); | 593 return type.raw(); |
| 581 } | 594 } |
| 582 | 595 |
| 583 | 596 |
| 597 intptr_t UseVal::ResultCid() const { | |
| 598 // Some definitions are not in the instruction list, and must have | |
| 599 // its propagated cid computed at first use. | |
| 600 if (!definition()->has_propagated_cid()) { | |
| 601 intptr_t cid = kDynamicCid; | |
| 602 if (definition()->IsBind()) { | |
|
regis
2012/08/15 22:46:54
Why do you test for a Bind?
You should just forwar
srdjan
2012/08/16 00:34:46
Forwarding to function GetPropagatedCid() that may
| |
| 603 cid = definition()->AsBind()->computation()->ResultCid(); | |
| 604 ASSERT(cid != kIllegalCid); | |
| 605 } | |
| 606 definition()->SetPropagatedCid(cid); | |
| 607 } | |
| 608 return definition()->propagated_cid(); | |
| 609 } | |
| 610 | |
| 611 | |
| 584 RawAbstractType* AssertAssignableComp::CompileType() const { | 612 RawAbstractType* AssertAssignableComp::CompileType() const { |
| 585 const AbstractType& value_compile_type = | 613 const AbstractType& value_compile_type = |
| 586 AbstractType::Handle(value()->CompileType()); | 614 AbstractType::Handle(value()->CompileType()); |
| 587 if (!value_compile_type.IsNull() && | 615 if (!value_compile_type.IsNull() && |
| 588 value_compile_type.IsMoreSpecificThan(dst_type(), NULL)) { | 616 value_compile_type.IsMoreSpecificThan(dst_type(), NULL)) { |
| 589 return value_compile_type.raw(); | 617 return value_compile_type.raw(); |
| 590 } | 618 } |
| 591 return dst_type().raw(); | 619 return dst_type().raw(); |
| 592 } | 620 } |
| 593 | 621 |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1314 if (compiler->is_ssa()) { | 1342 if (compiler->is_ssa()) { |
| 1315 ASSERT(locs()->in(0).IsRegister()); | 1343 ASSERT(locs()->in(0).IsRegister()); |
| 1316 __ PushRegister(locs()->in(0).reg()); | 1344 __ PushRegister(locs()->in(0).reg()); |
| 1317 } | 1345 } |
| 1318 } | 1346 } |
| 1319 | 1347 |
| 1320 | 1348 |
| 1321 #undef __ | 1349 #undef __ |
| 1322 | 1350 |
| 1323 } // namespace dart | 1351 } // namespace dart |
| OLD | NEW |