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 3656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3667 ASSERT(ToRegister(instr->value()).is(eax)); | 3667 ASSERT(ToRegister(instr->value()).is(eax)); |
3668 | 3668 |
3669 __ mov(ecx, instr->name()); | 3669 __ mov(ecx, instr->name()); |
3670 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) | 3670 Handle<Code> ic = (instr->strict_mode_flag() == kStrictMode) |
3671 ? isolate()->builtins()->StoreIC_Initialize_Strict() | 3671 ? isolate()->builtins()->StoreIC_Initialize_Strict() |
3672 : isolate()->builtins()->StoreIC_Initialize(); | 3672 : isolate()->builtins()->StoreIC_Initialize(); |
3673 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3673 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3674 } | 3674 } |
3675 | 3675 |
3676 | 3676 |
| 3677 void LCodeGen::DeoptIfTaggedButNotSmi(LEnvironment* environment, |
| 3678 HValue* value, |
| 3679 LOperand* operand) { |
| 3680 if (value->representation().IsTagged() && !value->type().IsSmi()) { |
| 3681 if (operand->IsRegister()) { |
| 3682 __ test(ToRegister(operand), Immediate(kSmiTagMask)); |
| 3683 } else { |
| 3684 __ test(ToOperand(operand), Immediate(kSmiTagMask)); |
| 3685 } |
| 3686 DeoptimizeIf(not_zero, environment); |
| 3687 } |
| 3688 } |
| 3689 |
| 3690 |
3677 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3691 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 3692 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3693 instr->hydrogen()->length(), |
| 3694 instr->length()); |
| 3695 DeoptIfTaggedButNotSmi(instr->environment(), |
| 3696 instr->hydrogen()->index(), |
| 3697 instr->index()); |
3678 if (instr->index()->IsConstantOperand()) { | 3698 if (instr->index()->IsConstantOperand()) { |
3679 int constant_index = | 3699 int constant_index = |
3680 ToInteger32(LConstantOperand::cast(instr->index())); | 3700 ToInteger32(LConstantOperand::cast(instr->index())); |
3681 if (instr->hydrogen()->length()->representation().IsTagged()) { | 3701 if (instr->hydrogen()->length()->representation().IsTagged()) { |
3682 __ cmp(ToOperand(instr->length()), | 3702 __ cmp(ToOperand(instr->length()), |
3683 Immediate(Smi::FromInt(constant_index))); | 3703 Immediate(Smi::FromInt(constant_index))); |
3684 } else { | 3704 } else { |
3685 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); | 3705 __ cmp(ToOperand(instr->length()), Immediate(constant_index)); |
3686 } | 3706 } |
3687 DeoptimizeIf(below_equal, instr->environment()); | 3707 DeoptimizeIf(below_equal, instr->environment()); |
(...skipping 1672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5360 FixedArray::kHeaderSize - kPointerSize)); | 5380 FixedArray::kHeaderSize - kPointerSize)); |
5361 __ bind(&done); | 5381 __ bind(&done); |
5362 } | 5382 } |
5363 | 5383 |
5364 | 5384 |
5365 #undef __ | 5385 #undef __ |
5366 | 5386 |
5367 } } // namespace v8::internal | 5387 } } // namespace v8::internal |
5368 | 5388 |
5369 #endif // V8_TARGET_ARCH_IA32 | 5389 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |