| 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 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1607 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1607 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1608 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1608 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1609 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1609 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1610 | 1610 |
| 1611 Condition true_cond = EmitIsObject(reg, false_label, true_label); | 1611 Condition true_cond = EmitIsObject(reg, false_label, true_label); |
| 1612 | 1612 |
| 1613 EmitBranch(true_block, false_block, true_cond); | 1613 EmitBranch(true_block, false_block, true_cond); |
| 1614 } | 1614 } |
| 1615 | 1615 |
| 1616 | 1616 |
| 1617 Condition LCodeGen::EmitIsString(Register input, |
| 1618 Register temp1, |
| 1619 Label* is_not_string) { |
| 1620 |
| 1621 __ JumpIfSmi(input, is_not_string); |
| 1622 Condition cond = masm_->IsObjectStringType(input, temp1, temp1); |
| 1623 |
| 1624 return cond; |
| 1625 } |
| 1626 |
| 1627 |
| 1628 void LCodeGen::DoIsStringAndBranch(LIsStringAndBranch* instr) { |
| 1629 Register reg = ToRegister(instr->InputAt(0)); |
| 1630 Register temp = ToRegister(instr->TempAt(0)); |
| 1631 |
| 1632 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1633 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1634 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1635 |
| 1636 Condition true_cond = EmitIsString(reg, temp, false_label); |
| 1637 |
| 1638 EmitBranch(true_block, false_block, true_cond); |
| 1639 } |
| 1640 |
| 1641 |
| 1617 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { | 1642 void LCodeGen::DoIsSmiAndBranch(LIsSmiAndBranch* instr) { |
| 1618 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1643 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1619 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1644 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1620 | 1645 |
| 1621 Condition is_smi; | 1646 Condition is_smi; |
| 1622 if (instr->InputAt(0)->IsRegister()) { | 1647 if (instr->InputAt(0)->IsRegister()) { |
| 1623 Register input = ToRegister(instr->InputAt(0)); | 1648 Register input = ToRegister(instr->InputAt(0)); |
| 1624 is_smi = masm()->CheckSmi(input); | 1649 is_smi = masm()->CheckSmi(input); |
| 1625 } else { | 1650 } else { |
| 1626 Operand input = ToOperand(instr->InputAt(0)); | 1651 Operand input = ToOperand(instr->InputAt(0)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1638 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1663 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1639 | 1664 |
| 1640 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); | 1665 __ JumpIfSmi(input, chunk_->GetAssemblyLabel(false_block)); |
| 1641 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset)); | 1666 __ movq(temp, FieldOperand(input, HeapObject::kMapOffset)); |
| 1642 __ testb(FieldOperand(temp, Map::kBitFieldOffset), | 1667 __ testb(FieldOperand(temp, Map::kBitFieldOffset), |
| 1643 Immediate(1 << Map::kIsUndetectable)); | 1668 Immediate(1 << Map::kIsUndetectable)); |
| 1644 EmitBranch(true_block, false_block, not_zero); | 1669 EmitBranch(true_block, false_block, not_zero); |
| 1645 } | 1670 } |
| 1646 | 1671 |
| 1647 | 1672 |
| 1673 void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { |
| 1674 Token::Value op = instr->op(); |
| 1675 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1676 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1677 |
| 1678 Handle<Code> ic = CompareIC::GetUninitialized(op); |
| 1679 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 1680 |
| 1681 Condition condition = TokenToCondition(op, false); |
| 1682 __ testq(rax, rax); |
| 1683 |
| 1684 EmitBranch(true_block, false_block, condition); |
| 1685 } |
| 1686 |
| 1687 |
| 1648 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { | 1688 static InstanceType TestType(HHasInstanceTypeAndBranch* instr) { |
| 1649 InstanceType from = instr->from(); | 1689 InstanceType from = instr->from(); |
| 1650 InstanceType to = instr->to(); | 1690 InstanceType to = instr->to(); |
| 1651 if (from == FIRST_TYPE) return to; | 1691 if (from == FIRST_TYPE) return to; |
| 1652 ASSERT(from == to || to == LAST_TYPE); | 1692 ASSERT(from == to || to == LAST_TYPE); |
| 1653 return from; | 1693 return from; |
| 1654 } | 1694 } |
| 1655 | 1695 |
| 1656 | 1696 |
| 1657 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { | 1697 static Condition BranchCondition(HHasInstanceTypeAndBranch* instr) { |
| (...skipping 2590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4248 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); | 4288 RegisterEnvironmentForDeoptimization(environment, Safepoint::kNoLazyDeopt); |
| 4249 ASSERT(osr_pc_offset_ == -1); | 4289 ASSERT(osr_pc_offset_ == -1); |
| 4250 osr_pc_offset_ = masm()->pc_offset(); | 4290 osr_pc_offset_ = masm()->pc_offset(); |
| 4251 } | 4291 } |
| 4252 | 4292 |
| 4253 #undef __ | 4293 #undef __ |
| 4254 | 4294 |
| 4255 } } // namespace v8::internal | 4295 } } // namespace v8::internal |
| 4256 | 4296 |
| 4257 #endif // V8_TARGET_ARCH_X64 | 4297 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |