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 3809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3820 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { | 3820 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
3821 LOperand* input = instr->InputAt(0); | 3821 LOperand* input = instr->InputAt(0); |
3822 __ test(ToRegister(input), Immediate(kSmiTagMask)); | 3822 __ test(ToRegister(input), Immediate(kSmiTagMask)); |
3823 DeoptimizeIf(zero, instr->environment()); | 3823 DeoptimizeIf(zero, instr->environment()); |
3824 } | 3824 } |
3825 | 3825 |
3826 | 3826 |
3827 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 3827 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
3828 Register input = ToRegister(instr->InputAt(0)); | 3828 Register input = ToRegister(instr->InputAt(0)); |
3829 Register temp = ToRegister(instr->TempAt(0)); | 3829 Register temp = ToRegister(instr->TempAt(0)); |
3830 InstanceType first = instr->hydrogen()->first(); | |
3831 InstanceType last = instr->hydrogen()->last(); | |
3832 | 3830 |
3833 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); | 3831 __ mov(temp, FieldOperand(input, HeapObject::kMapOffset)); |
3834 | 3832 |
3835 // If there is only one type in the interval check for equality. | 3833 if (instr->hydrogen()->is_range()) { |
3836 if (first == last) { | 3834 InstanceType first = instr->hydrogen()->first(); |
| 3835 InstanceType last = instr->hydrogen()->last(); |
| 3836 |
3837 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 3837 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
3838 static_cast<int8_t>(first)); | 3838 static_cast<int8_t>(first)); |
3839 DeoptimizeIf(not_equal, instr->environment()); | 3839 |
3840 } else if (first == FIRST_STRING_TYPE && last == LAST_STRING_TYPE) { | 3840 // If there is only one type in the interval check for equality. |
3841 // String has a dedicated bit in instance type. | 3841 if (first == last) { |
3842 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), kIsNotStringMask); | 3842 DeoptimizeIf(not_equal, instr->environment()); |
3843 DeoptimizeIf(not_zero, instr->environment()); | 3843 } else { |
3844 } else { | 3844 DeoptimizeIf(below, instr->environment()); |
3845 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 3845 // Omit check for the last type. |
3846 static_cast<int8_t>(first)); | 3846 if (last != LAST_TYPE) { |
3847 DeoptimizeIf(below, instr->environment()); | 3847 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
3848 // Omit check for the last type. | 3848 static_cast<int8_t>(last)); |
3849 if (last != LAST_TYPE) { | 3849 DeoptimizeIf(above, instr->environment()); |
3850 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 3850 } |
3851 static_cast<int8_t>(last)); | 3851 } |
3852 DeoptimizeIf(above, instr->environment()); | 3852 } else { |
| 3853 uint8_t mask = instr->hydrogen()->mask(); |
| 3854 uint8_t tag = instr->hydrogen()->tag(); |
| 3855 |
| 3856 if (IsPowerOf2(mask)) { |
| 3857 ASSERT(tag == 0 || IsPowerOf2(tag)); |
| 3858 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); |
| 3859 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
| 3860 } else { |
| 3861 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); |
| 3862 __ and_(temp, mask); |
| 3863 __ cmpb(Operand(temp), tag); |
| 3864 DeoptimizeIf(not_equal, instr->environment()); |
3853 } | 3865 } |
3854 } | 3866 } |
3855 } | 3867 } |
3856 | 3868 |
3857 | 3869 |
3858 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 3870 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
3859 ASSERT(instr->InputAt(0)->IsRegister()); | 3871 ASSERT(instr->InputAt(0)->IsRegister()); |
3860 Register reg = ToRegister(instr->InputAt(0)); | 3872 Register reg = ToRegister(instr->InputAt(0)); |
3861 __ cmp(reg, instr->hydrogen()->target()); | 3873 __ cmp(reg, instr->hydrogen()->target()); |
3862 DeoptimizeIf(not_equal, instr->environment()); | 3874 DeoptimizeIf(not_equal, instr->environment()); |
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 4317 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
4306 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); | 4318 __ InvokeBuiltin(Builtins::IN, CALL_FUNCTION, safepoint_generator); |
4307 } | 4319 } |
4308 | 4320 |
4309 | 4321 |
4310 #undef __ | 4322 #undef __ |
4311 | 4323 |
4312 } } // namespace v8::internal | 4324 } } // namespace v8::internal |
4313 | 4325 |
4314 #endif // V8_TARGET_ARCH_IA32 | 4326 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |