| 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 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3662 } | 3662 } |
| 3663 | 3663 |
| 3664 | 3664 |
| 3665 Condition LCodeGen::EmitTypeofIs(Label* true_label, | 3665 Condition LCodeGen::EmitTypeofIs(Label* true_label, |
| 3666 Label* false_label, | 3666 Label* false_label, |
| 3667 Register input, | 3667 Register input, |
| 3668 Handle<String> type_name) { | 3668 Handle<String> type_name) { |
| 3669 Condition final_branch_condition = kNoCondition; | 3669 Condition final_branch_condition = kNoCondition; |
| 3670 Register scratch = scratch0(); | 3670 Register scratch = scratch0(); |
| 3671 if (type_name->Equals(Heap::number_symbol())) { | 3671 if (type_name->Equals(Heap::number_symbol())) { |
| 3672 __ tst(input, Operand(kSmiTagMask)); | 3672 __ JumpIfSmi(input, true_label); |
| 3673 __ b(eq, true_label); | |
| 3674 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3673 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3675 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 3674 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
| 3676 __ cmp(input, Operand(ip)); | 3675 __ cmp(input, Operand(ip)); |
| 3677 final_branch_condition = eq; | 3676 final_branch_condition = eq; |
| 3678 | 3677 |
| 3679 } else if (type_name->Equals(Heap::string_symbol())) { | 3678 } else if (type_name->Equals(Heap::string_symbol())) { |
| 3680 __ tst(input, Operand(kSmiTagMask)); | 3679 __ JumpIfSmi(input, false_label); |
| 3681 __ b(eq, false_label); | 3680 __ CompareObjectType(input, input, scratch, FIRST_NONSTRING_TYPE); |
| 3682 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3681 __ b(ge, false_label); |
| 3683 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3682 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3684 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3683 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3685 __ b(ne, false_label); | 3684 final_branch_condition = eq; |
| 3686 __ CompareInstanceType(input, scratch, FIRST_NONSTRING_TYPE); | |
| 3687 final_branch_condition = lo; | |
| 3688 | 3685 |
| 3689 } else if (type_name->Equals(Heap::boolean_symbol())) { | 3686 } else if (type_name->Equals(Heap::boolean_symbol())) { |
| 3690 __ LoadRoot(ip, Heap::kTrueValueRootIndex); | 3687 __ CompareRoot(input, Heap::kTrueValueRootIndex); |
| 3691 __ cmp(input, ip); | |
| 3692 __ b(eq, true_label); | 3688 __ b(eq, true_label); |
| 3693 __ LoadRoot(ip, Heap::kFalseValueRootIndex); | 3689 __ CompareRoot(input, Heap::kFalseValueRootIndex); |
| 3694 __ cmp(input, ip); | |
| 3695 final_branch_condition = eq; | 3690 final_branch_condition = eq; |
| 3696 | 3691 |
| 3697 } else if (type_name->Equals(Heap::undefined_symbol())) { | 3692 } else if (type_name->Equals(Heap::undefined_symbol())) { |
| 3698 __ LoadRoot(ip, Heap::kUndefinedValueRootIndex); | 3693 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); |
| 3699 __ cmp(input, ip); | |
| 3700 __ b(eq, true_label); | 3694 __ b(eq, true_label); |
| 3701 __ tst(input, Operand(kSmiTagMask)); | 3695 __ JumpIfSmi(input, false_label); |
| 3702 __ b(eq, false_label); | |
| 3703 // Check for undetectable objects => true. | 3696 // Check for undetectable objects => true. |
| 3704 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); | 3697 __ ldr(input, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3705 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3698 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3706 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3699 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3707 final_branch_condition = ne; | 3700 final_branch_condition = ne; |
| 3708 | 3701 |
| 3709 } else if (type_name->Equals(Heap::function_symbol())) { | 3702 } else if (type_name->Equals(Heap::function_symbol())) { |
| 3710 __ tst(input, Operand(kSmiTagMask)); | 3703 __ JumpIfSmi(input, false_label); |
| 3711 __ b(eq, false_label); | 3704 __ CompareObjectType(input, input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3712 __ CompareObjectType(input, input, scratch, JS_FUNCTION_TYPE); | 3705 final_branch_condition = ge; |
| 3713 __ b(eq, true_label); | |
| 3714 // Regular expressions => 'function' (they are callable). | |
| 3715 __ CompareInstanceType(input, scratch, JS_REGEXP_TYPE); | |
| 3716 final_branch_condition = eq; | |
| 3717 | 3706 |
| 3718 } else if (type_name->Equals(Heap::object_symbol())) { | 3707 } else if (type_name->Equals(Heap::object_symbol())) { |
| 3719 __ tst(input, Operand(kSmiTagMask)); | 3708 __ JumpIfSmi(input, false_label); |
| 3720 __ b(eq, false_label); | 3709 __ CompareRoot(input, Heap::kNullValueRootIndex); |
| 3721 __ LoadRoot(ip, Heap::kNullValueRootIndex); | |
| 3722 __ cmp(input, ip); | |
| 3723 __ b(eq, true_label); | 3710 __ b(eq, true_label); |
| 3724 // Regular expressions => 'function', not 'object'. | 3711 __ CompareObjectType(input, input, scratch, FIRST_JS_OBJECT_TYPE); |
| 3725 __ CompareObjectType(input, input, scratch, JS_REGEXP_TYPE); | 3712 __ b(lo, false_label); |
| 3726 __ b(eq, false_label); | 3713 __ CompareInstanceType(input, scratch, FIRST_FUNCTION_CLASS_TYPE); |
| 3714 __ b(hs, false_label); |
| 3727 // Check for undetectable objects => false. | 3715 // Check for undetectable objects => false. |
| 3728 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); | 3716 __ ldrb(ip, FieldMemOperand(input, Map::kBitFieldOffset)); |
| 3729 __ tst(ip, Operand(1 << Map::kIsUndetectable)); | 3717 __ tst(ip, Operand(1 << Map::kIsUndetectable)); |
| 3730 __ b(ne, false_label); | 3718 final_branch_condition = eq; |
| 3731 // Check for JS objects => true. | |
| 3732 __ CompareInstanceType(input, scratch, FIRST_JS_OBJECT_TYPE); | |
| 3733 __ b(lo, false_label); | |
| 3734 __ CompareInstanceType(input, scratch, LAST_JS_OBJECT_TYPE); | |
| 3735 final_branch_condition = ls; | |
| 3736 | 3719 |
| 3737 } else { | 3720 } else { |
| 3738 final_branch_condition = ne; | 3721 final_branch_condition = ne; |
| 3739 __ b(false_label); | 3722 __ b(false_label); |
| 3740 // A dead branch instruction will be generated after this point. | 3723 // A dead branch instruction will be generated after this point. |
| 3741 } | 3724 } |
| 3742 | 3725 |
| 3743 return final_branch_condition; | 3726 return final_branch_condition; |
| 3744 } | 3727 } |
| 3745 | 3728 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3847 ASSERT(!environment->HasBeenRegistered()); | 3830 ASSERT(!environment->HasBeenRegistered()); |
| 3848 RegisterEnvironmentForDeoptimization(environment); | 3831 RegisterEnvironmentForDeoptimization(environment); |
| 3849 ASSERT(osr_pc_offset_ == -1); | 3832 ASSERT(osr_pc_offset_ == -1); |
| 3850 osr_pc_offset_ = masm()->pc_offset(); | 3833 osr_pc_offset_ = masm()->pc_offset(); |
| 3851 } | 3834 } |
| 3852 | 3835 |
| 3853 | 3836 |
| 3854 #undef __ | 3837 #undef __ |
| 3855 | 3838 |
| 3856 } } // namespace v8::internal | 3839 } } // namespace v8::internal |
| OLD | NEW |