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

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

Issue 1258513003: X87: [stubs] Optimize LoadGlobalViaContextStub and StoreGlobalViaContextStub. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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
« no previous file with comments | « src/x87/interface-descriptors-x87.cc ('k') | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_X87 7 #if V8_TARGET_ARCH_X87
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 3132 matching lines...) Expand 10 before | Expand all | Expand 10 after
3143 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), 3143 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(),
3144 SLOPPY, PREMONOMORPHIC).code(); 3144 SLOPPY, PREMONOMORPHIC).code();
3145 CallCode(ic, RelocInfo::CODE_TARGET, instr); 3145 CallCode(ic, RelocInfo::CODE_TARGET, instr);
3146 } 3146 }
3147 3147
3148 3148
3149 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { 3149 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) {
3150 DCHECK(ToRegister(instr->context()).is(esi)); 3150 DCHECK(ToRegister(instr->context()).is(esi));
3151 DCHECK(ToRegister(instr->result()).is(eax)); 3151 DCHECK(ToRegister(instr->result()).is(eax));
3152 3152
3153 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), 3153 int const slot = instr->slot_index();
3154 Immediate(Smi::FromInt(instr->depth()))); 3154 int const depth = instr->depth();
3155 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), 3155 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) {
3156 Immediate(Smi::FromInt(instr->slot_index()))); 3156 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot);
3157 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name()); 3157 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name());
3158 3158 Handle<Code> stub =
3159 Handle<Code> stub = 3159 CodeFactory::LoadGlobalViaContext(isolate(), depth).code();
3160 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); 3160 CallCode(stub, RelocInfo::CODE_TARGET, instr);
3161 CallCode(stub, RelocInfo::CODE_TARGET, instr); 3161 } else {
3162 __ Push(Smi::FromInt(slot));
3163 __ Push(instr->name());
3164 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2);
3165 }
3162 } 3166 }
3163 3167
3164 3168
3165 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { 3169 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) {
3166 Register context = ToRegister(instr->context()); 3170 Register context = ToRegister(instr->context());
3167 Register result = ToRegister(instr->result()); 3171 Register result = ToRegister(instr->result());
3168 __ mov(result, ContextOperand(context, instr->slot_index())); 3172 __ mov(result, ContextOperand(context, instr->slot_index()));
3169 3173
3170 if (instr->hydrogen()->RequiresHoleCheck()) { 3174 if (instr->hydrogen()->RequiresHoleCheck()) {
3171 __ cmp(result, factory()->the_hole_value()); 3175 __ cmp(result, factory()->the_hole_value());
(...skipping 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
4539 instr->hydrogen()->initialization_state()).code(); 4543 instr->hydrogen()->initialization_state()).code();
4540 CallCode(ic, RelocInfo::CODE_TARGET, instr); 4544 CallCode(ic, RelocInfo::CODE_TARGET, instr);
4541 } 4545 }
4542 4546
4543 4547
4544 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { 4548 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) {
4545 DCHECK(ToRegister(instr->context()).is(esi)); 4549 DCHECK(ToRegister(instr->context()).is(esi));
4546 DCHECK(ToRegister(instr->value()) 4550 DCHECK(ToRegister(instr->value())
4547 .is(StoreGlobalViaContextDescriptor::ValueRegister())); 4551 .is(StoreGlobalViaContextDescriptor::ValueRegister()));
4548 4552
4549 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), 4553 int const slot = instr->slot_index();
4550 Immediate(Smi::FromInt(instr->depth()))); 4554 int const depth = instr->depth();
4551 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), 4555 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) {
4552 Immediate(Smi::FromInt(instr->slot_index()))); 4556 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot);
4553 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name()); 4557 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name());
4554 4558 Handle<Code> stub = CodeFactory::StoreGlobalViaContext(
4555 Handle<Code> stub = 4559 isolate(), depth, instr->language_mode())
4556 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), 4560 .code();
4557 instr->language_mode()).code(); 4561 CallCode(stub, RelocInfo::CODE_TARGET, instr);
4558 CallCode(stub, RelocInfo::CODE_TARGET, instr); 4562 } else {
4563 __ Push(Smi::FromInt(slot));
4564 __ Push(instr->name());
4565 __ Push(StoreGlobalViaContextDescriptor::ValueRegister());
4566 __ CallRuntime(is_strict(instr->language_mode())
4567 ? Runtime::kStoreGlobalViaContext_Strict
4568 : Runtime::kStoreGlobalViaContext_Sloppy,
4569 3);
4570 }
4559 } 4571 }
4560 4572
4561 4573
4562 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { 4574 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) {
4563 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; 4575 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal;
4564 if (instr->index()->IsConstantOperand()) { 4576 if (instr->index()->IsConstantOperand()) {
4565 __ cmp(ToOperand(instr->length()), 4577 __ cmp(ToOperand(instr->length()),
4566 ToImmediate(LConstantOperand::cast(instr->index()), 4578 ToImmediate(LConstantOperand::cast(instr->index()),
4567 instr->hydrogen()->length()->representation())); 4579 instr->hydrogen()->length()->representation()));
4568 cc = CommuteCondition(cc); 4580 cc = CommuteCondition(cc);
(...skipping 1902 matching lines...) Expand 10 before | Expand all | Expand 10 after
6471 RecordSafepoint(Safepoint::kNoLazyDeopt); 6483 RecordSafepoint(Safepoint::kNoLazyDeopt);
6472 } 6484 }
6473 6485
6474 6486
6475 #undef __ 6487 #undef __
6476 6488
6477 } // namespace internal 6489 } // namespace internal
6478 } // namespace v8 6490 } // namespace v8
6479 6491
6480 #endif // V8_TARGET_ARCH_X87 6492 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/interface-descriptors-x87.cc ('k') | src/x87/macro-assembler-x87.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698