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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 2855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2866 } | 2866 } |
2867 | 2867 |
2868 | 2868 |
2869 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 2869 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
2870 DCHECK(ToRegister(instr->context()).is(esi)); | 2870 DCHECK(ToRegister(instr->context()).is(esi)); |
2871 DCHECK(ToRegister(instr->result()).is(eax)); | 2871 DCHECK(ToRegister(instr->result()).is(eax)); |
2872 | 2872 |
2873 int const slot = instr->slot_index(); | 2873 int const slot = instr->slot_index(); |
2874 int const depth = instr->depth(); | 2874 int const depth = instr->depth(); |
2875 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 2875 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
2876 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | 2876 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
2877 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
2878 Handle<Code> stub = | 2877 Handle<Code> stub = |
2879 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | 2878 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
2880 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 2879 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
2881 } else { | 2880 } else { |
2882 __ Push(Smi::FromInt(slot)); | 2881 __ Push(Smi::FromInt(slot)); |
2883 __ Push(instr->name()); | 2882 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
2884 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
2885 } | 2883 } |
2886 } | 2884 } |
2887 | 2885 |
2888 | 2886 |
2889 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2887 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2890 Register context = ToRegister(instr->context()); | 2888 Register context = ToRegister(instr->context()); |
2891 Register result = ToRegister(instr->result()); | 2889 Register result = ToRegister(instr->result()); |
2892 __ mov(result, ContextOperand(context, instr->slot_index())); | 2890 __ mov(result, ContextOperand(context, instr->slot_index())); |
2893 | 2891 |
2894 if (instr->hydrogen()->RequiresHoleCheck()) { | 2892 if (instr->hydrogen()->RequiresHoleCheck()) { |
(...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4143 | 4141 |
4144 | 4142 |
4145 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4143 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4146 DCHECK(ToRegister(instr->context()).is(esi)); | 4144 DCHECK(ToRegister(instr->context()).is(esi)); |
4147 DCHECK(ToRegister(instr->value()) | 4145 DCHECK(ToRegister(instr->value()) |
4148 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4146 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4149 | 4147 |
4150 int const slot = instr->slot_index(); | 4148 int const slot = instr->slot_index(); |
4151 int const depth = instr->depth(); | 4149 int const depth = instr->depth(); |
4152 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 4150 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4153 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 4151 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
4154 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
4155 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | 4152 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4156 isolate(), depth, instr->language_mode()) | 4153 isolate(), depth, instr->language_mode()) |
4157 .code(); | 4154 .code(); |
4158 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4155 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4159 } else { | 4156 } else { |
4160 __ Push(Smi::FromInt(slot)); | 4157 __ Push(Smi::FromInt(slot)); |
4161 __ Push(instr->name()); | |
4162 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | 4158 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
4163 __ CallRuntime(is_strict(instr->language_mode()) | 4159 __ CallRuntime(is_strict(instr->language_mode()) |
4164 ? Runtime::kStoreGlobalViaContext_Strict | 4160 ? Runtime::kStoreGlobalViaContext_Strict |
4165 : Runtime::kStoreGlobalViaContext_Sloppy, | 4161 : Runtime::kStoreGlobalViaContext_Sloppy, |
4166 3); | 4162 2); |
4167 } | 4163 } |
4168 } | 4164 } |
4169 | 4165 |
4170 | 4166 |
4171 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4167 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4172 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4168 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
4173 if (instr->index()->IsConstantOperand()) { | 4169 if (instr->index()->IsConstantOperand()) { |
4174 __ cmp(ToOperand(instr->length()), | 4170 __ cmp(ToOperand(instr->length()), |
4175 ToImmediate(LConstantOperand::cast(instr->index()), | 4171 ToImmediate(LConstantOperand::cast(instr->index()), |
4176 instr->hydrogen()->length()->representation())); | 4172 instr->hydrogen()->length()->representation())); |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5869 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5865 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5870 } | 5866 } |
5871 | 5867 |
5872 | 5868 |
5873 #undef __ | 5869 #undef __ |
5874 | 5870 |
5875 } // namespace internal | 5871 } // namespace internal |
5876 } // namespace v8 | 5872 } // namespace v8 |
5877 | 5873 |
5878 #endif // V8_TARGET_ARCH_IA32 | 5874 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |