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 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 if (left.IsConstant() && right.IsConstant()) { | 1580 if (left.IsConstant() && right.IsConstant()) { |
1581 // TODO(vegorov): should be eliminated earlier by constant propagation. | 1581 // TODO(vegorov): should be eliminated earlier by constant propagation. |
1582 const bool result = (kind() == Token::kEQ_STRICT) ? | 1582 const bool result = (kind() == Token::kEQ_STRICT) ? |
1583 left.constant().raw() == right.constant().raw() : | 1583 left.constant().raw() == right.constant().raw() : |
1584 left.constant().raw() != right.constant().raw(); | 1584 left.constant().raw() != right.constant().raw(); |
1585 __ LoadObject(locs()->out().reg(), result ? compiler->bool_true() : | 1585 __ LoadObject(locs()->out().reg(), result ? compiler->bool_true() : |
1586 compiler->bool_false()); | 1586 compiler->bool_false()); |
1587 return; | 1587 return; |
1588 } | 1588 } |
1589 if (left.IsConstant()) { | 1589 if (left.IsConstant()) { |
1590 __ CompareObject(right.reg(), left.constant()); | 1590 compiler->EmitEqualityRegConstCompare(right.reg(), left.constant()); |
1591 } else if (right.IsConstant()) { | 1591 } else if (right.IsConstant()) { |
1592 __ CompareObject(left.reg(), right.constant()); | 1592 compiler->EmitEqualityRegConstCompare(left.reg(), right.constant()); |
1593 } else { | 1593 } else { |
1594 __ CompareRegisters(left.reg(), right.reg()); | 1594 __ CompareRegisters(left.reg(), right.reg()); |
1595 } | 1595 } |
1596 | 1596 |
1597 Register result = locs()->out().reg(); | 1597 Register result = locs()->out().reg(); |
1598 Label load_true, done; | 1598 Label load_true, done; |
1599 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 1599 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
1600 __ j(true_condition, &load_true, Assembler::kNearJump); | 1600 __ j(true_condition, &load_true, Assembler::kNearJump); |
1601 __ LoadObject(result, compiler->bool_false()); | 1601 __ LoadObject(result, compiler->bool_false()); |
1602 __ jmp(&done, Assembler::kNearJump); | 1602 __ jmp(&done, Assembler::kNearJump); |
(...skipping 10 matching lines...) Expand all Loading... |
1613 Location right = locs()->in(1); | 1613 Location right = locs()->in(1); |
1614 if (left.IsConstant() && right.IsConstant()) { | 1614 if (left.IsConstant() && right.IsConstant()) { |
1615 // TODO(vegorov): should be eliminated earlier by constant propagation. | 1615 // TODO(vegorov): should be eliminated earlier by constant propagation. |
1616 const bool result = (kind() == Token::kEQ_STRICT) ? | 1616 const bool result = (kind() == Token::kEQ_STRICT) ? |
1617 left.constant().raw() == right.constant().raw() : | 1617 left.constant().raw() == right.constant().raw() : |
1618 left.constant().raw() != right.constant().raw(); | 1618 left.constant().raw() != right.constant().raw(); |
1619 branch->EmitBranchOnValue(compiler, result); | 1619 branch->EmitBranchOnValue(compiler, result); |
1620 return; | 1620 return; |
1621 } | 1621 } |
1622 if (left.IsConstant()) { | 1622 if (left.IsConstant()) { |
1623 __ CompareObject(right.reg(), left.constant()); | 1623 compiler->EmitEqualityRegConstCompare(right.reg(), left.constant()); |
1624 } else if (right.IsConstant()) { | 1624 } else if (right.IsConstant()) { |
1625 __ CompareObject(left.reg(), right.constant()); | 1625 compiler->EmitEqualityRegConstCompare(left.reg(), right.constant()); |
1626 } else { | 1626 } else { |
1627 __ CompareRegisters(left.reg(), right.reg()); | 1627 __ CompareRegisters(left.reg(), right.reg()); |
1628 } | 1628 } |
1629 | 1629 |
1630 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; | 1630 Condition true_condition = (kind() == Token::kEQ_STRICT) ? EQUAL : NOT_EQUAL; |
1631 branch->EmitBranchOnCondition(compiler, true_condition); | 1631 branch->EmitBranchOnCondition(compiler, true_condition); |
1632 } | 1632 } |
1633 | 1633 |
1634 | 1634 |
1635 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1635 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 new_max = new_max.Clamp(); | 2036 new_max = new_max.Clamp(); |
2037 } | 2037 } |
2038 | 2038 |
2039 return Range::Update(&range_, new_min, new_max); | 2039 return Range::Update(&range_, new_min, new_max); |
2040 } | 2040 } |
2041 | 2041 |
2042 | 2042 |
2043 #undef __ | 2043 #undef __ |
2044 | 2044 |
2045 } // namespace dart | 2045 } // namespace dart |
OLD | NEW |