| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 1698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1709 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1709 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1710 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1710 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1711 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1711 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1712 | 1712 |
| 1713 Condition true_cond = EmitIsObject(reg, temp, false_label, true_label); | 1713 Condition true_cond = EmitIsObject(reg, temp, false_label, true_label); |
| 1714 | 1714 |
| 1715 EmitBranch(true_block, false_block, true_cond); | 1715 EmitBranch(true_block, false_block, true_cond); |
| 1716 } | 1716 } |
| 1717 | 1717 |
| 1718 | 1718 |
| 1719 Condition LCodeGen::EmitIsString(Register input, | |
| 1720 Register temp1, | |
| 1721 Label* is_not_string, | |
| 1722 Label* is_string) { | |
| 1723 __ JumpIfSmi(input, is_not_string); | |
| 1724 | |
| 1725 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); | |
| 1726 | |
| 1727 return cond; | |
| 1728 } | |
| 1729 | |
| 1730 | |
| 1731 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { | |
| 1732 Register reg = ToRegister(instr->InputAt(0)); | |
| 1733 Register temp = ToRegister(instr->TempAt(0)); | |
| 1734 | |
| 1735 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 1736 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 1737 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
| 1738 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
| 1739 | |
| 1740 Condition true_cond = EmitIsString(reg, temp, false_label, true_label); | |
| 1741 | |
| 1742 EmitBranch(true_block, false_block, true_cond); | |
| 1743 } | |
| 1744 | |
| 1745 | |
| 1746 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1719 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
| 1747 Operand input = ToOperand(instr->InputAt(0)); | 1720 Operand input = ToOperand(instr->InputAt(0)); |
| 1748 | 1721 |
| 1749 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1722 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1750 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1723 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1751 | 1724 |
| 1752 __ test(input, Immediate(kSmiTagMask)); | 1725 __ test(input, Immediate(kSmiTagMask)); |
| 1753 EmitBranch(true_block, false_block, zero); | 1726 EmitBranch(true_block, false_block, zero); |
| 1754 } | 1727 } |
| 1755 | 1728 |
| 1756 | 1729 |
| 1757 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { | 1730 void LCodeGen::DoIsUndetectableAndBranch(LIsUndetectableAndBranch* instr) { |
| 1758 Register input = ToRegister(instr->InputAt(0)); | 1731 Register input = ToRegister(instr->InputAt(0)); |
| 1759 Register temp = ToRegister(instr->TempAt(0)); | 1732 Register temp = ToRegister(instr->TempAt(0)); |
| 1760 | 1733 |
| 1761 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1734 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1762 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1735 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1763 | 1736 |
| 1764 STATIC_ASSERT(kSmiTag == 0); | 1737 STATIC_ASSERT(kSmiTag == 0); |
| 1765 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); | 1738 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
| 1766 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1739 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 1767 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), | 1740 __ test_b(FieldOperand(temp, Map::kBitFieldOffset), |
| 1768 1 << Map::kIsUndetectable); | 1741 1 << Map::kIsUndetectable); |
| 1769 EmitBranch(true_block, false_block, not_zero); | 1742 EmitBranch(true_block, false_block, not_zero); |
| 1770 } | 1743 } |
| 1771 | 1744 |
| 1772 | 1745 |
| 1773 static Condition ComputeCompareCondition(Token::Value op) { | |
| 1774 switch (op) { | |
| 1775 case Token::EQ_STRICT: | |
| 1776 case Token::EQ: | |
| 1777 return equal; | |
| 1778 case Token::LT: | |
| 1779 return less; | |
| 1780 case Token::GT: | |
| 1781 return greater; | |
| 1782 case Token::LTE: | |
| 1783 return less_equal; | |
| 1784 case Token::GTE: | |
| 1785 return greater_equal; | |
| 1786 default: | |
| 1787 UNREACHABLE(); | |
| 1788 return no_condition; | |
| 1789 } | |
| 1790 } | |
| 1791 | |
| 1792 | |
| 1793 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | |
| 1794 Token::Value op = instr->op(); | |
| 1795 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 1796 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 1797 | |
| 1798 Handle<Code> ic = CompareIC::GetUninitialized(op); | |
| 1799 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
| 1800 | |
| 1801 Condition condition = ComputeCompareCondition(op); | |
| 1802 __ test(eax, Operand(eax)); | |
| 1803 | |
| 1804 EmitBranch(true_block, false_block, condition); | |
| 1805 } | |
| 1806 | |
| 1807 | |
| 1808 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 1746 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
| 1809 InstanceType from = instr->from(); | 1747 InstanceType from = instr->from(); |
| 1810 InstanceType to = instr->to(); | 1748 InstanceType to = instr->to(); |
| 1811 if (from == FIRST_TYPE) return to; | 1749 if (from == FIRST_TYPE) return to; |
| 1812 ASSERT(from == to || to == LAST_TYPE); | 1750 ASSERT(from == to || to == LAST_TYPE); |
| 1813 return from; | 1751 return from; |
| 1814 } | 1752 } |
| 1815 | 1753 |
| 1816 | 1754 |
| 1817 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { | 1755 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 __ StoreToSafepointRegisterSlot(temp, temp); | 2009 __ StoreToSafepointRegisterSlot(temp, temp); |
| 2072 CallCodeGeneric(stub.GetCode(), | 2010 CallCodeGeneric(stub.GetCode(), |
| 2073 RelocInfo::CODE_TARGET, | 2011 RelocInfo::CODE_TARGET, |
| 2074 instr, | 2012 instr, |
| 2075 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); | 2013 RECORD_SAFEPOINT_WITH_REGISTERS_AND_NO_ARGUMENTS); |
| 2076 // Put the result value into the eax slot and restore all registers. | 2014 // Put the result value into the eax slot and restore all registers. |
| 2077 __ StoreToSafepointRegisterSlot(eax, eax); | 2015 __ StoreToSafepointRegisterSlot(eax, eax); |
| 2078 } | 2016 } |
| 2079 | 2017 |
| 2080 | 2018 |
| 2019 static Condition ComputeCompareCondition(Token::Value op) { |
| 2020 switch (op) { |
| 2021 case Token::EQ_STRICT: |
| 2022 case Token::EQ: |
| 2023 return equal; |
| 2024 case Token::LT: |
| 2025 return less; |
| 2026 case Token::GT: |
| 2027 return greater; |
| 2028 case Token::LTE: |
| 2029 return less_equal; |
| 2030 case Token::GTE: |
| 2031 return greater_equal; |
| 2032 default: |
| 2033 UNREACHABLE(); |
| 2034 return no_condition; |
| 2035 } |
| 2036 } |
| 2037 |
| 2038 |
| 2081 void LCodeGen::DoCmpT(LCmpT* instr) { | 2039 void LCodeGen::DoCmpT(LCmpT* instr) { |
| 2082 Token::Value op = instr->op(); | 2040 Token::Value op = instr->op(); |
| 2083 | 2041 |
| 2084 Handle<Code> ic = CompareIC::GetUninitialized(op); | 2042 Handle<Code> ic = CompareIC::GetUninitialized(op); |
| 2085 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2043 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2086 | 2044 |
| 2087 Condition condition = ComputeCompareCondition(op); | 2045 Condition condition = ComputeCompareCondition(op); |
| 2088 Label true_value, done; | 2046 Label true_value, done; |
| 2089 __ test(eax, Operand(eax)); | 2047 __ test(eax, Operand(eax)); |
| 2090 __ j(condition, &true_value, Label::kNear); | 2048 __ j(condition, &true_value, Label::kNear); |
| (...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4625 env->deoptimization_index()); | 4583 env->deoptimization_index()); |
| 4626 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4584 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4627 } | 4585 } |
| 4628 | 4586 |
| 4629 | 4587 |
| 4630 #undef __ | 4588 #undef __ |
| 4631 | 4589 |
| 4632 } } // namespace v8::internal | 4590 } } // namespace v8::internal |
| 4633 | 4591 |
| 4634 #endif // V8_TARGET_ARCH_IA32 | 4592 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |