| 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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 | 323 |
| 324 RawAbstractType* BindInstr::CompileType() const { | 324 RawAbstractType* BindInstr::CompileType() const { |
| 325 ASSERT(!HasPropagatedType()); | 325 ASSERT(!HasPropagatedType()); |
| 326 // The compile type may be requested when building the flow graph, i.e. before | 326 // The compile type may be requested when building the flow graph, i.e. before |
| 327 // type propagation has occurred. | 327 // type propagation has occurred. |
| 328 return computation()->CompileType(); | 328 return computation()->CompileType(); |
| 329 } | 329 } |
| 330 | 330 |
| 331 | 331 |
| 332 intptr_t BindInstr::GetPropagatedCid() { |
| 333 if (has_propagated_cid()) return propagated_cid(); |
| 334 intptr_t cid = computation()->ResultCid(); |
| 335 ASSERT(cid != kIllegalCid); |
| 336 SetPropagatedCid(cid); |
| 337 return cid; |
| 338 } |
| 339 |
| 332 void BindInstr::RecordAssignedVars(BitVector* assigned_vars, | 340 void BindInstr::RecordAssignedVars(BitVector* assigned_vars, |
| 333 intptr_t fixed_parameter_count) { | 341 intptr_t fixed_parameter_count) { |
| 334 computation()->RecordAssignedVars(assigned_vars, fixed_parameter_count); | 342 computation()->RecordAssignedVars(assigned_vars, fixed_parameter_count); |
| 335 } | 343 } |
| 336 | 344 |
| 337 | 345 |
| 338 // ==== Postorder graph traversal. | 346 // ==== Postorder graph traversal. |
| 339 void GraphEntryInstr::DiscoverBlocks( | 347 void GraphEntryInstr::DiscoverBlocks( |
| 340 BlockEntryInstr* current_block, | 348 BlockEntryInstr* current_block, |
| 341 GrowableArray<BlockEntryInstr*>* preorder, | 349 GrowableArray<BlockEntryInstr*>* preorder, |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 } | 569 } |
| 562 if (value().IsInstance()) { | 570 if (value().IsInstance()) { |
| 563 return Instance::Cast(value()).GetType(); | 571 return Instance::Cast(value()).GetType(); |
| 564 } else { | 572 } else { |
| 565 ASSERT(value().IsAbstractTypeArguments()); | 573 ASSERT(value().IsAbstractTypeArguments()); |
| 566 return AbstractType::null(); | 574 return AbstractType::null(); |
| 567 } | 575 } |
| 568 } | 576 } |
| 569 | 577 |
| 570 | 578 |
| 579 intptr_t ConstantVal::ResultCid() const { |
| 580 if (value().IsNull()) { |
| 581 return kNullCid; |
| 582 } |
| 583 if (value().IsInstance()) { |
| 584 return Class::Handle(value().clazz()).id(); |
| 585 } else { |
| 586 ASSERT(value().IsAbstractTypeArguments()); |
| 587 return kDynamicCid; |
| 588 } |
| 589 } |
| 590 |
| 591 |
| 571 RawAbstractType* UseVal::CompileType() const { | 592 RawAbstractType* UseVal::CompileType() const { |
| 572 if (definition()->HasPropagatedType()) { | 593 if (definition()->HasPropagatedType()) { |
| 573 return definition()->PropagatedType(); | 594 return definition()->PropagatedType(); |
| 574 } | 595 } |
| 575 // The compile type may be requested when building the flow graph, i.e. before | 596 // 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 | 597 // type propagation has occurred. To avoid repeatedly computing the compile |
| 577 // type of the definition, we store it as initial propagated type. | 598 // type of the definition, we store it as initial propagated type. |
| 578 AbstractType& type = AbstractType::Handle(definition()->CompileType()); | 599 AbstractType& type = AbstractType::Handle(definition()->CompileType()); |
| 579 definition()->SetPropagatedType(type); | 600 definition()->SetPropagatedType(type); |
| 580 return type.raw(); | 601 return type.raw(); |
| 581 } | 602 } |
| 582 | 603 |
| 583 | 604 |
| 605 intptr_t UseVal::ResultCid() const { |
| 606 return definition()->GetPropagatedCid(); |
| 607 } |
| 608 |
| 609 |
| 584 RawAbstractType* AssertAssignableComp::CompileType() const { | 610 RawAbstractType* AssertAssignableComp::CompileType() const { |
| 585 const AbstractType& value_compile_type = | 611 const AbstractType& value_compile_type = |
| 586 AbstractType::Handle(value()->CompileType()); | 612 AbstractType::Handle(value()->CompileType()); |
| 587 if (!value_compile_type.IsNull() && | 613 if (!value_compile_type.IsNull() && |
| 588 value_compile_type.IsMoreSpecificThan(dst_type(), NULL)) { | 614 value_compile_type.IsMoreSpecificThan(dst_type(), NULL)) { |
| 589 return value_compile_type.raw(); | 615 return value_compile_type.raw(); |
| 590 } | 616 } |
| 591 return dst_type().raw(); | 617 return dst_type().raw(); |
| 592 } | 618 } |
| 593 | 619 |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1314 if (compiler->is_ssa()) { | 1340 if (compiler->is_ssa()) { |
| 1315 ASSERT(locs()->in(0).IsRegister()); | 1341 ASSERT(locs()->in(0).IsRegister()); |
| 1316 __ PushRegister(locs()->in(0).reg()); | 1342 __ PushRegister(locs()->in(0).reg()); |
| 1317 } | 1343 } |
| 1318 } | 1344 } |
| 1319 | 1345 |
| 1320 | 1346 |
| 1321 #undef __ | 1347 #undef __ |
| 1322 | 1348 |
| 1323 } // namespace dart | 1349 } // namespace dart |
| OLD | NEW |