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 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 3089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3100 AllowDeferredHandleDereference vector_structure_check; | 3100 AllowDeferredHandleDereference vector_structure_check; |
3101 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 3101 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
3102 __ mov(vector_register, vector); | 3102 __ mov(vector_register, vector); |
3103 // No need to allocate this register. | 3103 // No need to allocate this register. |
3104 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); | 3104 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
3105 int index = vector->GetIndex(slot); | 3105 int index = vector->GetIndex(slot); |
3106 __ mov(slot_register, Immediate(Smi::FromInt(index))); | 3106 __ mov(slot_register, Immediate(Smi::FromInt(index))); |
3107 } | 3107 } |
3108 | 3108 |
3109 | 3109 |
| 3110 template <class T> |
| 3111 void LCodeGen::EmitVectorStoreICRegisters(T* instr) { |
| 3112 Register vector_register = ToRegister(instr->temp_vector()); |
| 3113 Register slot_register = ToRegister(instr->temp_slot()); |
| 3114 |
| 3115 AllowDeferredHandleDereference vector_structure_check; |
| 3116 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| 3117 __ mov(vector_register, vector); |
| 3118 FeedbackVectorICSlot slot = instr->hydrogen()->slot(); |
| 3119 int index = vector->GetIndex(slot); |
| 3120 __ mov(slot_register, Immediate(Smi::FromInt(index))); |
| 3121 } |
| 3122 |
| 3123 |
3110 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 3124 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
3111 DCHECK(ToRegister(instr->context()).is(esi)); | 3125 DCHECK(ToRegister(instr->context()).is(esi)); |
3112 DCHECK(ToRegister(instr->global_object()) | 3126 DCHECK(ToRegister(instr->global_object()) |
3113 .is(LoadDescriptor::ReceiverRegister())); | 3127 .is(LoadDescriptor::ReceiverRegister())); |
3114 DCHECK(ToRegister(instr->result()).is(eax)); | 3128 DCHECK(ToRegister(instr->result()).is(eax)); |
3115 | 3129 |
3116 __ mov(LoadDescriptor::NameRegister(), instr->name()); | 3130 __ mov(LoadDescriptor::NameRegister(), instr->name()); |
3117 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 3131 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
3118 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 3132 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
3119 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 3133 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4480 instr->hydrogen()->PointersToHereCheckForValue()); | 4494 instr->hydrogen()->PointersToHereCheckForValue()); |
4481 } | 4495 } |
4482 } | 4496 } |
4483 | 4497 |
4484 | 4498 |
4485 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 4499 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
4486 DCHECK(ToRegister(instr->context()).is(esi)); | 4500 DCHECK(ToRegister(instr->context()).is(esi)); |
4487 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4501 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4488 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4502 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4489 | 4503 |
| 4504 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4505 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); |
| 4506 } |
| 4507 |
4490 __ mov(StoreDescriptor::NameRegister(), instr->name()); | 4508 __ mov(StoreDescriptor::NameRegister(), instr->name()); |
4491 Handle<Code> ic = | 4509 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4492 StoreIC::initialize_stub(isolate(), instr->language_mode(), | 4510 isolate(), instr->language_mode(), |
4493 instr->hydrogen()->initialization_state()); | 4511 instr->hydrogen()->initialization_state()).code(); |
4494 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4512 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4495 } | 4513 } |
4496 | 4514 |
4497 | 4515 |
4498 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4516 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4499 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; | 4517 Condition cc = instr->hydrogen()->allow_equality() ? above : above_equal; |
4500 if (instr->index()->IsConstantOperand()) { | 4518 if (instr->index()->IsConstantOperand()) { |
4501 __ cmp(ToOperand(instr->length()), | 4519 __ cmp(ToOperand(instr->length()), |
4502 ToImmediate(LConstantOperand::cast(instr->index()), | 4520 ToImmediate(LConstantOperand::cast(instr->index()), |
4503 instr->hydrogen()->length()->representation())); | 4521 instr->hydrogen()->length()->representation())); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4713 } | 4731 } |
4714 } | 4732 } |
4715 | 4733 |
4716 | 4734 |
4717 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4735 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4718 DCHECK(ToRegister(instr->context()).is(esi)); | 4736 DCHECK(ToRegister(instr->context()).is(esi)); |
4719 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4737 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4720 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4738 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4721 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4739 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4722 | 4740 |
| 4741 if (instr->hydrogen()->HasVectorAndSlot()) { |
| 4742 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); |
| 4743 } |
| 4744 |
4723 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( | 4745 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( |
4724 isolate(), instr->language_mode(), | 4746 isolate(), instr->language_mode(), |
4725 instr->hydrogen()->initialization_state()).code(); | 4747 instr->hydrogen()->initialization_state()).code(); |
4726 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4748 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4727 } | 4749 } |
4728 | 4750 |
4729 | 4751 |
4730 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { | 4752 void LCodeGen::DoTrapAllocationMemento(LTrapAllocationMemento* instr) { |
4731 Register object = ToRegister(instr->object()); | 4753 Register object = ToRegister(instr->object()); |
4732 Register temp = ToRegister(instr->temp()); | 4754 Register temp = ToRegister(instr->temp()); |
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6397 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6419 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6398 } | 6420 } |
6399 | 6421 |
6400 | 6422 |
6401 #undef __ | 6423 #undef __ |
6402 | 6424 |
6403 } // namespace internal | 6425 } // namespace internal |
6404 } // namespace v8 | 6426 } // namespace v8 |
6405 | 6427 |
6406 #endif // V8_TARGET_ARCH_X87 | 6428 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |