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 #include "src/crankshaft/arm/lithium-codegen-arm.h" | 5 #include "src/crankshaft/arm/lithium-codegen-arm.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" | 10 #include "src/crankshaft/arm/lithium-gap-resolver-arm.h" |
(...skipping 2810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2821 | 2821 |
2822 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2822 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2823 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2823 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2824 Handle<Code> ic = | 2824 Handle<Code> ic = |
2825 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2825 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2826 SLOPPY, PREMONOMORPHIC).code(); | 2826 SLOPPY, PREMONOMORPHIC).code(); |
2827 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2827 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2828 } | 2828 } |
2829 | 2829 |
2830 | 2830 |
2831 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | |
2832 DCHECK(ToRegister(instr->context()).is(cp)); | |
2833 DCHECK(ToRegister(instr->result()).is(r0)); | |
2834 | |
2835 int const slot = instr->slot_index(); | |
2836 int const depth = instr->depth(); | |
2837 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
2838 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
2839 Handle<Code> stub = | |
2840 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | |
2841 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
2842 } else { | |
2843 __ Push(Smi::FromInt(slot)); | |
2844 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
2845 } | |
2846 } | |
2847 | |
2848 | |
2849 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2831 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2850 Register context = ToRegister(instr->context()); | 2832 Register context = ToRegister(instr->context()); |
2851 Register result = ToRegister(instr->result()); | 2833 Register result = ToRegister(instr->result()); |
2852 __ ldr(result, ContextOperand(context, instr->slot_index())); | 2834 __ ldr(result, ContextOperand(context, instr->slot_index())); |
2853 if (instr->hydrogen()->RequiresHoleCheck()) { | 2835 if (instr->hydrogen()->RequiresHoleCheck()) { |
2854 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 2836 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
2855 __ cmp(result, ip); | 2837 __ cmp(result, ip); |
2856 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2838 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2857 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 2839 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
2858 } else { | 2840 } else { |
(...skipping 1205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4064 } | 4046 } |
4065 | 4047 |
4066 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4048 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4067 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 4049 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4068 isolate(), instr->language_mode(), | 4050 isolate(), instr->language_mode(), |
4069 instr->hydrogen()->initialization_state()).code(); | 4051 instr->hydrogen()->initialization_state()).code(); |
4070 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); | 4052 CallCode(ic, RelocInfo::CODE_TARGET, instr, NEVER_INLINE_TARGET_ADDRESS); |
4071 } | 4053 } |
4072 | 4054 |
4073 | 4055 |
4074 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | |
4075 DCHECK(ToRegister(instr->context()).is(cp)); | |
4076 DCHECK(ToRegister(instr->value()) | |
4077 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | |
4078 | |
4079 int const slot = instr->slot_index(); | |
4080 int const depth = instr->depth(); | |
4081 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
4082 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
4083 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | |
4084 isolate(), depth, instr->language_mode()) | |
4085 .code(); | |
4086 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
4087 } else { | |
4088 __ Push(Smi::FromInt(slot)); | |
4089 __ push(StoreGlobalViaContextDescriptor::ValueRegister()); | |
4090 __ CallRuntime(is_strict(instr->language_mode()) | |
4091 ? Runtime::kStoreGlobalViaContext_Strict | |
4092 : Runtime::kStoreGlobalViaContext_Sloppy, | |
4093 2); | |
4094 } | |
4095 } | |
4096 | |
4097 | |
4098 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4056 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4099 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4057 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4100 if (instr->index()->IsConstantOperand()) { | 4058 if (instr->index()->IsConstantOperand()) { |
4101 Operand index = ToOperand(instr->index()); | 4059 Operand index = ToOperand(instr->index()); |
4102 Register length = ToRegister(instr->length()); | 4060 Register length = ToRegister(instr->length()); |
4103 __ cmp(length, index); | 4061 __ cmp(length, index); |
4104 cc = CommuteCondition(cc); | 4062 cc = CommuteCondition(cc); |
4105 } else { | 4063 } else { |
4106 Register index = ToRegister(instr->index()); | 4064 Register index = ToRegister(instr->index()); |
4107 Operand length = ToOperand(instr->length()); | 4065 Operand length = ToOperand(instr->length()); |
(...skipping 1726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5834 __ push(ToRegister(instr->function())); | 5792 __ push(ToRegister(instr->function())); |
5835 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5793 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5836 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5794 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5837 } | 5795 } |
5838 | 5796 |
5839 | 5797 |
5840 #undef __ | 5798 #undef __ |
5841 | 5799 |
5842 } // namespace internal | 5800 } // namespace internal |
5843 } // namespace v8 | 5801 } // namespace v8 |
OLD | NEW |