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 2994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3005 Register slot_register = LoadDescriptor::SlotRegister(); | 3005 Register slot_register = LoadDescriptor::SlotRegister(); |
3006 DCHECK(vector_register.is(LoadWithVectorDescriptor::VectorRegister())); | 3006 DCHECK(vector_register.is(LoadWithVectorDescriptor::VectorRegister())); |
3007 DCHECK(slot_register.is(r3)); | 3007 DCHECK(slot_register.is(r3)); |
3008 | 3008 |
3009 AllowDeferredHandleDereference vector_structure_check; | 3009 AllowDeferredHandleDereference vector_structure_check; |
3010 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 3010 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
3011 __ Move(vector_register, vector); | 3011 __ Move(vector_register, vector); |
3012 // No need to allocate this register. | 3012 // No need to allocate this register. |
3013 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 3013 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
3014 int index = vector->GetIndex(slot); | 3014 int index = vector->GetIndex(slot); |
3015 __ mov(slot_register, Operand(Smi::FromInt(index))); | 3015 __ LoadSmiLiteral(slot_register, Smi::FromInt(index)); |
3016 } | 3016 } |
3017 | 3017 |
3018 | 3018 |
| 3019 template <class T> |
| 3020 void LCodeGen::EmitVectorStoreICRegisters(T* instr) { |
| 3021 Register vector_register = ToRegister(instr->temp_vector()); |
| 3022 Register slot_register = ToRegister(instr->temp_slot()); |
| 3023 |
| 3024 AllowDeferredHandleDereference vector_structure_check; |
| 3025 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| 3026 __ Move(vector_register, vector); |
| 3027 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
| 3028 int index = vector->GetIndex(slot); |
| 3029 __ LoadSmiLiteral(slot_register, Smi::FromInt(index)); |
| 3030 } |
| 3031 |
| 3032 |
3019 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3033 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3020 DCHECK(ToRegister(instr->context()).is(cp)); | 3034 DCHECK(ToRegister(instr->context()).is(cp)); |
3021 DCHECK(ToRegister(instr->global_object()) | 3035 DCHECK(ToRegister(instr->global_object()) |
3022 .is(LoadDescriptor::ReceiverRegister())); | 3036 .is(LoadDescriptor::ReceiverRegister())); |
3023 DCHECK(ToRegister(instr->result()).is(r3)); | 3037 DCHECK(ToRegister(instr->result()).is(r3)); |
3024 | 3038 |
3025 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); | 3039 __ mov(LoadDescriptor::NameRegister(), Operand(instr->name())); |
3026 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3040 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3027 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3041 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3028 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 3042 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4413 hinstr->PointersToHereCheckForValue()); | 4427 hinstr->PointersToHereCheckForValue()); |
4414 } | 4428 } |
4415 } | 4429 } |
4416 | 4430 |
4417 | 4431 |
4418 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4432 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4419 DCHECK(ToRegister(instr->context()).is(cp)); | 4433 DCHECK(ToRegister(instr->context()).is(cp)); |
4420 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4434 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4421 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4435 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4422 | 4436 |
| 4437 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4438 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); |
| 4439 } |
| 4440 |
4423 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4441 __ mov(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4424 Handle<Code> ic = | 4442 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4425 StoreIC::initialize_stub(isolate(), instr->language_mode(), | 4443 isolate(), instr->language_mode(), |
4426 instr->hydrogen()->initialization_state()); | 4444 instr->hydrogen()->initialization_state()).code(); |
4427 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4445 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4428 } | 4446 } |
4429 | 4447 |
4430 | 4448 |
4431 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4449 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4432 Representation representation = instr->hydrogen()->length()->representation(); | 4450 Representation representation = instr->hydrogen()->length()->representation(); |
4433 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4451 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4434 DCHECK(representation.IsSmiOrInteger32()); | 4452 DCHECK(representation.IsSmiOrInteger32()); |
4435 | 4453 |
4436 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; | 4454 Condition cc = instr->hydrogen()->allow_equality() ? lt : le; |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4680 } | 4698 } |
4681 } | 4699 } |
4682 | 4700 |
4683 | 4701 |
4684 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4702 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4685 DCHECK(ToRegister(instr->context()).is(cp)); | 4703 DCHECK(ToRegister(instr->context()).is(cp)); |
4686 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4704 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4687 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4705 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4688 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4706 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4689 | 4707 |
| 4708 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4709 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); |
| 4710 } |
| 4711 |
4690 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( | 4712 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( |
4691 isolate(), instr->language_mode(), | 4713 isolate(), instr->language_mode(), |
4692 instr->hydrogen()->initialization_state()).code(); | 4714 instr->hydrogen()->initialization_state()).code(); |
4693 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4715 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4694 } | 4716 } |
4695 | 4717 |
4696 | 4718 |
4697 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { | 4719 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { |
4698 class DeferredMaybeGrowElements final : public LDeferredCode { | 4720 class DeferredMaybeGrowElements final : public LDeferredCode { |
4699 public: | 4721 public: |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6233 __ Push(scope_info); | 6255 __ Push(scope_info); |
6234 __ push(ToRegister(instr->function())); | 6256 __ push(ToRegister(instr->function())); |
6235 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6257 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6236 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6258 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6237 } | 6259 } |
6238 | 6260 |
6239 | 6261 |
6240 #undef __ | 6262 #undef __ |
6241 } // namespace internal | 6263 } // namespace internal |
6242 } // namespace v8 | 6264 } // namespace v8 |
OLD | NEW |