| 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 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); | 1630 __ mov(scratch, FieldOperand(reg, HeapObject::kMapOffset)); |
| 1631 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); | 1631 __ movzx_b(scratch, FieldOperand(scratch, Map::kBitFieldOffset)); |
| 1632 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); | 1632 __ test(scratch, Immediate(1 << Map::kIsUndetectable)); |
| 1633 EmitBranch(true_block, false_block, not_zero); | 1633 EmitBranch(true_block, false_block, not_zero); |
| 1634 } | 1634 } |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 | 1637 |
| 1638 Condition LCodeGen::EmitIsObject(Register input, | 1638 Condition LCodeGen::EmitIsObject(Register input, |
| 1639 Register temp1, | 1639 Register temp1, |
| 1640 Register temp2, | |
| 1641 Label* is_not_object, | 1640 Label* is_not_object, |
| 1642 Label* is_object) { | 1641 Label* is_object) { |
| 1643 ASSERT(!input.is(temp1)); | |
| 1644 ASSERT(!input.is(temp2)); | |
| 1645 ASSERT(!temp1.is(temp2)); | |
| 1646 | |
| 1647 __ JumpIfSmi(input, is_not_object); | 1642 __ JumpIfSmi(input, is_not_object); |
| 1648 | 1643 |
| 1649 __ cmp(input, isolate()->factory()->null_value()); | 1644 __ cmp(input, isolate()->factory()->null_value()); |
| 1650 __ j(equal, is_object); | 1645 __ j(equal, is_object); |
| 1651 | 1646 |
| 1652 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); | 1647 __ mov(temp1, FieldOperand(input, HeapObject::kMapOffset)); |
| 1653 // Undetectable objects behave like undefined. | 1648 // Undetectable objects behave like undefined. |
| 1654 __ movzx_b(temp2, FieldOperand(temp1, Map::kBitFieldOffset)); | 1649 __ test_b(FieldOperand(temp1, Map::kBitFieldOffset), |
| 1655 __ test(temp2, Immediate(1 << Map::kIsUndetectable)); | 1650 1 << Map::kIsUndetectable); |
| 1656 __ j(not_zero, is_not_object); | 1651 __ j(not_zero, is_not_object); |
| 1657 | 1652 |
| 1658 __ movzx_b(temp2, FieldOperand(temp1, Map::kInstanceTypeOffset)); | 1653 __ movzx_b(temp1, FieldOperand(temp1, Map::kInstanceTypeOffset)); |
| 1659 __ cmp(temp2, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); | 1654 __ cmp(temp1, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 1660 __ j(below, is_not_object); | 1655 __ j(below, is_not_object); |
| 1661 __ cmp(temp2, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); | 1656 __ cmp(temp1, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); |
| 1662 return below_equal; | 1657 return below_equal; |
| 1663 } | 1658 } |
| 1664 | 1659 |
| 1665 | 1660 |
| 1666 void LCodeGen::DoIsObject(LIsObject* instr) { | 1661 void LCodeGen::DoIsObject(LIsObject* instr) { |
| 1667 Register reg = ToRegister(instr->InputAt(0)); | 1662 Register reg = ToRegister(instr->InputAt(0)); |
| 1668 Register result = ToRegister(instr->result()); | 1663 Register result = ToRegister(instr->result()); |
| 1669 Register temp = ToRegister(instr->TempAt(0)); | |
| 1670 Label is_false, is_true, done; | 1664 Label is_false, is_true, done; |
| 1671 | 1665 |
| 1672 Condition true_cond = EmitIsObject(reg, result, temp, &is_false, &is_true); | 1666 Condition true_cond = EmitIsObject(reg, result, &is_false, &is_true); |
| 1673 __ j(true_cond, &is_true); | 1667 __ j(true_cond, &is_true); |
| 1674 | 1668 |
| 1675 __ bind(&is_false); | 1669 __ bind(&is_false); |
| 1676 __ mov(result, factory()->false_value()); | 1670 __ mov(result, factory()->false_value()); |
| 1677 __ jmp(&done); | 1671 __ jmp(&done); |
| 1678 | 1672 |
| 1679 __ bind(&is_true); | 1673 __ bind(&is_true); |
| 1680 __ mov(result, factory()->true_value()); | 1674 __ mov(result, factory()->true_value()); |
| 1681 | 1675 |
| 1682 __ bind(&done); | 1676 __ bind(&done); |
| 1683 } | 1677 } |
| 1684 | 1678 |
| 1685 | 1679 |
| 1686 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { | 1680 void LCodeGen::DoIsObjectAndBranch(LIsObjectAndBranch* instr) { |
| 1687 Register reg = ToRegister(instr->InputAt(0)); | 1681 Register reg = ToRegister(instr->InputAt(0)); |
| 1688 Register temp = ToRegister(instr->TempAt(0)); | 1682 Register temp = ToRegister(instr->TempAt(0)); |
| 1689 Register temp2 = ToRegister(instr->TempAt(1)); | |
| 1690 | 1683 |
| 1691 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1684 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
| 1692 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1685 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
| 1693 Label* true_label = chunk_->GetAssemblyLabel(true_block); | 1686 Label* true_label = chunk_->GetAssemblyLabel(true_block); |
| 1694 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1687 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
| 1695 | 1688 |
| 1696 Condition true_cond = EmitIsObject(reg, temp, temp2, false_label, true_label); | 1689 Condition true_cond = EmitIsObject(reg, temp, false_label, true_label); |
| 1697 | 1690 |
| 1698 EmitBranch(true_block, false_block, true_cond); | 1691 EmitBranch(true_block, false_block, true_cond); |
| 1699 } | 1692 } |
| 1700 | 1693 |
| 1701 | 1694 |
| 1702 void LCodeGen::DoIsSmi(LIsSmi* instr) { | 1695 void LCodeGen::DoIsSmi(LIsSmi* instr) { |
| 1703 Operand input = ToOperand(instr->InputAt(0)); | 1696 Operand input = ToOperand(instr->InputAt(0)); |
| 1704 Register result = ToRegister(instr->result()); | 1697 Register result = ToRegister(instr->result()); |
| 1705 | 1698 |
| 1706 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1699 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
| (...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4468 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4461 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 4469 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4462 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
| 4470 } | 4463 } |
| 4471 | 4464 |
| 4472 | 4465 |
| 4473 #undef __ | 4466 #undef __ |
| 4474 | 4467 |
| 4475 } } // namespace v8::internal | 4468 } } // namespace v8::internal |
| 4476 | 4469 |
| 4477 #endif // V8_TARGET_ARCH_IA32 | 4470 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |