OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 2737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2748 | 2748 |
2749 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2749 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2750 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2750 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2751 Handle<Code> ic = | 2751 Handle<Code> ic = |
2752 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2752 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2753 SLOPPY, PREMONOMORPHIC).code(); | 2753 SLOPPY, PREMONOMORPHIC).code(); |
2754 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2754 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2755 } | 2755 } |
2756 | 2756 |
2757 | 2757 |
2758 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | |
2759 DCHECK(ToRegister(instr->context()).is(cp)); | |
2760 DCHECK(ToRegister(instr->result()).is(v0)); | |
2761 | |
2762 int const slot = instr->slot_index(); | |
2763 int const depth = instr->depth(); | |
2764 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
2765 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
2766 Handle<Code> stub = | |
2767 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | |
2768 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
2769 } else { | |
2770 __ Push(Smi::FromInt(slot)); | |
2771 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
2772 } | |
2773 } | |
2774 | |
2775 | |
2776 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2758 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2777 Register context = ToRegister(instr->context()); | 2759 Register context = ToRegister(instr->context()); |
2778 Register result = ToRegister(instr->result()); | 2760 Register result = ToRegister(instr->result()); |
2779 | 2761 |
2780 __ lw(result, ContextOperand(context, instr->slot_index())); | 2762 __ lw(result, ContextOperand(context, instr->slot_index())); |
2781 if (instr->hydrogen()->RequiresHoleCheck()) { | 2763 if (instr->hydrogen()->RequiresHoleCheck()) { |
2782 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 2764 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
2783 | 2765 |
2784 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2766 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2785 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); | 2767 DeoptimizeIf(eq, instr, Deoptimizer::kHole, result, Operand(at)); |
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4040 } | 4022 } |
4041 | 4023 |
4042 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4024 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4043 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 4025 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4044 isolate(), instr->language_mode(), | 4026 isolate(), instr->language_mode(), |
4045 instr->hydrogen()->initialization_state()).code(); | 4027 instr->hydrogen()->initialization_state()).code(); |
4046 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4028 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4047 } | 4029 } |
4048 | 4030 |
4049 | 4031 |
4050 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | |
4051 DCHECK(ToRegister(instr->context()).is(cp)); | |
4052 DCHECK(ToRegister(instr->value()) | |
4053 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | |
4054 | |
4055 int const slot = instr->slot_index(); | |
4056 int const depth = instr->depth(); | |
4057 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
4058 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | |
4059 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | |
4060 isolate(), depth, instr->language_mode()) | |
4061 .code(); | |
4062 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
4063 } else { | |
4064 __ Push(Smi::FromInt(slot)); | |
4065 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | |
4066 __ CallRuntime(is_strict(language_mode()) | |
4067 ? Runtime::kStoreGlobalViaContext_Strict | |
4068 : Runtime::kStoreGlobalViaContext_Sloppy, | |
4069 2); | |
4070 } | |
4071 } | |
4072 | |
4073 | |
4074 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4032 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4075 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4033 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4076 Operand operand(0); | 4034 Operand operand(0); |
4077 Register reg; | 4035 Register reg; |
4078 if (instr->index()->IsConstantOperand()) { | 4036 if (instr->index()->IsConstantOperand()) { |
4079 operand = ToOperand(instr->index()); | 4037 operand = ToOperand(instr->index()); |
4080 reg = ToRegister(instr->length()); | 4038 reg = ToRegister(instr->length()); |
4081 cc = CommuteCondition(cc); | 4039 cc = CommuteCondition(cc); |
4082 } else { | 4040 } else { |
4083 reg = ToRegister(instr->index()); | 4041 reg = ToRegister(instr->index()); |
(...skipping 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5891 __ Push(at, ToRegister(instr->function())); | 5849 __ Push(at, ToRegister(instr->function())); |
5892 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5850 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5893 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5851 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5894 } | 5852 } |
5895 | 5853 |
5896 | 5854 |
5897 #undef __ | 5855 #undef __ |
5898 | 5856 |
5899 } // namespace internal | 5857 } // namespace internal |
5900 } // namespace v8 | 5858 } // namespace v8 |
OLD | NEW |