| 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 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1673 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1674 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1674 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1675 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1675 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1676 | 1676 |
| 1677 Condition true_cond = EmitIsObject(reg, false_label, true_label); | 1677 Condition true_cond = EmitIsObject(reg, false_label, true_label); |
| 1678 | 1678 |
| 1679 EmitBranch(true_block, false_block, true_cond); | 1679 EmitBranch(true_block, false_block, true_cond); |
| 1680 } | 1680 } |
| 1681 | 1681 |
| 1682 | 1682 |
| 1683 Condition LCodeGen::EmitIsString(Register input, | |
| 1684 Label* is_not_string, | |
| 1685 Label* is_string) { | |
| 1686 | |
| 1687 __ JumpIfSmi(input, is_not_string); | |
| 1688 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, rcx); | |
| 1689 | |
| 1690 return below; | |
| 1691 } | |
| 1692 | |
| 1693 | |
| 1694 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { | |
| 1695 Register reg = ToRegister(instr->InputAt(0)); | |
| 1696 | |
| 1697 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 1698 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 1699 Label* true_label = chunk_->GetAssemblyLabel(true_block); | |
| 1700 Label* false_label = chunk_->GetAssemblyLabel(false_block); | |
| 1701 | |
| 1702 Condition true_cond = EmitIsString(reg, false_label, true_label); | |
| 1703 | |
| 1704 EmitBranch(true_block, false_block, true_cond); | |
| 1705 } | |
| 1706 | |
| 1707 | |
| 1708 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1683 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
| 1709 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1684 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1710 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1685 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1711 | 1686 |
| 1712 Condition is_smi; | 1687 Condition is_smi; |
| 1713 if (instr->InputAt(0)->IsRegister()) { | 1688 if (instr->InputAt(0)->IsRegister()) { |
| 1714 Register input = ToRegister(instr->InputAt(0)); | 1689 Register input = ToRegister(instr->InputAt(0)); |
| 1715 is_smi = masm()->CheckSmi(input); | 1690 is_smi = masm()->CheckSmi(input); |
| 1716 } else { | 1691 } else { |
| 1717 Operand input = ToOperand(instr->InputAt(0)); | 1692 Operand input = ToOperand(instr->InputAt(0)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1729 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1704 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1730 | 1705 |
| 1731 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); | 1706 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
| 1732 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1707 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 1733 __ testb(FieldOperand(temp, Map::kBitFieldOffset), | 1708 __ testb(FieldOperand(temp, Map::kBitFieldOffset), |
| 1734 Immediate(1 << Map::kIsUndetectable)); | 1709 Immediate(1 << Map::kIsUndetectable)); |
| 1735 EmitBranch(true_block, false_block, not_zero); | 1710 EmitBranch(true_block, false_block, not_zero); |
| 1736 } | 1711 } |
| 1737 | 1712 |
| 1738 | 1713 |
| 1739 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { | |
| 1740 Token::Value op = instr->op(); | |
| 1741 int true_block = chunk_->LookupDestination(instr->true_block_id()); | |
| 1742 int false_block = chunk_->LookupDestination(instr->false_block_id()); | |
| 1743 | |
| 1744 Handle<Code> ic = CompareIC::GetUninitialized(op); | |
| 1745 CallCode(ic, RelocInfo::CODE_TARGET, instr); | |
| 1746 | |
| 1747 Condition condition = TokenToCondition(op, false); | |
| 1748 __ testq(rax, rax); | |
| 1749 | |
| 1750 EmitBranch(true_block, false_block, condition); | |
| 1751 } | |
| 1752 | |
| 1753 | |
| 1754 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 1714 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
| 1755 InstanceType from = instr->from(); | 1715 InstanceType from = instr->from(); |
| 1756 InstanceType to = instr->to(); | 1716 InstanceType to = instr->to(); |
| 1757 if (from == FIRST_TYPE) return to; | 1717 if (from == FIRST_TYPE) return to; |
| 1758 ASSERT(from == to || to == LAST_TYPE); | 1718 ASSERT(from == to || to == LAST_TYPE); |
| 1759 return from; | 1719 return from; |
| 1760 } | 1720 } |
| 1761 | 1721 |
| 1762 | 1722 |
| 1763 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { | 1723 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { |
| (...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4333 RegisterEnvironmentForDeoptimization(environment); | 4293 RegisterEnvironmentForDeoptimization(environment); |
| 4334 ASSERT(osr_pc_offset_ == -1); | 4294 ASSERT(osr_pc_offset_ == -1); |
| 4335 osr_pc_offset_ = masm()->pc_offset(); | 4295 osr_pc_offset_ = masm()->pc_offset(); |
| 4336 } | 4296 } |
| 4337 | 4297 |
| 4338 #undef __ | 4298 #undef __ |
| 4339 | 4299 |
| 4340 } } // namespace v8::internal | 4300 } } // namespace v8::internal |
| 4341 | 4301 |
| 4342 #endif // V8_TARGET_ARCH_X64 | 4302 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |