| 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 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3682 EmitBranch(true_block, false_block, final_branch_condition); | 3682 EmitBranch(true_block, false_block, final_branch_condition); |
| 3683 } | 3683 } |
| 3684 | 3684 |
| 3685 | 3685 |
| 3686 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3686 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 3687 Label* false_label, | 3687 Label* false_label, |
| 3688 Register input, | 3688 Register input, |
| 3689 Handle<String> type_name) { | 3689 Handle<String> type_name) { |
| 3690 Condition final_branch_condition = no_condition; | 3690 Condition final_branch_condition = no_condition; |
| 3691 if (type_name->Equals(Heap::number_symbol())) { | 3691 if (type_name->Equals(Heap::number_symbol())) { |
| 3692 __ test(input, Immediate(kSmiTagMask)); | 3692 __ JumpIfSmi(input, true_label); |
| 3693 __ j(zero, true_label); | |
| 3694 __ cmp(FieldOperand(input, HeapObject::kMapOffset), | 3693 __ cmp(FieldOperand(input, HeapObject::kMapOffset), |
| 3695 Factory::heap_number_map()); | 3694 Factory::heap_number_map()); |
| 3696 final_branch_condition = equal; | 3695 final_branch_condition = equal; |
| 3697 | 3696 |
| 3698 } else if (type_name->Equals(Heap::string_symbol())) { | 3697 } else if (type_name->Equals(Heap::string_symbol())) { |
| 3699 __ test(input, Immediate(kSmiTagMask)); | 3698 __ JumpIfSmi(input, false_label); |
| 3700 __ j(zero, false_label); | 3699 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); |
| 3701 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); | 3700 __ j(above_equal, false_label); |
| 3702 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 3701 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 3703 1 << Map::kIsUndetectable); | 3702 1 << Map::kIsUndetectable); |
| 3704 __ j(not_zero, false_label); | 3703 final_branch_condition = zero; |
| 3705 __ CmpInstanceType(input, FIRST_NONSTRING_TYPE); | |
| 3706 final_branch_condition = below; | |
| 3707 | 3704 |
| 3708 } else if (type_name->Equals(Heap::boolean_symbol())) { | 3705 } else if (type_name->Equals(Heap::boolean_symbol())) { |
| 3709 __ cmp(input, Factory::true_value()); | 3706 __ cmp(input, Factory::true_value()); |
| 3710 __ j(equal, true_label); | 3707 __ j(equal, true_label); |
| 3711 __ cmp(input, Factory::false_value()); | 3708 __ cmp(input, Factory::false_value()); |
| 3712 final_branch_condition = equal; | 3709 final_branch_condition = equal; |
| 3713 | 3710 |
| 3714 } else if (type_name->Equals(Heap::undefined_symbol())) { | 3711 } else if (type_name->Equals(Heap::undefined_symbol())) { |
| 3715 __ cmp(input, Factory::undefined_value()); | 3712 __ cmp(input, Factory::undefined_value()); |
| 3716 __ j(equal, true_label); | 3713 __ j(equal, true_label); |
| 3717 __ test(input, Immediate(kSmiTagMask)); | 3714 __ JumpIfSmi(input, false_label); |
| 3718 __ j(zero, false_label); | |
| 3719 // Check for undetectable objects => true. | 3715 // Check for undetectable objects => true. |
| 3720 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); | 3716 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); |
| 3721 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 3717 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 3722 1 << Map::kIsUndetectable); | 3718 1 << Map::kIsUndetectable); |
| 3723 final_branch_condition = not_zero; | 3719 final_branch_condition = not_zero; |
| 3724 | 3720 |
| 3725 } else if (type_name->Equals(Heap::function_symbol())) { | 3721 } else if (type_name->Equals(Heap::function_symbol())) { |
| 3726 __ test(input, Immediate(kSmiTagMask)); | 3722 __ JumpIfSmi(input, false_label); |
| 3727 __ j(zero, false_label); | |
| 3728 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); | 3723 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); |
| 3729 __ j(equal, true_label); | 3724 __ j(equal, true_label); |
| 3730 // Regular expressions => 'function' (they are callable). | 3725 // Regular expressions => 'function' (they are callable). |
| 3731 __ CmpInstanceType(input, JS_REGEXP_TYPE); | 3726 __ CmpInstanceType(input, JS_REGEXP_TYPE); |
| 3732 final_branch_condition = equal; | 3727 final_branch_condition = equal; |
| 3733 | 3728 |
| 3734 } else if (type_name->Equals(Heap::object_symbol())) { | 3729 } else if (type_name->Equals(Heap::object_symbol())) { |
| 3735 __ test(input, Immediate(kSmiTagMask)); | 3730 __ JumpIfSmi(input, false_label); |
| 3736 __ j(zero, false_label); | |
| 3737 __ cmp(input, Factory::null_value()); | 3731 __ cmp(input, Factory::null_value()); |
| 3738 __ j(equal, true_label); | 3732 __ j(equal, true_label); |
| 3739 // Regular expressions => 'function', not 'object'. | 3733 // Regular expressions => 'function', not 'object'. |
| 3740 __ CmpObjectType(input, JS_REGEXP_TYPE, input); | 3734 __ CmpObjectType(input, FIRST_JS_OBJECT_TYPE, input); |
| 3741 __ j(equal, false_label); | 3735 __ j(below, false_label); |
| 3736 __ CmpInstanceType(input, FIRST_FUNCTION_CLASS_TYPE); |
| 3737 __ j(above_equal, false_label); |
| 3742 // Check for undetectable objects => false. | 3738 // Check for undetectable objects => false. |
| 3743 __ test_b(FieldOperand(input, Map::kBitFieldOffset), | 3739 __ test_b(FieldOperand(input, Map::kBitFieldOffset), |
| 3744 1 << Map::kIsUndetectable); | 3740 1 << Map::kIsUndetectable); |
| 3745 __ j(not_zero, false_label); | 3741 final_branch_condition = zero; |
| 3746 // Check for JS objects => true. | |
| 3747 __ CmpInstanceType(input, FIRST_JS_OBJECT_TYPE); | |
| 3748 __ j(below, false_label); | |
| 3749 __ CmpInstanceType(input, LAST_JS_OBJECT_TYPE); | |
| 3750 final_branch_condition = below_equal; | |
| 3751 | 3742 |
| 3752 } else { | 3743 } else { |
| 3753 final_branch_condition = not_equal; | 3744 final_branch_condition = not_equal; |
| 3754 __ jmp(false_label); | 3745 __ jmp(false_label); |
| 3755 // A dead branch instruction will be generated after this point. | 3746 // A dead branch instruction will be generated after this point. |
| 3756 } | 3747 } |
| 3757 | 3748 |
| 3758 return final_branch_condition; | 3749 return final_branch_condition; |
| 3759 } | 3750 } |
| 3760 | 3751 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3872 ASSERT(osr_pc_offset_ == -1); | 3863 ASSERT(osr_pc_offset_ == -1); |
| 3873 osr_pc_offset_ = masm()->pc_offset(); | 3864 osr_pc_offset_ = masm()->pc_offset(); |
| 3874 } | 3865 } |
| 3875 | 3866 |
| 3876 | 3867 |
| 3877 #undef __ | 3868 #undef __ |
| 3878 | 3869 |
| 3879 } } // namespace v8::internal | 3870 } } // namespace v8::internal |
| 3880 | 3871 |
| 3881 #endif // V8_TARGET_ARCH_IA32 | 3872 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |