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