OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 3906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3917 ASSERT(ToRegister(instr->value()).is(rax)); | 3917 ASSERT(ToRegister(instr->value()).is(rax)); |
3918 | 3918 |
3919 __ Move(rcx, instr->hydrogen()->name()); | 3919 __ Move(rcx, instr->hydrogen()->name()); |
3920 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3920 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3921 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3921 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3922 : isolate()->builtins()->StoreIC_Initialize(); | 3922 : isolate()->builtins()->StoreIC_Initialize(); |
3923 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3923 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3924 } | 3924 } |
3925 | 3925 |
3926 | 3926 |
3927 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, | |
3928 HValue* value, | |
3929 LOperand* operand) { | |
3930 if (value->representation().IsTagged() && !value->type().IsSmi()) { | |
3931 Condition cc; | |
3932 if (operand->IsRegister()) { | |
3933 cc = masm()->CheckSmi(ToRegister(operand)); | |
3934 } else { | |
3935 cc = masm()->CheckSmi(ToOperand(operand)); | |
3936 } | |
3937 DeoptimizeIf(NegateCondition(cc), environment); | |
3938 } | |
3939 } | |
3940 | |
3941 | |
3942 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3927 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3943 DeoptIfTaggedButNotSmi(instr->environment(), | 3928 if (instr->hydrogen()->skip_check()) return; |
3944 instr->hydrogen()->length(), | 3929 |
3945 instr->length()); | |
3946 DeoptIfTaggedButNotSmi(instr->environment(), | |
3947 instr->hydrogen()->index(), | |
3948 instr->index()); | |
3949 if (instr->length()->IsRegister()) { | 3930 if (instr->length()->IsRegister()) { |
3950 Register reg = ToRegister(instr->length()); | 3931 Register reg = ToRegister(instr->length()); |
3951 if (!instr->hydrogen()->length()->representation().IsTagged()) { | 3932 if (!instr->hydrogen()->length()->representation().IsTagged()) { |
3952 __ AssertZeroExtended(reg); | 3933 __ AssertZeroExtended(reg); |
3953 } | 3934 } |
3954 if (instr->index()->IsConstantOperand()) { | 3935 if (instr->index()->IsConstantOperand()) { |
3955 int constant_index = | 3936 int constant_index = |
3956 ToInteger32(LConstantOperand::cast(instr->index())); | 3937 ToInteger32(LConstantOperand::cast(instr->index())); |
3957 if (instr->hydrogen()->length()->representation().IsTagged()) { | 3938 if (instr->hydrogen()->length()->representation().IsTagged()) { |
3958 __ Cmp(reg, Smi::FromInt(constant_index)); | 3939 __ Cmp(reg, Smi::FromInt(constant_index)); |
(...skipping 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5742 FixedArray::kHeaderSize - kPointerSize)); | 5723 FixedArray::kHeaderSize - kPointerSize)); |
5743 __ bind(&done); | 5724 __ bind(&done); |
5744 } | 5725 } |
5745 | 5726 |
5746 | 5727 |
5747 #undef __ | 5728 #undef __ |
5748 | 5729 |
5749 } } // namespace v8::internal | 5730 } } // namespace v8::internal |
5750 | 5731 |
5751 #endif // V8_TARGET_ARCH_X64 | 5732 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |