Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 1238143002: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix ARM typo. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 2852 matching lines...) Expand 10 before | Expand all | Expand 10 after
2863 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), 2863 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(),
2864 SLOPPY, PREMONOMORPHIC).code(); 2864 SLOPPY, PREMONOMORPHIC).code();
2865 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2865 CallCode(ic, RelocInfo::CODE_TARGET, instr);
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 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), 2873 int const slot = instr->slot_index();
2874 Immediate(Smi::FromInt(instr->depth()))); 2874 int const depth = instr->depth();
2875 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), 2875 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
2876 Immediate(Smi::FromInt(instr->slot_index()))); 2876 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
2877 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name()); 2877 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name());
2878 2878 Handle<Code> stub =
2879 Handle<Code> stub = 2879 CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
2880 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); 2880 CallCode(stub, RelocInfo::CODE_TARGET, instr);
2881 CallCode(stub, RelocInfo::CODE_TARGET, instr); 2881 } else {
2882 __ Push(Smi::FromInt(slot));
2883 __ Push(instr->name());
2884 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
2885 }
2882 } 2886 }
2883 2887
2884 2888
2885 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 2889 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
2886 Register context = ToRegister(instr->context()); 2890 Register context = ToRegister(instr->context());
2887 Register result = ToRegister(instr->result()); 2891 Register result = ToRegister(instr->result());
2888 __ mov(result, ContextOperand(context, instr->slot_index())); 2892 __ mov(result, ContextOperand(context, instr->slot_index()));
2889 2893
2890 if (instr->hydrogen()->RequiresHoleCheck()) { 2894 if (instr->hydrogen()->RequiresHoleCheck()) {
2891 __ cmp(result, factory()->the_hole_value()); 2895 __ cmp(result, factory()->the_hole_value());
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
4136 instr->hydrogen()->initialization_state()).code(); 4140 instr->hydrogen()->initialization_state()).code();
4137 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4141 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4138 } 4142 }
4139 4143
4140 4144
4141 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { 4145 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
4142 DCHECK(ToRegister(instr->context()).is(esi)); 4146 DCHECK(ToRegister(instr->context()).is(esi));
4143 DCHECK(ToRegister(instr->value()) 4147 DCHECK(ToRegister(instr->value())
4144 .is(StoreGlobalViaContextDescriptor::ValueRegister())); 4148 .is(StoreGlobalViaContextDescriptor::ValueRegister()));
4145 4149
4146 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), 4150 int const slot = instr->slot_index();
4147 Immediate(Smi::FromInt(instr->depth()))); 4151 int const depth = instr->depth();
4148 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), 4152 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
4149 Immediate(Smi::FromInt(instr->slot_index()))); 4153 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
4150 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name()); 4154 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name());
4151 4155 Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
4152 Handle<Code> stub = 4156 isolate(), depth, instr->language_mode())
4153 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), 4157 .code();
4154 instr->language_mode()).code(); 4158 CallCode(stub, RelocInfo::CODE_TARGET, instr);
4155 CallCode(stub, RelocInfo::CODE_TARGET, instr); 4159 } else {
4160 __ Push(Smi::FromInt(slot));
4161 __ Push(instr->name());
4162 __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
4163 __ CallRuntime(is_strict(instr->language_mode())
4164 ? Runtime::kStoreGlobalViaContext_Strict
4165 : Runtime::kStoreGlobalViaContext_Sloppy,
4166 3);
4167 }
4156 } 4168 }
4157 4169
4158 4170
4159 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 4171 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4160 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; 4172 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal;
4161 if (instr->index()->IsConstantOperand()) { 4173 if (instr->index()->IsConstantOperand()) {
4162 __ cmp(ToOperand(instr->length()), 4174 __ cmp(ToOperand(instr->length()),
4163 ToImmediate(LConstantOperand::cast(instr->index()), 4175 ToImmediate(LConstantOperand::cast(instr->index()),
4164 instr->hydrogen()->length()->representation())); 4176 instr->hydrogen()->length()->representation()));
4165 cc = CommuteCondition(cc); 4177 cc = CommuteCondition(cc);
(...skipping 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
5857 RecordSafepoint(Safepoint::kNoLazyDeopt); 5869 RecordSafepoint(Safepoint::kNoLazyDeopt);
5858 } 5870 }
5859 5871
5860 5872
5861 #undef __ 5873 #undef __
5862 5874
5863 } // namespace internal 5875 } // namespace internal
5864 } // namespace v8 5876 } // namespace v8
5865 5877
5866 #endif // V8_TARGET_ARCH_IA32 5878 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698