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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1624 | 1624 |
1625 Label* false_label = chunk_->GetAssemblyLabel(false_block); | 1625 Label* false_label = chunk_->GetAssemblyLabel(false_block); |
1626 | 1626 |
1627 __ JumpIfSmi(input, false_label); | 1627 __ JumpIfSmi(input, false_label); |
1628 | 1628 |
1629 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); | 1629 __ CmpObjectType(input, TestType(instr->hydrogen()), kScratchRegister); |
1630 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); | 1630 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); |
1631 } | 1631 } |
1632 | 1632 |
1633 | 1633 |
| 1634 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
| 1635 Register input = ToRegister(instr->InputAt(0)); |
| 1636 Register result = ToRegister(instr->result()); |
| 1637 |
| 1638 if (FLAG_debug_code) { |
| 1639 __ AbortIfNotString(input); |
| 1640 } |
| 1641 |
| 1642 __ movl(result, FieldOperand(input, String::kHashFieldOffset)); |
| 1643 ASSERT(String::kHashShift >= kSmiTagSize); |
| 1644 __ IndexFromHash(result, result); |
| 1645 } |
| 1646 |
| 1647 |
1634 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { | 1648 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { |
1635 Register input = ToRegister(instr->InputAt(0)); | 1649 Register input = ToRegister(instr->InputAt(0)); |
1636 Register result = ToRegister(instr->result()); | 1650 Register result = ToRegister(instr->result()); |
1637 | 1651 |
1638 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1652 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
1639 __ LoadRoot(result, Heap::kTrueValueRootIndex); | 1653 __ LoadRoot(result, Heap::kTrueValueRootIndex); |
1640 __ testl(FieldOperand(input, String::kHashFieldOffset), | 1654 __ testl(FieldOperand(input, String::kHashFieldOffset), |
1641 Immediate(String::kContainsCachedArrayIndexMask)); | 1655 Immediate(String::kContainsCachedArrayIndexMask)); |
1642 NearLabel done; | 1656 NearLabel done; |
1643 __ j(not_zero, &done); | 1657 __ j(zero, &done); |
1644 __ LoadRoot(result, Heap::kFalseValueRootIndex); | 1658 __ LoadRoot(result, Heap::kFalseValueRootIndex); |
1645 __ bind(&done); | 1659 __ bind(&done); |
1646 } | 1660 } |
1647 | 1661 |
1648 | 1662 |
1649 void LCodeGen::DoHasCachedArrayIndexAndBranch( | 1663 void LCodeGen::DoHasCachedArrayIndexAndBranch( |
1650 LHasCachedArrayIndexAndBranch* instr) { | 1664 LHasCachedArrayIndexAndBranch* instr) { |
1651 Register input = ToRegister(instr->InputAt(0)); | 1665 Register input = ToRegister(instr->InputAt(0)); |
1652 | 1666 |
1653 int true_block = chunk_->LookupDestination(instr->true_block_id()); | 1667 int true_block = chunk_->LookupDestination(instr->true_block_id()); |
1654 int false_block = chunk_->LookupDestination(instr->false_block_id()); | 1668 int false_block = chunk_->LookupDestination(instr->false_block_id()); |
1655 | 1669 |
1656 __ testl(FieldOperand(input, String::kHashFieldOffset), | 1670 __ testl(FieldOperand(input, String::kHashFieldOffset), |
1657 Immediate(String::kContainsCachedArrayIndexMask)); | 1671 Immediate(String::kContainsCachedArrayIndexMask)); |
1658 EmitBranch(true_block, false_block, not_equal); | 1672 EmitBranch(true_block, false_block, equal); |
1659 } | 1673 } |
1660 | 1674 |
1661 | 1675 |
1662 // Branches to a label or falls through with the answer in the z flag. | 1676 // Branches to a label or falls through with the answer in the z flag. |
1663 // Trashes the temp register and possibly input (if it and temp are aliased). | 1677 // Trashes the temp register and possibly input (if it and temp are aliased). |
1664 void LCodeGen::EmitClassOfTest(Label* is_true, | 1678 void LCodeGen::EmitClassOfTest(Label* is_true, |
1665 Label* is_false, | 1679 Label* is_false, |
1666 Handle<String> class_name, | 1680 Handle<String> class_name, |
1667 Register input, | 1681 Register input, |
1668 Register temp) { | 1682 Register temp) { |
(...skipping 1961 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3630 RegisterEnvironmentForDeoptimization(environment); | 3644 RegisterEnvironmentForDeoptimization(environment); |
3631 ASSERT(osr_pc_offset_ == -1); | 3645 ASSERT(osr_pc_offset_ == -1); |
3632 osr_pc_offset_ = masm()->pc_offset(); | 3646 osr_pc_offset_ = masm()->pc_offset(); |
3633 } | 3647 } |
3634 | 3648 |
3635 #undef __ | 3649 #undef __ |
3636 | 3650 |
3637 } } // namespace v8::internal | 3651 } } // namespace v8::internal |
3638 | 3652 |
3639 #endif // V8_TARGET_ARCH_X64 | 3653 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |