| 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 2985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2996 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2996 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
| 2997 SLOPPY, PREMONOMORPHIC).code(); | 2997 SLOPPY, PREMONOMORPHIC).code(); |
| 2998 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2998 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2999 } | 2999 } |
| 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 __ li(LoadGlobalViaContextDescriptor::DepthRegister(), | 3006 int const slot = instr->slot_index(); |
| 3007 Operand(Smi::FromInt(instr->depth()))); | 3007 int const depth = instr->depth(); |
| 3008 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), | 3008 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
| 3009 Operand(Smi::FromInt(instr->slot_index()))); | 3009 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
| 3010 __ li(LoadGlobalViaContextDescriptor::NameRegister(), Operand(instr->name())); | 3010 __ li(LoadGlobalViaContextDescriptor::NameRegister(), |
| 3011 | 3011 Operand(instr->name())); |
| 3012 Handle<Code> stub = | 3012 Handle<Code> stub = |
| 3013 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); | 3013 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
| 3014 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 3014 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
| 3015 } else { |
| 3016 __ Push(Smi::FromInt(slot)); |
| 3017 __ Push(instr->name()); |
| 3018 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 3019 } |
| 3015 } | 3020 } |
| 3016 | 3021 |
| 3017 | 3022 |
| 3018 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3023 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 3019 Register context = ToRegister(instr->context()); | 3024 Register context = ToRegister(instr->context()); |
| 3020 Register result = ToRegister(instr->result()); | 3025 Register result = ToRegister(instr->result()); |
| 3021 | 3026 |
| 3022 __ ld(result, ContextOperand(context, instr->slot_index())); | 3027 __ ld(result, ContextOperand(context, instr->slot_index())); |
| 3023 if (instr->hydrogen()->RequiresHoleCheck()) { | 3028 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 3024 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 3029 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
| (...skipping 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4395 instr->hydrogen()->initialization_state()).code(); | 4400 instr->hydrogen()->initialization_state()).code(); |
| 4396 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4401 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 4397 } | 4402 } |
| 4398 | 4403 |
| 4399 | 4404 |
| 4400 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4405 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
| 4401 DCHECK(ToRegister(instr->context()).is(cp)); | 4406 DCHECK(ToRegister(instr->context()).is(cp)); |
| 4402 DCHECK(ToRegister(instr->value()) | 4407 DCHECK(ToRegister(instr->value()) |
| 4403 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4408 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
| 4404 | 4409 |
| 4405 __ li(StoreGlobalViaContextDescriptor::DepthRegister(), | 4410 int const slot = instr->slot_index(); |
| 4406 Operand(Smi::FromInt(instr->depth()))); | 4411 int const depth = instr->depth(); |
| 4407 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), | 4412 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
| 4408 Operand(Smi::FromInt(instr->slot_index()))); | 4413 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
| 4409 __ li(StoreGlobalViaContextDescriptor::NameRegister(), | 4414 __ li(StoreGlobalViaContextDescriptor::NameRegister(), |
| 4410 Operand(instr->name())); | 4415 Operand(instr->name())); |
| 4411 | 4416 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
| 4412 Handle<Code> stub = | 4417 isolate(), depth, instr->language_mode()) |
| 4413 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), | 4418 .code(); |
| 4414 instr->language_mode()).code(); | 4419 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
| 4415 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4420 } else { |
| 4421 __ Push(Smi::FromInt(slot)); |
| 4422 __ Push(instr->name()); |
| 4423 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); |
| 4424 __ CallRuntime(is_strict(language_mode()) |
| 4425 ? Runtime::kStoreGlobalViaContext_Strict |
| 4426 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 4427 3); |
| 4428 } |
| 4416 } | 4429 } |
| 4417 | 4430 |
| 4418 | 4431 |
| 4419 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4432 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
| 4420 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4433 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
| 4421 Operand operand((int64_t)0); | 4434 Operand operand((int64_t)0); |
| 4422 Register reg; | 4435 Register reg; |
| 4423 if (instr->index()->IsConstantOperand()) { | 4436 if (instr->index()->IsConstantOperand()) { |
| 4424 operand = ToOperand(instr->index()); | 4437 operand = ToOperand(instr->index()); |
| 4425 reg = ToRegister(instr->length()); | 4438 reg = ToRegister(instr->length()); |
| (...skipping 1835 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6261 __ Push(at, ToRegister(instr->function())); | 6274 __ Push(at, ToRegister(instr->function())); |
| 6262 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6275 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 6263 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6276 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 6264 } | 6277 } |
| 6265 | 6278 |
| 6266 | 6279 |
| 6267 #undef __ | 6280 #undef __ |
| 6268 | 6281 |
| 6269 } // namespace internal | 6282 } // namespace internal |
| 6270 } // namespace v8 | 6283 } // namespace v8 |
| OLD | NEW |