OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3612 case FAST_HOLEY_DOUBLE_ELEMENTS: | 3612 case FAST_HOLEY_DOUBLE_ELEMENTS: |
3613 case DICTIONARY_ELEMENTS: | 3613 case DICTIONARY_ELEMENTS: |
3614 case NON_STRICT_ARGUMENTS_ELEMENTS: | 3614 case NON_STRICT_ARGUMENTS_ELEMENTS: |
3615 UNREACHABLE(); | 3615 UNREACHABLE(); |
3616 break; | 3616 break; |
3617 } | 3617 } |
3618 } | 3618 } |
3619 } | 3619 } |
3620 | 3620 |
3621 | 3621 |
| 3622 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
| 3623 HValue* value, |
| 3624 LOperand* operand) { |
| 3625 if (value->representation().IsTagged() && !value->type().IsSmi()) { |
| 3626 Condition cc; |
| 3627 if (operand->IsRegister()) { |
| 3628 cc = masm()->CheckSmi(ToRegister(operand)); |
| 3629 } else { |
| 3630 cc = masm()->CheckSmi(ToOperand(operand)); |
| 3631 } |
| 3632 DeoptimizeIf(NegateCondition(cc), environment); |
| 3633 } |
| 3634 } |
| 3635 |
| 3636 |
3622 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3637 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3638 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3639 instr->hydrogen()->length(), |
| 3640 instr->length()); |
| 3641 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3642 instr->hydrogen()->index(), |
| 3643 instr->index()); |
3623 if (instr->length()->IsRegister()) { | 3644 if (instr->length()->IsRegister()) { |
3624 Register reg = ToRegister(instr->length()); | 3645 Register reg = ToRegister(instr->length()); |
3625 if (FLAG_debug_code && | 3646 if (FLAG_debug_code && |
3626 !instr->hydrogen()->length()->representation().IsTagged()) { | 3647 !instr->hydrogen()->length()->representation().IsTagged()) { |
3627 __ AbortIfNotZeroExtended(reg); | 3648 __ AbortIfNotZeroExtended(reg); |
3628 } | 3649 } |
3629 if (instr->index()->IsConstantOperand()) { | 3650 if (instr->index()->IsConstantOperand()) { |
3630 int constant_index = | 3651 int constant_index = |
3631 ToInteger32(LConstantOperand::cast(instr->index())); | 3652 ToInteger32(LConstantOperand::cast(instr->index())); |
3632 if (instr->hydrogen()->length()->representation().IsTagged()) { | 3653 if (instr->hydrogen()->length()->representation().IsTagged()) { |
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5100 FixedArray::kHeaderSize - kPointerSize)); | 5121 FixedArray::kHeaderSize - kPointerSize)); |
5101 __ bind(&done); | 5122 __ bind(&done); |
5102 } | 5123 } |
5103 | 5124 |
5104 | 5125 |
5105 #undef __ | 5126 #undef __ |
5106 | 5127 |
5107 } } // namespace v8::internal | 5128 } } // namespace v8::internal |
5108 | 5129 |
5109 #endif // V8_TARGET_ARCH_X64 | 5130 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |