OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/cpu-profiler.h" | 10 #include "src/cpu-profiler.h" |
(...skipping 3042 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3053 | 3053 |
3054 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3054 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3055 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3055 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3056 Handle<Code> ic = | 3056 Handle<Code> ic = |
3057 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 3057 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
3058 SLOPPY, PREMONOMORPHIC).code(); | 3058 SLOPPY, PREMONOMORPHIC).code(); |
3059 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3059 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3060 } | 3060 } |
3061 | 3061 |
3062 | 3062 |
| 3063 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
| 3064 DCHECK(ToRegister(instr->context()).is(cp)); |
| 3065 DCHECK(ToRegister(instr->result()).is(r3)); |
| 3066 |
| 3067 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), |
| 3068 Operand(Smi::FromInt(instr->depth()))); |
| 3069 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), |
| 3070 Operand(Smi::FromInt(instr->slot_index()))); |
| 3071 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
| 3072 Operand(instr->name())); |
| 3073 |
| 3074 Handle<Code> stub = |
| 3075 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); |
| 3076 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
| 3077 } |
| 3078 |
| 3079 |
3063 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3080 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3064 Register context = ToRegister(instr->context()); | 3081 Register context = ToRegister(instr->context()); |
3065 Register result = ToRegister(instr->result()); | 3082 Register result = ToRegister(instr->result()); |
3066 __ LoadP(result, ContextOperand(context, instr->slot_index())); | 3083 __ LoadP(result, ContextOperand(context, instr->slot_index())); |
3067 if (instr->hydrogen()->RequiresHoleCheck()) { | 3084 if (instr->hydrogen()->RequiresHoleCheck()) { |
3068 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3085 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3069 if (instr->hydrogen()->DeoptimizesOnHole()) { | 3086 if (instr->hydrogen()->DeoptimizesOnHole()) { |
3070 __ cmp(result, ip); | 3087 __ cmp(result, ip); |
3071 DeoptimizeIf(eq, instr, Deoptimizer::kHole); | 3088 DeoptimizeIf(eq, instr, Deoptimizer::kHole); |
3072 } else { | 3089 } else { |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4456 } | 4473 } |
4457 | 4474 |
4458 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4475 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4459 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 4476 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4460 isolate(), instr->language_mode(), | 4477 isolate(), instr->language_mode(), |
4461 instr->hydrogen()->initialization_state()).code(); | 4478 instr->hydrogen()->initialization_state()).code(); |
4462 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4479 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4463 } | 4480 } |
4464 | 4481 |
4465 | 4482 |
| 4483 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
| 4484 DCHECK(ToRegister(instr->context()).is(cp)); |
| 4485 DCHECK(ToRegister(instr->value()) |
| 4486 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
| 4487 |
| 4488 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), |
| 4489 Operand(Smi::FromInt(instr->depth()))); |
| 4490 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), |
| 4491 Operand(Smi::FromInt(instr->slot_index()))); |
| 4492 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
| 4493 Operand(instr->name())); |
| 4494 |
| 4495 Handle<Code> stub = |
| 4496 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), |
| 4497 instr->language_mode()).code(); |
| 4498 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
| 4499 } |
| 4500 |
| 4501 |
4466 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4502 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4467 Representation representation = instr->hydrogen()->length()->representation(); | 4503 Representation representation = instr->hydrogen()->length()->representation(); |
4468 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4504 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4469 DCHECK(representation.IsSmiOrInteger32()); | 4505 DCHECK(representation.IsSmiOrInteger32()); |
4470 | 4506 |
4471 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; | 4507 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; |
4472 if (instr->length()->IsConstantOperand()) { | 4508 if (instr->length()->IsConstantOperand()) { |
4473 int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); | 4509 int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); |
4474 Register index = ToRegister(instr->index()); | 4510 Register index = ToRegister(instr->index()); |
4475 if (representation.IsSmi()) { | 4511 if (representation.IsSmi()) { |
(...skipping 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6278 __ Push(scope_info); | 6314 __ Push(scope_info); |
6279 __ push(ToRegister(instr->function())); | 6315 __ push(ToRegister(instr->function())); |
6280 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6316 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6281 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6317 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6282 } | 6318 } |
6283 | 6319 |
6284 | 6320 |
6285 #undef __ | 6321 #undef __ |
6286 } // namespace internal | 6322 } // namespace internal |
6287 } // namespace v8 | 6323 } // namespace v8 |
OLD | NEW |