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 3815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3826 | 3826 |
3827 // Name is always in r2. | 3827 // Name is always in r2. |
3828 __ mov(r2, Operand(instr->name())); | 3828 __ mov(r2, Operand(instr->name())); |
3829 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3829 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3830 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3830 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3831 : isolate()->builtins()->StoreIC_Initialize(); | 3831 : isolate()->builtins()->StoreIC_Initialize(); |
3832 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3832 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3833 } | 3833 } |
3834 | 3834 |
3835 | 3835 |
| 3836 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
| 3837 HValue* value, |
| 3838 LOperand* operand) { |
| 3839 if (value->representation().IsTagged() && !value->type().IsSmi()) { |
| 3840 if (operand->IsRegister()) { |
| 3841 __ tst(ToRegister(operand), Operand(kSmiTagMask)); |
| 3842 } else { |
| 3843 __ mov(ip, ToOperand(operand)); |
| 3844 __ tst(ip, Operand(kSmiTagMask)); |
| 3845 } |
| 3846 DeoptimizeIf(ne, environment); |
| 3847 } |
| 3848 } |
| 3849 |
| 3850 |
3836 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3851 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3852 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3853 instr->hydrogen()->length(), |
| 3854 instr->length()); |
| 3855 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3856 instr->hydrogen()->index(), |
| 3857 instr->index()); |
3837 if (instr->index()->IsConstantOperand()) { | 3858 if (instr->index()->IsConstantOperand()) { |
3838 int constant_index = | 3859 int constant_index = |
3839 ToInteger32(LConstantOperand::cast(instr->index())); | 3860 ToInteger32(LConstantOperand::cast(instr->index())); |
3840 if (instr->hydrogen()->length()->representation().IsTagged()) { | 3861 if (instr->hydrogen()->length()->representation().IsTagged()) { |
3841 __ mov(ip, Operand(Smi::FromInt(constant_index))); | 3862 __ mov(ip, Operand(Smi::FromInt(constant_index))); |
3842 } else { | 3863 } else { |
3843 __ mov(ip, Operand(constant_index)); | 3864 __ mov(ip, Operand(constant_index)); |
3844 } | 3865 } |
3845 __ cmp(ip, ToRegister(instr->length())); | 3866 __ cmp(ip, ToRegister(instr->length())); |
3846 } else { | 3867 } else { |
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5470 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); | 5491 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); |
5471 __ ldr(result, FieldMemOperand(scratch, | 5492 __ ldr(result, FieldMemOperand(scratch, |
5472 FixedArray::kHeaderSize - kPointerSize)); | 5493 FixedArray::kHeaderSize - kPointerSize)); |
5473 __ bind(&done); | 5494 __ bind(&done); |
5474 } | 5495 } |
5475 | 5496 |
5476 | 5497 |
5477 #undef __ | 5498 #undef __ |
5478 | 5499 |
5479 } } // namespace v8::internal | 5500 } } // namespace v8::internal |
OLD | NEW |