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_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 3135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int const slot = instr->slot_index(); | 3153 int const slot = instr->slot_index(); |
3154 int const depth = instr->depth(); | 3154 int const depth = instr->depth(); |
3155 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 3155 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
3156 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | 3156 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
3157 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
3158 Handle<Code> stub = | 3157 Handle<Code> stub = |
3159 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | 3158 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
3160 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 3159 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
3161 } else { | 3160 } else { |
3162 __ Push(Smi::FromInt(slot)); | 3161 __ Push(Smi::FromInt(slot)); |
3163 __ Push(instr->name()); | 3162 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
3164 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
3165 } | 3163 } |
3166 } | 3164 } |
3167 | 3165 |
3168 | 3166 |
3169 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3167 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3170 Register context = ToRegister(instr->context()); | 3168 Register context = ToRegister(instr->context()); |
3171 Register result = ToRegister(instr->result()); | 3169 Register result = ToRegister(instr->result()); |
3172 __ mov(result, ContextOperand(context, instr->slot_index())); | 3170 __ mov(result, ContextOperand(context, instr->slot_index())); |
3173 | 3171 |
3174 if (instr->hydrogen()->RequiresHoleCheck()) { | 3172 if (instr->hydrogen()->RequiresHoleCheck()) { |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4546 | 4544 |
4547 | 4545 |
4548 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4546 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4549 DCHECK(ToRegister(instr->context()).is(esi)); | 4547 DCHECK(ToRegister(instr->context()).is(esi)); |
4550 DCHECK(ToRegister(instr->value()) | 4548 DCHECK(ToRegister(instr->value()) |
4551 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4549 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4552 | 4550 |
4553 int const slot = instr->slot_index(); | 4551 int const slot = instr->slot_index(); |
4554 int const depth = instr->depth(); | 4552 int const depth = instr->depth(); |
4555 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 4553 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4556 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 4554 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
4557 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), instr->name()); | |
4558 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | 4555 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4559 isolate(), depth, instr->language_mode()) | 4556 isolate(), depth, instr->language_mode()) |
4560 .code(); | 4557 .code(); |
4561 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4558 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4562 } else { | 4559 } else { |
4563 __ Push(Smi::FromInt(slot)); | 4560 __ Push(Smi::FromInt(slot)); |
4564 __ Push(instr->name()); | |
4565 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | 4561 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
4566 __ CallRuntime(is_strict(instr->language_mode()) | 4562 __ CallRuntime(is_strict(instr->language_mode()) |
4567 ? Runtime::kStoreGlobalViaContext_Strict | 4563 ? Runtime::kStoreGlobalViaContext_Strict |
4568 : Runtime::kStoreGlobalViaContext_Sloppy, | 4564 : Runtime::kStoreGlobalViaContext_Sloppy, |
4569 3); | 4565 2); |
4570 } | 4566 } |
4571 } | 4567 } |
4572 | 4568 |
4573 | 4569 |
4574 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4570 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4575 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4571 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
4576 if (instr->index()->IsConstantOperand()) { | 4572 if (instr->index()->IsConstantOperand()) { |
4577 __ cmp(ToOperand(instr->length()), | 4573 __ cmp(ToOperand(instr->length()), |
4578 ToImmediate(LConstantOperand::cast(instr->index()), | 4574 ToImmediate(LConstantOperand::cast(instr->index()), |
4579 instr->hydrogen()->length()->representation())); | 4575 instr->hydrogen()->length()->representation())); |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6483 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6479 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6484 } | 6480 } |
6485 | 6481 |
6486 | 6482 |
6487 #undef __ | 6483 #undef __ |
6488 | 6484 |
6489 } // namespace internal | 6485 } // namespace internal |
6490 } // namespace v8 | 6486 } // namespace v8 |
6491 | 6487 |
6492 #endif // V8_TARGET_ARCH_X87 | 6488 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |