| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" | 7 #include "src/crankshaft/ia32/lithium-codegen-ia32.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 2746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2757 | 2757 |
| 2758 __ mov(LoadDescriptor::NameRegister(), instr->name()); | 2758 __ mov(LoadDescriptor::NameRegister(), instr->name()); |
| 2759 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2759 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
| 2760 Handle<Code> ic = | 2760 Handle<Code> ic = |
| 2761 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2761 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
| 2762 SLOPPY, PREMONOMORPHIC).code(); | 2762 SLOPPY, PREMONOMORPHIC).code(); |
| 2763 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2763 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2764 } | 2764 } |
| 2765 | 2765 |
| 2766 | 2766 |
| 2767 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | |
| 2768 DCHECK(ToRegister(instr->context()).is(esi)); | |
| 2769 DCHECK(ToRegister(instr->result()).is(eax)); | |
| 2770 | |
| 2771 int const slot = instr->slot_index(); | |
| 2772 int const depth = instr->depth(); | |
| 2773 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
| 2774 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
| 2775 Handle<Code> stub = | |
| 2776 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | |
| 2777 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
| 2778 } else { | |
| 2779 __ Push(Smi::FromInt(slot)); | |
| 2780 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
| 2781 } | |
| 2782 } | |
| 2783 | |
| 2784 | |
| 2785 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2767 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2786 Register context = ToRegister(instr->context()); | 2768 Register context = ToRegister(instr->context()); |
| 2787 Register result = ToRegister(instr->result()); | 2769 Register result = ToRegister(instr->result()); |
| 2788 __ mov(result, ContextOperand(context, instr->slot_index())); | 2770 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 2789 | 2771 |
| 2790 if (instr->hydrogen()->RequiresHoleCheck()) { | 2772 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2791 __ cmp(result, factory()->the_hole_value()); | 2773 __ cmp(result, factory()->the_hole_value()); |
| 2792 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2774 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2793 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | 2775 DeoptimizeIf(equal, instr, Deoptimizer::kHole); |
| 2794 } else { | 2776 } else { |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4014 } | 3996 } |
| 4015 | 3997 |
| 4016 __ mov(StoreDescriptor::NameRegister(), instr->name()); | 3998 __ mov(StoreDescriptor::NameRegister(), instr->name()); |
| 4017 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 3999 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
| 4018 isolate(), instr->language_mode(), | 4000 isolate(), instr->language_mode(), |
| 4019 instr->hydrogen()->initialization_state()).code(); | 4001 instr->hydrogen()->initialization_state()).code(); |
| 4020 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4002 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4021 } | 4003 } |
| 4022 | 4004 |
| 4023 | 4005 |
| 4024 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | |
| 4025 DCHECK(ToRegister(instr->context()).is(esi)); | |
| 4026 DCHECK(ToRegister(instr->value()) | |
| 4027 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | |
| 4028 | |
| 4029 int const slot = instr->slot_index(); | |
| 4030 int const depth = instr->depth(); | |
| 4031 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
| 4032 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
| 4033 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | |
| 4034 isolate(), depth, instr->language_mode()) | |
| 4035 .code(); | |
| 4036 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
| 4037 } else { | |
| 4038 __ Push(Smi::FromInt(slot)); | |
| 4039 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | |
| 4040 __ CallRuntime(is_strict(instr->language_mode()) | |
| 4041 ? Runtime::kStoreGlobalViaContext_Strict | |
| 4042 : Runtime::kStoreGlobalViaContext_Sloppy, | |
| 4043 2); | |
| 4044 } | |
| 4045 } | |
| 4046 | |
| 4047 | |
| 4048 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4006 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4049 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4007 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
| 4050 if (instr->index()->IsConstantOperand()) { | 4008 if (instr->index()->IsConstantOperand()) { |
| 4051 __ cmp(ToOperand(instr->length()), | 4009 __ cmp(ToOperand(instr->length()), |
| 4052 ToImmediate(LConstantOperand::cast(instr->index()), | 4010 ToImmediate(LConstantOperand::cast(instr->index()), |
| 4053 instr->hydrogen()->length()->representation())); | 4011 instr->hydrogen()->length()->representation())); |
| 4054 cc = CommuteCondition(cc); | 4012 cc = CommuteCondition(cc); |
| 4055 } else if (instr->length()->IsConstantOperand()) { | 4013 } else if (instr->length()->IsConstantOperand()) { |
| 4056 __ cmp(ToOperand(instr->index()), | 4014 __ cmp(ToOperand(instr->index()), |
| 4057 ToImmediate(LConstantOperand::cast(instr->length()), | 4015 ToImmediate(LConstantOperand::cast(instr->length()), |
| (...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5715 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5673 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5716 } | 5674 } |
| 5717 | 5675 |
| 5718 | 5676 |
| 5719 #undef __ | 5677 #undef __ |
| 5720 | 5678 |
| 5721 } // namespace internal | 5679 } // namespace internal |
| 5722 } // namespace v8 | 5680 } // namespace v8 |
| 5723 | 5681 |
| 5724 #endif // V8_TARGET_ARCH_IA32 | 5682 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |