| 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 3626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3637 | 3637 |
| 3638 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { | 3638 void LCodeGen::DoCheckNonSmi(LCheckNonSmi* instr) { |
| 3639 LOperand* input = instr->InputAt(0); | 3639 LOperand* input = instr->InputAt(0); |
| 3640 Condition cc = masm()->CheckSmi(ToRegister(input)); | 3640 Condition cc = masm()->CheckSmi(ToRegister(input)); |
| 3641 DeoptimizeIf(cc, instr->environment()); | 3641 DeoptimizeIf(cc, instr->environment()); |
| 3642 } | 3642 } |
| 3643 | 3643 |
| 3644 | 3644 |
| 3645 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { | 3645 void LCodeGen::DoCheckInstanceType(LCheckInstanceType* instr) { |
| 3646 Register input = ToRegister(instr->InputAt(0)); | 3646 Register input = ToRegister(instr->InputAt(0)); |
| 3647 InstanceType first = instr->hydrogen()->first(); | |
| 3648 InstanceType last = instr->hydrogen()->last(); | |
| 3649 | 3647 |
| 3650 __ movq(kScratchRegister, FieldOperand(input, HeapObject::kMapOffset)); | 3648 __ movq(kScratchRegister, FieldOperand(input, HeapObject::kMapOffset)); |
| 3651 | 3649 |
| 3652 // If there is only one type in the interval check for equality. | 3650 if (instr->hydrogen()->is_range()) { |
| 3653 if (first == last) { | 3651 InstanceType first = instr->hydrogen()->first(); |
| 3652 InstanceType last = instr->hydrogen()->last(); |
| 3653 |
| 3654 __ cmpb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), | 3654 __ cmpb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), |
| 3655 Immediate(static_cast<int8_t>(first))); | 3655 Immediate(static_cast<int8_t>(first))); |
| 3656 DeoptimizeIf(not_equal, instr->environment()); | 3656 |
| 3657 } else if (first == FIRST_STRING_TYPE && last == LAST_STRING_TYPE) { | 3657 // If there is only one type in the interval check for equality. |
| 3658 // String has a dedicated bit in instance type. | 3658 if (first == last) { |
| 3659 __ testb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), | 3659 DeoptimizeIf(not_equal, instr->environment()); |
| 3660 Immediate(kIsNotStringMask)); | 3660 } else { |
| 3661 DeoptimizeIf(not_zero, instr->environment()); | 3661 DeoptimizeIf(below, instr->environment()); |
| 3662 // Omit check for the last type. |
| 3663 if (last != LAST_TYPE) { |
| 3664 __ cmpb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), |
| 3665 Immediate(static_cast<int8_t>(last))); |
| 3666 DeoptimizeIf(above, instr->environment()); |
| 3667 } |
| 3668 } |
| 3662 } else { | 3669 } else { |
| 3663 __ cmpb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), | 3670 uint8_t mask = instr->hydrogen()->mask(); |
| 3664 Immediate(static_cast<int8_t>(first))); | 3671 uint8_t tag = instr->hydrogen()->tag(); |
| 3665 DeoptimizeIf(below, instr->environment()); | 3672 if (IsPowerOf2(mask)) { |
| 3666 // Omit check for the last type. | 3673 ASSERT(tag == 0 || IsPowerOf2(tag)); |
| 3667 if (last != LAST_TYPE) { | 3674 __ testb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), |
| 3668 __ cmpb(FieldOperand(kScratchRegister, Map::kInstanceTypeOffset), | 3675 Immediate(mask)); |
| 3669 Immediate(static_cast<int8_t>(last))); | 3676 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
| 3670 DeoptimizeIf(above, instr->environment()); | 3677 } else { |
| 3678 __ movzxbl(kScratchRegister, |
| 3679 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset)); |
| 3680 __ andb(kScratchRegister, Immediate(mask)); |
| 3681 __ cmpb(kScratchRegister, Immediate(tag)); |
| 3682 DeoptimizeIf(not_equal, instr->environment()); |
| 3671 } | 3683 } |
| 3672 } | 3684 } |
| 3673 } | 3685 } |
| 3674 | 3686 |
| 3675 | 3687 |
| 3676 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { | 3688 void LCodeGen::DoCheckFunction(LCheckFunction* instr) { |
| 3677 ASSERT(instr->InputAt(0)->IsRegister()); | 3689 ASSERT(instr->InputAt(0)->IsRegister()); |
| 3678 Register reg = ToRegister(instr->InputAt(0)); | 3690 Register reg = ToRegister(instr->InputAt(0)); |
| 3679 __ Cmp(reg, instr->hydrogen()->target()); | 3691 __ Cmp(reg, instr->hydrogen()->target()); |
| 3680 DeoptimizeIf(not_equal, instr->environment()); | 3692 DeoptimizeIf(not_equal, instr->environment()); |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4102 RegisterEnvironmentForDeoptimization(environment); | 4114 RegisterEnvironmentForDeoptimization(environment); |
| 4103 ASSERT(osr_pc_offset_ == -1); | 4115 ASSERT(osr_pc_offset_ == -1); |
| 4104 osr_pc_offset_ = masm()->pc_offset(); | 4116 osr_pc_offset_ = masm()->pc_offset(); |
| 4105 } | 4117 } |
| 4106 | 4118 |
| 4107 #undef __ | 4119 #undef __ |
| 4108 | 4120 |
| 4109 } } // namespace v8::internal | 4121 } } // namespace v8::internal |
| 4110 | 4122 |
| 4111 #endif // V8_TARGET_ARCH_X64 | 4123 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |