OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2848 AllowDeferredHandleDereference vector_structure_check; | 2848 AllowDeferredHandleDereference vector_structure_check; |
2849 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 2849 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
2850 __ Move(vector_register, vector); | 2850 __ Move(vector_register, vector); |
2851 // No need to allocate this register. | 2851 // No need to allocate this register. |
2852 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 2852 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
2853 int index = vector->GetIndex(slot); | 2853 int index = vector->GetIndex(slot); |
2854 __ Move(slot_register, Smi::FromInt(index)); | 2854 __ Move(slot_register, Smi::FromInt(index)); |
2855 } | 2855 } |
2856 | 2856 |
2857 | 2857 |
| 2858 template <class T> |
| 2859 void LCodeGen::EmitVectorStoreICRegisters(T* instr) { |
| 2860 Register vector_register = ToRegister(instr->temp_vector()); |
| 2861 Register slot_register = ToRegister(instr->temp_slot()); |
| 2862 |
| 2863 AllowDeferredHandleDereference vector_structure_check; |
| 2864 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| 2865 __ Move(vector_register, vector); |
| 2866 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
| 2867 int index = vector->GetIndex(slot); |
| 2868 __ Move(slot_register, Smi::FromInt(index)); |
| 2869 } |
| 2870 |
| 2871 |
2858 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2872 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2859 DCHECK(ToRegister(instr->context()).is(rsi)); | 2873 DCHECK(ToRegister(instr->context()).is(rsi)); |
2860 DCHECK(ToRegister(instr->global_object()) | 2874 DCHECK(ToRegister(instr->global_object()) |
2861 .is(LoadDescriptor::ReceiverRegister())); | 2875 .is(LoadDescriptor::ReceiverRegister())); |
2862 DCHECK(ToRegister(instr->result()).is(rax)); | 2876 DCHECK(ToRegister(instr->result()).is(rax)); |
2863 | 2877 |
2864 __ Move(LoadDescriptor::NameRegister(), instr->name()); | 2878 __ Move(LoadDescriptor::NameRegister(), instr->name()); |
2865 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2879 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2866 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2880 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2867 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 2881 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4201 hinstr->PointersToHereCheckForValue()); | 4215 hinstr->PointersToHereCheckForValue()); |
4202 } | 4216 } |
4203 } | 4217 } |
4204 | 4218 |
4205 | 4219 |
4206 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4220 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4207 DCHECK(ToRegister(instr->context()).is(rsi)); | 4221 DCHECK(ToRegister(instr->context()).is(rsi)); |
4208 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4222 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4209 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4223 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4210 | 4224 |
| 4225 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4226 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); |
| 4227 } |
| 4228 |
4211 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); | 4229 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); |
4212 Handle<Code> ic = | 4230 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4213 StoreIC::initialize_stub(isolate(), instr->language_mode(), | 4231 isolate(), instr->language_mode(), |
4214 instr->hydrogen()->initialization_state()); | 4232 instr->hydrogen()->initialization_state()).code(); |
4215 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4233 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4216 } | 4234 } |
4217 | 4235 |
4218 | 4236 |
4219 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4237 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4220 Representation representation = instr->hydrogen()->length()->representation(); | 4238 Representation representation = instr->hydrogen()->length()->representation(); |
4221 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4239 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4222 DCHECK(representation.IsSmiOrInteger32()); | 4240 DCHECK(representation.IsSmiOrInteger32()); |
4223 | 4241 |
4224 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; | 4242 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4463 } | 4481 } |
4464 } | 4482 } |
4465 | 4483 |
4466 | 4484 |
4467 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4485 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4468 DCHECK(ToRegister(instr->context()).is(rsi)); | 4486 DCHECK(ToRegister(instr->context()).is(rsi)); |
4469 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4487 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4470 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4488 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4471 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4489 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4472 | 4490 |
| 4491 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4492 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); |
| 4493 } |
| 4494 |
4473 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( | 4495 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( |
4474 isolate(), instr->language_mode(), | 4496 isolate(), instr->language_mode(), |
4475 instr->hydrogen()->initialization_state()).code(); | 4497 instr->hydrogen()->initialization_state()).code(); |
4476 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4498 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4477 } | 4499 } |
4478 | 4500 |
4479 | 4501 |
4480 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { | 4502 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { |
4481 class DeferredMaybeGrowElements final : public LDeferredCode { | 4503 class DeferredMaybeGrowElements final : public LDeferredCode { |
4482 public: | 4504 public: |
(...skipping 1500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5983 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6005 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5984 } | 6006 } |
5985 | 6007 |
5986 | 6008 |
5987 #undef __ | 6009 #undef __ |
5988 | 6010 |
5989 } // namespace internal | 6011 } // namespace internal |
5990 } // namespace v8 | 6012 } // namespace v8 |
5991 | 6013 |
5992 #endif // V8_TARGET_ARCH_X64 | 6014 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |