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 3046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { | 3063 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { |
3064 DCHECK(ToRegister(instr->context()).is(cp)); | 3064 DCHECK(ToRegister(instr->context()).is(cp)); |
3065 DCHECK(ToRegister(instr->result()).is(r3)); | 3065 DCHECK(ToRegister(instr->result()).is(r3)); |
3066 | 3066 |
3067 __ mov(LoadGlobalViaContextDescriptor::DepthRegister(), | 3067 int const slot = instr->slot_index(); |
3068 Operand(Smi::FromInt(instr->depth()))); | 3068 int const depth = instr->depth(); |
3069 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), | 3069 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
3070 Operand(Smi::FromInt(instr->slot_index()))); | 3070 __ mov(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
3071 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), | 3071 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), |
3072 Operand(instr->name())); | 3072 Operand(instr->name())); |
3073 | 3073 Handle<Code> stub = |
3074 Handle<Code> stub = | 3074 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); |
3075 CodeFactory::LoadGlobalViaContext(isolate(), instr->depth()).code(); | 3075 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
3076 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 3076 } else { |
| 3077 __ Push(Smi::FromInt(slot)); |
| 3078 __ Push(instr->name()); |
| 3079 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); |
| 3080 } |
3077 } | 3081 } |
3078 | 3082 |
3079 | 3083 |
3080 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 3084 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
3081 Register context = ToRegister(instr->context()); | 3085 Register context = ToRegister(instr->context()); |
3082 Register result = ToRegister(instr->result()); | 3086 Register result = ToRegister(instr->result()); |
3083 __ LoadP(result, ContextOperand(context, instr->slot_index())); | 3087 __ LoadP(result, ContextOperand(context, instr->slot_index())); |
3084 if (instr->hydrogen()->RequiresHoleCheck()) { | 3088 if (instr->hydrogen()->RequiresHoleCheck()) { |
3085 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); | 3089 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); |
3086 if (instr->hydrogen()->DeoptimizesOnHole()) { | 3090 if (instr->hydrogen()->DeoptimizesOnHole()) { |
(...skipping 1391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4478 instr->hydrogen()->initialization_state()).code(); | 4482 instr->hydrogen()->initialization_state()).code(); |
4479 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4483 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4480 } | 4484 } |
4481 | 4485 |
4482 | 4486 |
4483 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | 4487 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { |
4484 DCHECK(ToRegister(instr->context()).is(cp)); | 4488 DCHECK(ToRegister(instr->context()).is(cp)); |
4485 DCHECK(ToRegister(instr->value()) | 4489 DCHECK(ToRegister(instr->value()) |
4486 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | 4490 .is(StoreGlobalViaContextDescriptor::ValueRegister())); |
4487 | 4491 |
4488 __ mov(StoreGlobalViaContextDescriptor::DepthRegister(), | 4492 int const slot = instr->slot_index(); |
4489 Operand(Smi::FromInt(instr->depth()))); | 4493 int const depth = instr->depth(); |
4490 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), | 4494 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
4491 Operand(Smi::FromInt(instr->slot_index()))); | 4495 __ mov(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
4492 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), | 4496 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), |
4493 Operand(instr->name())); | 4497 Operand(instr->name())); |
4494 | 4498 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( |
4495 Handle<Code> stub = | 4499 isolate(), depth, instr->language_mode()).code(); |
4496 CodeFactory::StoreGlobalViaContext(isolate(), instr->depth(), | 4500 CallCode(stub, RelocInfo::CODE_TARGET, instr); |
4497 instr->language_mode()).code(); | 4501 } else { |
4498 CallCode(stub, RelocInfo::CODE_TARGET, instr); | 4502 __ Push(Smi::FromInt(slot)); |
| 4503 __ Push(instr->name()); |
| 4504 __ push(StoreGlobalViaContextDescriptor::ValueRegister()); |
| 4505 __ CallRuntime(is_strict(instr->language_mode()) |
| 4506 ? Runtime::kStoreGlobalViaContext_Strict |
| 4507 : Runtime::kStoreGlobalViaContext_Sloppy, |
| 4508 3); |
| 4509 } |
4499 } | 4510 } |
4500 | 4511 |
4501 | 4512 |
4502 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4513 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4503 Representation representation = instr->hydrogen()->length()->representation(); | 4514 Representation representation = instr->hydrogen()->length()->representation(); |
4504 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4515 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4505 DCHECK(representation.IsSmiOrInteger32()); | 4516 DCHECK(representation.IsSmiOrInteger32()); |
4506 | 4517 |
4507 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; | 4518 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; |
4508 if (instr->length()->IsConstantOperand()) { | 4519 if (instr->length()->IsConstantOperand()) { |
(...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6314 __ Push(scope_info); | 6325 __ Push(scope_info); |
6315 __ push(ToRegister(instr->function())); | 6326 __ push(ToRegister(instr->function())); |
6316 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6327 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6317 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6328 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6318 } | 6329 } |
6319 | 6330 |
6320 | 6331 |
6321 #undef __ | 6332 #undef __ |
6322 } // namespace internal | 6333 } // namespace internal |
6323 } // namespace v8 | 6334 } // namespace v8 |
OLD | NEW |