| 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 3851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3862 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { | 3862 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
| 3863 LOperand* input = instr->InputAt(0); | 3863 LOperand* input = instr->InputAt(0); |
| 3864 __ tst(ToRegister(input), Operand(kSmiTagMask)); | 3864 __ tst(ToRegister(input), Operand(kSmiTagMask)); |
| 3865 DeoptimizeIf(eq, instr->environment()); | 3865 DeoptimizeIf(eq, instr->environment()); |
| 3866 } | 3866 } |
| 3867 | 3867 |
| 3868 | 3868 |
| 3869 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 3869 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
| 3870 Register input = ToRegister(instr->InputAt(0)); | 3870 Register input = ToRegister(instr->InputAt(0)); |
| 3871 Register scratch = scratch0(); | 3871 Register scratch = scratch0(); |
| 3872 InstanceType first = instr->hydrogen()->first(); | |
| 3873 InstanceType last = instr->hydrogen()->last(); | |
| 3874 | 3872 |
| 3875 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 3873 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
| 3876 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); | 3874 __ ldrb(scratch, FieldMemOperand(scratch, Map::kInstanceTypeOffset)); |
| 3877 __ cmp(scratch, Operand(first)); | |
| 3878 | 3875 |
| 3879 // If there is only one type in the interval check for equality. | 3876 if (instr->hydrogen()->is_interval_check()) { |
| 3880 if (first == last) { | 3877 InstanceType first; |
| 3881 DeoptimizeIf(ne, instr->environment()); | 3878 InstanceType last; |
| 3879 instr->hydrogen()->GetCheckInterval(&first, &last); |
| 3880 |
| 3881 __ cmp(scratch, Operand(first)); |
| 3882 |
| 3883 // If there is only one type in the interval check for equality. |
| 3884 if (first == last) { |
| 3885 DeoptimizeIf(ne, instr->environment()); |
| 3886 } else { |
| 3887 DeoptimizeIf(lo, instr->environment()); |
| 3888 // Omit check for the last type. |
| 3889 if (last != LAST_TYPE) { |
| 3890 __ cmp(scratch, Operand(last)); |
| 3891 DeoptimizeIf(hi, instr->environment()); |
| 3892 } |
| 3893 } |
| 3882 } else { | 3894 } else { |
| 3883 DeoptimizeIf(lo, instr->environment()); | 3895 uint8_t mask; |
| 3884 // Omit check for the last type. | 3896 uint8_t tag; |
| 3885 if (last != LAST_TYPE) { | 3897 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
| 3886 __ cmp(scratch, Operand(last)); | 3898 |
| 3887 DeoptimizeIf(hi, instr->environment()); | 3899 if (IsPowerOf2(mask)) { |
| 3900 ASSERT(tag == 0 || IsPowerOf2(tag)); |
| 3901 __ tst(scratch, Operand(mask)); |
| 3902 DeoptimizeIf(tag == 0 ? ne : eq, instr->environment()); |
| 3903 } else { |
| 3904 __ and_(scratch, scratch, Operand(mask)); |
| 3905 __ cmp(scratch, Operand(tag)); |
| 3906 DeoptimizeIf(ne, instr->environment()); |
| 3888 } | 3907 } |
| 3889 } | 3908 } |
| 3890 } | 3909 } |
| 3891 | 3910 |
| 3892 | 3911 |
| 3893 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 3912 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
| 3894 ASSERT(instr->InputAt(0)->IsRegister()); | 3913 ASSERT(instr->InputAt(0)->IsRegister()); |
| 3895 Register reg = ToRegister(instr->InputAt(0)); | 3914 Register reg = ToRegister(instr->InputAt(0)); |
| 3896 __ cmp(reg, Operand(instr->hydrogen()->target())); | 3915 __ cmp(reg, Operand(instr->hydrogen()->target())); |
| 3897 DeoptimizeIf(ne, instr->environment()); | 3916 DeoptimizeIf(ne, instr->environment()); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4311 ASSERT(osr_pc_offset_ == -1); | 4330 ASSERT(osr_pc_offset_ == -1); |
| 4312 osr_pc_offset_ = masm()->pc_offset(); | 4331 osr_pc_offset_ = masm()->pc_offset(); |
| 4313 } | 4332 } |
| 4314 | 4333 |
| 4315 | 4334 |
| 4316 | 4335 |
| 4317 | 4336 |
| 4318 #undef __ | 4337 #undef __ |
| 4319 | 4338 |
| 4320 } } // namespace v8::internal | 4339 } } // namespace v8::internal |
| OLD | NEW |