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 2943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2954 AllowDeferredHandleDereference vector_structure_check; | 2954 AllowDeferredHandleDereference vector_structure_check; |
2955 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 2955 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
2956 __ li(vector_register, vector); | 2956 __ li(vector_register, vector); |
2957 // No need to allocate this register. | 2957 // No need to allocate this register. |
2958 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 2958 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
2959 int index = vector->GetIndex(slot); | 2959 int index = vector->GetIndex(slot); |
2960 __ li(slot_register, Operand(Smi::FromInt(index))); | 2960 __ li(slot_register, Operand(Smi::FromInt(index))); |
2961 } | 2961 } |
2962 | 2962 |
2963 | 2963 |
| 2964 template <class T> |
| 2965 void LCodeGen::EmitVectorStoreICRegisters(T* instr) { |
| 2966 Register vector_register = ToRegister(instr->temp_vector()); |
| 2967 Register slot_register = ToRegister(instr->temp_slot()); |
| 2968 |
| 2969 AllowDeferredHandleDereference vector_structure_check; |
| 2970 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| 2971 __ li(vector_register, vector); |
| 2972 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
| 2973 int index = vector->GetIndex(slot); |
| 2974 __ li(slot_register, Operand(Smi::FromInt(index))); |
| 2975 } |
| 2976 |
| 2977 |
2964 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2978 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2965 DCHECK(ToRegister(instr->context()).is(cp)); | 2979 DCHECK(ToRegister(instr->context()).is(cp)); |
2966 DCHECK(ToRegister(instr->global_object()) | 2980 DCHECK(ToRegister(instr->global_object()) |
2967 .is(LoadDescriptor::ReceiverRegister())); | 2981 .is(LoadDescriptor::ReceiverRegister())); |
2968 DCHECK(ToRegister(instr->result()).is(v0)); | 2982 DCHECK(ToRegister(instr->result()).is(v0)); |
2969 | 2983 |
2970 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); | 2984 __ li(LoadDescriptor::NameRegister(), Operand(instr->name())); |
2971 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2985 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2972 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2986 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2973 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 2987 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
(...skipping 1363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4337 instr->hydrogen()->PointersToHereCheckForValue()); | 4351 instr->hydrogen()->PointersToHereCheckForValue()); |
4338 } | 4352 } |
4339 } | 4353 } |
4340 | 4354 |
4341 | 4355 |
4342 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4356 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4343 DCHECK(ToRegister(instr->context()).is(cp)); | 4357 DCHECK(ToRegister(instr->context()).is(cp)); |
4344 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4358 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4345 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4359 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4346 | 4360 |
| 4361 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4362 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); |
| 4363 } |
| 4364 |
4347 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); | 4365 __ li(StoreDescriptor::NameRegister(), Operand(instr->name())); |
4348 Handle<Code> ic = | 4366 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4349 StoreIC::initialize_stub(isolate(), instr->language_mode(), | 4367 isolate(), instr->language_mode(), |
4350 instr->hydrogen()->initialization_state()); | 4368 instr->hydrogen()->initialization_state()).code(); |
4351 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4369 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4352 } | 4370 } |
4353 | 4371 |
4354 | 4372 |
4355 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4373 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4356 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; | 4374 Condition cc = instr->hydrogen()->allow_equality() ? hi : hs; |
4357 Operand operand((int64_t)0); | 4375 Operand operand((int64_t)0); |
4358 Register reg; | 4376 Register reg; |
4359 if (instr->index()->IsConstantOperand()) { | 4377 if (instr->index()->IsConstantOperand()) { |
4360 operand = ToOperand(instr->index()); | 4378 operand = ToOperand(instr->index()); |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4593 } | 4611 } |
4594 } | 4612 } |
4595 | 4613 |
4596 | 4614 |
4597 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4615 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4598 DCHECK(ToRegister(instr->context()).is(cp)); | 4616 DCHECK(ToRegister(instr->context()).is(cp)); |
4599 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4617 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4600 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4618 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4601 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4619 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4602 | 4620 |
| 4621 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4622 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); |
| 4623 } |
| 4624 |
4603 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( | 4625 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( |
4604 isolate(), instr->language_mode(), | 4626 isolate(), instr->language_mode(), |
4605 instr->hydrogen()->initialization_state()).code(); | 4627 instr->hydrogen()->initialization_state()).code(); |
4606 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4628 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4607 } | 4629 } |
4608 | 4630 |
4609 | 4631 |
4610 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { | 4632 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { |
4611 class DeferredMaybeGrowElements final : public LDeferredCode { | 4633 class DeferredMaybeGrowElements final : public LDeferredCode { |
4612 public: | 4634 public: |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6185 __ Push(at, ToRegister(instr->function())); | 6207 __ Push(at, ToRegister(instr->function())); |
6186 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6208 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6187 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6209 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6188 } | 6210 } |
6189 | 6211 |
6190 | 6212 |
6191 #undef __ | 6213 #undef __ |
6192 | 6214 |
6193 } // namespace internal | 6215 } // namespace internal |
6194 } // namespace v8 | 6216 } // namespace v8 |
OLD | NEW |