| 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 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1704 __ b(eq, false_label); | 1704 __ b(eq, false_label); |
| 1705 | 1705 |
| 1706 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen())); | 1706 __ CompareObjectType(input, scratch, scratch, TestType(instr->hydrogen())); |
| 1707 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); | 1707 EmitBranch(true_block, false_block, BranchCondition(instr->hydrogen())); |
| 1708 } | 1708 } |
| 1709 | 1709 |
| 1710 | 1710 |
| 1711 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { | 1711 void LCodeGen::DoGetCachedArrayIndex(LGetCachedArrayIndex* instr) { |
| 1712 Register input = ToRegister(instr->InputAt(0)); | 1712 Register input = ToRegister(instr->InputAt(0)); |
| 1713 Register result = ToRegister(instr->result()); | 1713 Register result = ToRegister(instr->result()); |
| 1714 Register scratch = scratch0(); | |
| 1715 | 1714 |
| 1716 __ ldr(scratch, FieldMemOperand(input, String::kHashFieldOffset)); | 1715 if (FLAG_debug_code) { |
| 1717 __ IndexFromHash(scratch, result); | 1716 __ AbortIfNotString(input); |
| 1717 } |
| 1718 |
| 1719 __ ldr(result, FieldMemOperand(input, String::kHashFieldOffset)); |
| 1720 __ IndexFromHash(result, result); |
| 1718 } | 1721 } |
| 1719 | 1722 |
| 1720 | 1723 |
| 1721 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { | 1724 void LCodeGen::DoHasCachedArrayIndex(LHasCachedArrayIndex* instr) { |
| 1722 Register input = ToRegister(instr->InputAt(0)); | 1725 Register input = ToRegister(instr->InputAt(0)); |
| 1723 Register result = ToRegister(instr->result()); | 1726 Register result = ToRegister(instr->result()); |
| 1724 Register scratch = scratch0(); | 1727 Register scratch = scratch0(); |
| 1725 | 1728 |
| 1726 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); | 1729 ASSERT(instr->hydrogen()->value()->representation().IsTagged()); |
| 1727 __ ldr(scratch, | 1730 __ ldr(scratch, |
| (...skipping 1942 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 } | 3673 } |
| 3671 | 3674 |
| 3672 | 3675 |
| 3673 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3676 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 3674 Label* false_label, | 3677 Label* false_label, |
| 3675 Register input, | 3678 Register input, |
| 3676 Handle<String> type_name) { | 3679 Handle<String> type_name) { |
| 3677 Condition final_branch_condition = kNoCondition; | 3680 Condition final_branch_condition = kNoCondition; |
| 3678 Register scratch = scratch0(); | 3681 Register scratch = scratch0(); |
| 3679 if (type_name->Equals(HEAP->number_symbol())) { | 3682 if (type_name->Equals(HEAP->number_symbol())) { |
| 3680 __ tst(input, Operand(kSmiTagMask)); | 3683 __ JumpIfSmi(input, true_label); |
| 3681 __ b(eq, true_label); | |
| 3682 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3684 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3683 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3685 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3684 __ cmp(input, Operand(ip)); | 3686 __ cmp(input, Operand(ip)); |
| 3685 final_branch_condition = eq; | 3687 final_branch_condition = eq; |
| 3686 | 3688 |
| 3687 } else if (type_name->Equals(HEAP->string_symbol())) { | 3689 } else if (type_name->Equals(HEAP->string_symbol())) { |
| 3688 __ tst(input, Operand(kSmiTagMask)); | 3690 __ JumpIfSmi(input, false_label); |
| 3689 __ b(eq, false_label); | 3691 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); |
| 3690 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3692 __ b(ge, false_label); |
| 3691 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3693 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3692 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3694 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3693 __ b(ne, false_label); | 3695 final_branch_condition = eq; |
| 3694 __ CompareInstanceType(input, scratch, FIRST_NONSTRING_TYPE); | |
| 3695 final_branch_condition = lo; | |
| 3696 | 3696 |
| 3697 } else if (type_name->Equals(HEAP->boolean_symbol())) { | 3697 } else if (type_name->Equals(HEAP->boolean_symbol())) { |
| 3698 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 3698 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
| 3699 __ cmp(input, ip); | |
| 3700 __ b(eq, true_label); | 3699 __ b(eq, true_label); |
| 3701 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 3700 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
| 3702 __ cmp(input, ip); | |
| 3703 final_branch_condition = eq; | 3701 final_branch_condition = eq; |
| 3704 | 3702 |
| 3705 } else if (type_name->Equals(HEAP->undefined_symbol())) { | 3703 } else if (type_name->Equals(HEAP->undefined_symbol())) { |
| 3706 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3704 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
| 3707 __ cmp(input, ip); | |
| 3708 __ b(eq, true_label); | 3705 __ b(eq, true_label); |
| 3709 __ tst(input, Operand(kSmiTagMask)); | 3706 __ JumpIfSmi(input, false_label); |
| 3710 __ b(eq, false_label); | |
| 3711 // Check for undetectable objects => true. | 3707 // Check for undetectable objects => true. |
| 3712 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3708 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3713 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3709 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3714 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3710 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3715 final_branch_condition = ne; | 3711 final_branch_condition = ne; |
| 3716 | 3712 |
| 3717 } else if (type_name->Equals(HEAP->function_symbol())) { | 3713 } else if (type_name->Equals(HEAP->function_symbol())) { |
| 3718 __ tst(input, Operand(kSmiTagMask)); | 3714 __ JumpIfSmi(input, false_label); |
| 3719 __ b(eq, false_label); | 3715 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3720 __ CompareObjectType(input, input, scratch, JS_FUNCTION_TYPE); | 3716 final_branch_condition = ge; |
| 3721 __ b(eq, true_label); | |
| 3722 // Regular expressions => 'function' (they are callable). | |
| 3723 __ CompareInstanceType(input, scratch, JS_REGEXP_TYPE); | |
| 3724 final_branch_condition = eq; | |
| 3725 | 3717 |
| 3726 } else if (type_name->Equals(HEAP->object_symbol())) { | 3718 } else if (type_name->Equals(HEAP->object_symbol())) { |
| 3727 __ tst(input, Operand(kSmiTagMask)); | 3719 __ JumpIfSmi(input, false_label); |
| 3728 __ b(eq, false_label); | 3720 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 3729 __ LoadRoot(ip, Heap::kNullValueRootIndex); | |
| 3730 __ cmp(input, ip); | |
| 3731 __ b(eq, true_label); | 3721 __ b(eq, true_label); |
| 3732 // Regular expressions => 'function', not 'object'. | 3722 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); |
| 3733 __ CompareObjectType(input, input, scratch, JS_REGEXP_TYPE); | 3723 __ b(lo, false_label); |
| 3734 __ b(eq, false_label); | 3724 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3725 __ b(hs, false_label); |
| 3735 // Check for undetectable objects => false. | 3726 // Check for undetectable objects => false. |
| 3736 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3727 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3737 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3728 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3738 __ b(ne, false_label); | 3729 final_branch_condition = eq; |
| 3739 // Check for JS objects => true. | |
| 3740 __ CompareInstanceType(input, scratch, FIRST_JS_OBJECT_TYPE); | |
| 3741 __ b(lo, false_label); | |
| 3742 __ CompareInstanceType(input, scratch, LAST_JS_OBJECT_TYPE); | |
| 3743 final_branch_condition = ls; | |
| 3744 | 3730 |
| 3745 } else { | 3731 } else { |
| 3746 final_branch_condition = ne; | 3732 final_branch_condition = ne; |
| 3747 __ b(false_label); | 3733 __ b(false_label); |
| 3748 // A dead branch instruction will be generated after this point. | 3734 // A dead branch instruction will be generated after this point. |
| 3749 } | 3735 } |
| 3750 | 3736 |
| 3751 return final_branch_condition; | 3737 return final_branch_condition; |
| 3752 } | 3738 } |
| 3753 | 3739 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3855 ASSERT(!environment->HasBeenRegistered()); | 3841 ASSERT(!environment->HasBeenRegistered()); |
| 3856 RegisterEnvironmentForDeoptimization(environment); | 3842 RegisterEnvironmentForDeoptimization(environment); |
| 3857 ASSERT(osr_pc_offset_ == -1); | 3843 ASSERT(osr_pc_offset_ == -1); |
| 3858 osr_pc_offset_ = masm()->pc_offset(); | 3844 osr_pc_offset_ = masm()->pc_offset(); |
| 3859 } | 3845 } |
| 3860 | 3846 |
| 3861 | 3847 |
| 3862 #undef __ | 3848 #undef __ |
| 3863 | 3849 |
| 3864 } } // namespace v8::internal | 3850 } } // namespace v8::internal |
| OLD | NEW |