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 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/cpu-profiler.h" | 9 #include "src/cpu-profiler.h" |
10 #include "src/hydrogen-osr.h" | 10 #include "src/hydrogen-osr.h" |
(...skipping 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3000 | 3000 |
3001 | 3001 |
3002 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | 3002 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
3003 DCHECK(ToRegister(instr->context()).is(cp)); | 3003 DCHECK(ToRegister(instr->context()).is(cp)); |
3004 DCHECK(ToRegister(instr->result()).is(v0)); | 3004 DCHECK(ToRegister(instr->result()).is(v0)); |
3005 | 3005 |
3006 int const slot = instr->slot_index(); | 3006 int const slot = instr->slot_index(); |
3007 int const depth = instr->depth(); | 3007 int const depth = instr->depth(); |
3008 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 3008 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
3009 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 3009 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
3010 __ li(LoadGlobalViaContextDescriptor::NameRegister(), | |
3011 Operand(instr->name())); | |
3012 Handle<Code> stub = | 3010 Handle<Code> stub = |
3013 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | 3011 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
3014 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 3012 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
3015 } else { | 3013 } else { |
3016 __ Push(Smi::FromInt(slot)); | 3014 __ Push(Smi::FromInt(slot)); |
3017 __ Push(instr->name()); | 3015 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
3018 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
3019 } | 3016 } |
3020 } | 3017 } |
3021 | 3018 |
3022 | 3019 |
3023 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3020 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3024 Register context = ToRegister(instr->context()); | 3021 Register context = ToRegister(instr->context()); |
3025 Register result = ToRegister(instr->result()); | 3022 Register result = ToRegister(instr->result()); |
3026 | 3023 |
3027 __ ld(result, ContextOperand(context, instr->slot_index())); | 3024 __ ld(result, ContextOperand(context, instr->slot_index())); |
3028 if (instr->hydrogen()->RequiresHoleCheck()) { | 3025 if (instr->hydrogen()->RequiresHoleCheck()) { |
(...skipping 1375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4404 | 4401 |
4405 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4402 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4406 DCHECK(ToRegister(instr->context()).is(cp)); | 4403 DCHECK(ToRegister(instr->context()).is(cp)); |
4407 DCHECK(ToRegister(instr->value()) | 4404 DCHECK(ToRegister(instr->value()) |
4408 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4405 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4409 | 4406 |
4410 int const slot = instr->slot_index(); | 4407 int const slot = instr->slot_index(); |
4411 int const depth = instr->depth(); | 4408 int const depth = instr->depth(); |
4412 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 4409 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4413 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 4410 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
4414 __ li(StoreGlobalViaContextDescriptor::NameRegister(), | |
4415 Operand(instr->name())); | |
4416 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | 4411 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4417 isolate(), depth, instr->language_mode()) | 4412 isolate(), depth, instr->language_mode()) |
4418 .code(); | 4413 .code(); |
4419 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4414 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4420 } else { | 4415 } else { |
4421 __ Push(Smi::FromInt(slot)); | 4416 __ Push(Smi::FromInt(slot)); |
4422 __ Push(instr->name()); | |
4423 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | 4417 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
4424 __ CallRuntime(is_strict(language_mode()) | 4418 __ CallRuntime(is_strict(language_mode()) |
4425 ? Runtime::kStoreGlobalViaContext_Strict | 4419 ? Runtime::kStoreGlobalViaContext_Strict |
4426 : Runtime::kStoreGlobalViaContext_Sloppy, | 4420 : Runtime::kStoreGlobalViaContext_Sloppy, |
4427 3); | 4421 2); |
4428 } | 4422 } |
4429 } | 4423 } |
4430 | 4424 |
4431 | 4425 |
4432 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4426 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4433 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4427 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4434 Operand operand((int64_t)0); | 4428 Operand operand((int64_t)0); |
4435 Register reg; | 4429 Register reg; |
4436 if (instr->index()->IsConstantOperand()) { | 4430 if (instr->index()->IsConstantOperand()) { |
4437 operand = ToOperand(instr->index()); | 4431 operand = ToOperand(instr->index()); |
(...skipping 1836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6274 __ Push(at, ToRegister(instr->function())); | 6268 __ Push(at, ToRegister(instr->function())); |
6275 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6269 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6276 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6270 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6277 } | 6271 } |
6278 | 6272 |
6279 | 6273 |
6280 #undef __ | 6274 #undef __ |
6281 | 6275 |
6282 } // namespace internal | 6276 } // namespace internal |
6283 } // namespace v8 | 6277 } // namespace v8 |
OLD | NEW |