| 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 #if V8_TARGET_ARCH_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 6 | 6 |
| 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" | 7 #include "src/crankshaft/x87/lithium-codegen-x87.h" |
| 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 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3038 | 3038 |
| 3039 __ mov(LoadDescriptor::NameRegister(), instr->name()); | 3039 __ mov(LoadDescriptor::NameRegister(), instr->name()); |
| 3040 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3040 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
| 3041 Handle<Code> ic = | 3041 Handle<Code> ic = |
| 3042 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 3042 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
| 3043 SLOPPY, PREMONOMORPHIC).code(); | 3043 SLOPPY, PREMONOMORPHIC).code(); |
| 3044 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3044 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 3045 } | 3045 } |
| 3046 | 3046 |
| 3047 | 3047 |
| 3048 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | |
| 3049 DCHECK(ToRegister(instr->context()).is(esi)); | |
| 3050 DCHECK(ToRegister(instr->result()).is(eax)); | |
| 3051 | |
| 3052 int const slot = instr->slot_index(); | |
| 3053 int const depth = instr->depth(); | |
| 3054 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
| 3055 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
| 3056 Handle<Code> stub = | |
| 3057 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | |
| 3058 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
| 3059 } else { | |
| 3060 __ Push(Smi::FromInt(slot)); | |
| 3061 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
| 3062 } | |
| 3063 } | |
| 3064 | |
| 3065 | |
| 3066 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3048 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 3067 Register context = ToRegister(instr->context()); | 3049 Register context = ToRegister(instr->context()); |
| 3068 Register result = ToRegister(instr->result()); | 3050 Register result = ToRegister(instr->result()); |
| 3069 __ mov(result, ContextOperand(context, instr->slot_index())); | 3051 __ mov(result, ContextOperand(context, instr->slot_index())); |
| 3070 | 3052 |
| 3071 if (instr->hydrogen()->RequiresHoleCheck()) { | 3053 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3072 __ cmp(result, factory()->the_hole_value()); | 3054 __ cmp(result, factory()->the_hole_value()); |
| 3073 if (instr->hydrogen()->DeoptimizesOnHole()) { | 3055 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 3074 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | 3056 DeoptimizeIf(equal, instr, Deoptimizer::kHole); |
| 3075 } else { | 3057 } else { |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4418 } | 4400 } |
| 4419 | 4401 |
| 4420 __ mov(StoreDescriptor::NameRegister(), instr->name()); | 4402 __ mov(StoreDescriptor::NameRegister(), instr->name()); |
| 4421 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 4403 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
| 4422 isolate(), instr->language_mode(), | 4404 isolate(), instr->language_mode(), |
| 4423 instr->hydrogen()->initialization_state()).code(); | 4405 instr->hydrogen()->initialization_state()).code(); |
| 4424 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4406 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4425 } | 4407 } |
| 4426 | 4408 |
| 4427 | 4409 |
| 4428 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | |
| 4429 DCHECK(ToRegister(instr->context()).is(esi)); | |
| 4430 DCHECK(ToRegister(instr->value()) | |
| 4431 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | |
| 4432 | |
| 4433 int const slot = instr->slot_index(); | |
| 4434 int const depth = instr->depth(); | |
| 4435 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
| 4436 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | |
| 4437 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | |
| 4438 isolate(), depth, instr->language_mode()) | |
| 4439 .code(); | |
| 4440 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
| 4441 } else { | |
| 4442 __ Push(Smi::FromInt(slot)); | |
| 4443 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | |
| 4444 __ CallRuntime(is_strict(instr->language_mode()) | |
| 4445 ? Runtime::kStoreGlobalViaContext_Strict | |
| 4446 : Runtime::kStoreGlobalViaContext_Sloppy, | |
| 4447 2); | |
| 4448 } | |
| 4449 } | |
| 4450 | |
| 4451 | |
| 4452 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4410 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4453 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4411 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
| 4454 if (instr->index()->IsConstantOperand()) { | 4412 if (instr->index()->IsConstantOperand()) { |
| 4455 __ cmp(ToOperand(instr->length()), | 4413 __ cmp(ToOperand(instr->length()), |
| 4456 ToImmediate(LConstantOperand::cast(instr->index()), | 4414 ToImmediate(LConstantOperand::cast(instr->index()), |
| 4457 instr->hydrogen()->length()->representation())); | 4415 instr->hydrogen()->length()->representation())); |
| 4458 cc = CommuteCondition(cc); | 4416 cc = CommuteCondition(cc); |
| 4459 } else if (instr->length()->IsConstantOperand()) { | 4417 } else if (instr->length()->IsConstantOperand()) { |
| 4460 __ cmp(ToOperand(instr->index()), | 4418 __ cmp(ToOperand(instr->index()), |
| 4461 ToImmediate(LConstantOperand::cast(instr->length()), | 4419 ToImmediate(LConstantOperand::cast(instr->length()), |
| (...skipping 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6330 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6288 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6331 } | 6289 } |
| 6332 | 6290 |
| 6333 | 6291 |
| 6334 #undef __ | 6292 #undef __ |
| 6335 | 6293 |
| 6336 } // namespace internal | 6294 } // namespace internal |
| 6337 } // namespace v8 | 6295 } // namespace v8 |
| 6338 | 6296 |
| 6339 #endif // V8_TARGET_ARCH_X87 | 6297 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |