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 3721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3732 ASSERT(ToRegister(instr->value()).is(eax)); | 3732 ASSERT(ToRegister(instr->value()).is(eax)); |
3733 | 3733 |
3734 __ mov(ecx, instr->name()); | 3734 __ mov(ecx, instr->name()); |
3735 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3735 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3736 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3736 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3737 : isolate()->builtins()->StoreIC_Initialize(); | 3737 : isolate()->builtins()->StoreIC_Initialize(); |
3738 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3738 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3739 } | 3739 } |
3740 | 3740 |
3741 | 3741 |
| 3742 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
| 3743 HValue* value, |
| 3744 LOperand* operand) { |
| 3745 if (value->representation().IsTagged() && !value->type().IsSmi()) { |
| 3746 if (operand->IsRegister()) { |
| 3747 __ test(ToRegister(operand), Immediate(kSmiTagMask)); |
| 3748 } else { |
| 3749 __ test(ToOperand(operand), Immediate(kSmiTagMask)); |
| 3750 } |
| 3751 DeoptimizeIf(not_zero, environment); |
| 3752 } |
| 3753 } |
| 3754 |
| 3755 |
3742 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3756 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3757 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3758 instr->hydrogen()->length(), |
| 3759 instr->length()); |
| 3760 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3761 instr->hydrogen()->index(), |
| 3762 instr->index()); |
3743 if (instr->index()->IsConstantOperand()) { | 3763 if (instr->index()->IsConstantOperand()) { |
3744 int constant_index = | 3764 int constant_index = |
3745 ToInteger32(LConstantOperand::cast(instr->index())); | 3765 ToInteger32(LConstantOperand::cast(instr->index())); |
3746 if (instr->hydrogen()->length()->representation().IsTagged()) { | 3766 if (instr->hydrogen()->length()->representation().IsTagged()) { |
3747 __ cmp(ToOperand(instr->length()), | 3767 __ cmp(ToOperand(instr->length()), |
3748 Immediate(Smi::FromInt(constant_index))); | 3768 Immediate(Smi::FromInt(constant_index))); |
3749 } else { | 3769 } else { |
3750 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); | 3770 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); |
3751 } | 3771 } |
3752 DeoptimizeIf(below_equal, instr->environment()); | 3772 DeoptimizeIf(below_equal, instr->environment()); |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5425 FixedArray::kHeaderSize - kPointerSize)); | 5445 FixedArray::kHeaderSize - kPointerSize)); |
5426 __ bind(&done); | 5446 __ bind(&done); |
5427 } | 5447 } |
5428 | 5448 |
5429 | 5449 |
5430 #undef __ | 5450 #undef __ |
5431 | 5451 |
5432 } } // namespace v8::internal | 5452 } } // namespace v8::internal |
5433 | 5453 |
5434 #endif // V8_TARGET_ARCH_IA32 | 5454 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |