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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 3535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3546 // at least one map/handler pair. | 3546 // at least one map/handler pair. |
3547 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | 3547 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, |
3548 FixedArray::kHeaderSize + kPointerSize)); | 3548 FixedArray::kHeaderSize + kPointerSize)); |
3549 HandleArrayCases(masm, receiver, key, vector, slot, feedback, false, &miss); | 3549 HandleArrayCases(masm, receiver, key, vector, slot, feedback, false, &miss); |
3550 | 3550 |
3551 __ bind(&miss); | 3551 __ bind(&miss); |
3552 KeyedLoadIC::GenerateMiss(masm); | 3552 KeyedLoadIC::GenerateMiss(masm); |
3553 } | 3553 } |
3554 | 3554 |
3555 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3555 void StoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3556 __ EmitLoadTypeFeedbackVector(VectorStoreICDescriptor::VectorRegister()); | 3556 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3557 StoreICStub stub(isolate(), state()); | 3557 StoreICStub stub(isolate(), state()); |
3558 stub.GenerateForTrampoline(masm); | 3558 stub.GenerateForTrampoline(masm); |
3559 } | 3559 } |
3560 | 3560 |
3561 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 3561 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
3562 __ EmitLoadTypeFeedbackVector(VectorStoreICDescriptor::VectorRegister()); | 3562 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
3563 KeyedStoreICStub stub(isolate(), state()); | 3563 KeyedStoreICStub stub(isolate(), state()); |
3564 stub.GenerateForTrampoline(masm); | 3564 stub.GenerateForTrampoline(masm); |
3565 } | 3565 } |
3566 | 3566 |
3567 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | 3567 void StoreICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } |
3568 | 3568 |
3569 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3569 void StoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3570 GenerateImpl(masm, true); | 3570 GenerateImpl(masm, true); |
3571 } | 3571 } |
3572 | 3572 |
(...skipping 24 matching lines...) Expand all Loading... |
3597 __ mov(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); | 3597 __ mov(cached_map, FieldOperand(feedback, FixedArray::OffsetOfElementAt(0))); |
3598 | 3598 |
3599 // A named keyed store might have a 2 element array, all other cases can count | 3599 // A named keyed store might have a 2 element array, all other cases can count |
3600 // on an array with at least 2 {map, handler} pairs, so they can go right | 3600 // on an array with at least 2 {map, handler} pairs, so they can go right |
3601 // into polymorphic array handling. | 3601 // into polymorphic array handling. |
3602 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); | 3602 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); |
3603 __ j(not_equal, &start_polymorphic); | 3603 __ j(not_equal, &start_polymorphic); |
3604 | 3604 |
3605 // found, now call handler. | 3605 // found, now call handler. |
3606 Register handler = feedback; | 3606 Register handler = feedback; |
3607 DCHECK(handler.is(VectorStoreICDescriptor::ValueRegister())); | 3607 DCHECK(handler.is(StoreWithVectorDescriptor::ValueRegister())); |
3608 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); | 3608 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); |
3609 __ pop(vector); | 3609 __ pop(vector); |
3610 __ pop(receiver); | 3610 __ pop(receiver); |
3611 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); | 3611 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
3612 __ mov(Operand::StaticVariable(virtual_register), handler); | 3612 __ mov(Operand::StaticVariable(virtual_register), handler); |
3613 __ pop(handler); // Pop "value". | 3613 __ pop(handler); // Pop "value". |
3614 __ jmp(Operand::StaticVariable(virtual_register)); | 3614 __ jmp(Operand::StaticVariable(virtual_register)); |
3615 | 3615 |
3616 // Polymorphic, we have to loop from 2 to N | 3616 // Polymorphic, we have to loop from 2 to N |
3617 __ bind(&start_polymorphic); | 3617 __ bind(&start_polymorphic); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3657 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3658 __ jmp(&compare_map); | 3658 __ jmp(&compare_map); |
3659 } | 3659 } |
3660 | 3660 |
3661 | 3661 |
3662 static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, | 3662 static void HandleMonomorphicStoreCase(MacroAssembler* masm, Register receiver, |
3663 Register key, Register vector, | 3663 Register key, Register vector, |
3664 Register slot, Register weak_cell, | 3664 Register slot, Register weak_cell, |
3665 Label* miss) { | 3665 Label* miss) { |
3666 // The store ic value is on the stack. | 3666 // The store ic value is on the stack. |
3667 DCHECK(weak_cell.is(VectorStoreICDescriptor::ValueRegister())); | 3667 DCHECK(weak_cell.is(StoreWithVectorDescriptor::ValueRegister())); |
3668 ExternalReference virtual_register = | 3668 ExternalReference virtual_register = |
3669 ExternalReference::virtual_handler_register(masm->isolate()); | 3669 ExternalReference::virtual_handler_register(masm->isolate()); |
3670 | 3670 |
3671 // feedback initially contains the feedback array | 3671 // feedback initially contains the feedback array |
3672 Label compare_smi_map; | 3672 Label compare_smi_map; |
3673 | 3673 |
3674 // Move the weak map into the weak_cell register. | 3674 // Move the weak map into the weak_cell register. |
3675 Register ic_map = weak_cell; | 3675 Register ic_map = weak_cell; |
3676 __ mov(ic_map, FieldOperand(weak_cell, WeakCell::kValueOffset)); | 3676 __ mov(ic_map, FieldOperand(weak_cell, WeakCell::kValueOffset)); |
3677 | 3677 |
(...skipping 18 matching lines...) Expand all Loading... |
3696 __ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, | 3696 __ mov(weak_cell, FieldOperand(vector, slot, times_half_pointer_size, |
3697 FixedArray::kHeaderSize + kPointerSize)); | 3697 FixedArray::kHeaderSize + kPointerSize)); |
3698 __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); | 3698 __ lea(weak_cell, FieldOperand(weak_cell, Code::kHeaderSize)); |
3699 __ mov(Operand::StaticVariable(virtual_register), weak_cell); | 3699 __ mov(Operand::StaticVariable(virtual_register), weak_cell); |
3700 __ pop(weak_cell); // Pop "value". | 3700 __ pop(weak_cell); // Pop "value". |
3701 // jump to the handler. | 3701 // jump to the handler. |
3702 __ jmp(Operand::StaticVariable(virtual_register)); | 3702 __ jmp(Operand::StaticVariable(virtual_register)); |
3703 } | 3703 } |
3704 | 3704 |
3705 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 3705 void StoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
3706 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // edx | 3706 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // edx |
3707 Register key = VectorStoreICDescriptor::NameRegister(); // ecx | 3707 Register key = StoreWithVectorDescriptor::NameRegister(); // ecx |
3708 Register value = VectorStoreICDescriptor::ValueRegister(); // eax | 3708 Register value = StoreWithVectorDescriptor::ValueRegister(); // eax |
3709 Register vector = VectorStoreICDescriptor::VectorRegister(); // ebx | 3709 Register vector = StoreWithVectorDescriptor::VectorRegister(); // ebx |
3710 Register slot = VectorStoreICDescriptor::SlotRegister(); // edi | 3710 Register slot = StoreWithVectorDescriptor::SlotRegister(); // edi |
3711 Label miss; | 3711 Label miss; |
3712 | 3712 |
3713 __ push(value); | 3713 __ push(value); |
3714 | 3714 |
3715 Register scratch = value; | 3715 Register scratch = value; |
3716 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, | 3716 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, |
3717 FixedArray::kHeaderSize)); | 3717 FixedArray::kHeaderSize)); |
3718 | 3718 |
3719 // Is it a weak cell? | 3719 // Is it a weak cell? |
3720 Label try_array; | 3720 Label try_array; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3861 __ pop(vector); | 3861 __ pop(vector); |
3862 __ pop(receiver); | 3862 __ pop(receiver); |
3863 __ jmp(miss); | 3863 __ jmp(miss); |
3864 | 3864 |
3865 __ bind(&load_smi_map); | 3865 __ bind(&load_smi_map); |
3866 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 3866 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
3867 __ jmp(&compare_map); | 3867 __ jmp(&compare_map); |
3868 } | 3868 } |
3869 | 3869 |
3870 void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | 3870 void KeyedStoreICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { |
3871 Register receiver = VectorStoreICDescriptor::ReceiverRegister(); // edx | 3871 Register receiver = StoreWithVectorDescriptor::ReceiverRegister(); // edx |
3872 Register key = VectorStoreICDescriptor::NameRegister(); // ecx | 3872 Register key = StoreWithVectorDescriptor::NameRegister(); // ecx |
3873 Register value = VectorStoreICDescriptor::ValueRegister(); // eax | 3873 Register value = StoreWithVectorDescriptor::ValueRegister(); // eax |
3874 Register vector = VectorStoreICDescriptor::VectorRegister(); // ebx | 3874 Register vector = StoreWithVectorDescriptor::VectorRegister(); // ebx |
3875 Register slot = VectorStoreICDescriptor::SlotRegister(); // edi | 3875 Register slot = StoreWithVectorDescriptor::SlotRegister(); // edi |
3876 Label miss; | 3876 Label miss; |
3877 | 3877 |
3878 __ push(value); | 3878 __ push(value); |
3879 | 3879 |
3880 Register scratch = value; | 3880 Register scratch = value; |
3881 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, | 3881 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, |
3882 FixedArray::kHeaderSize)); | 3882 FixedArray::kHeaderSize)); |
3883 | 3883 |
3884 // Is it a weak cell? | 3884 // Is it a weak cell? |
3885 Label try_array; | 3885 Label try_array; |
(...skipping 1601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5487 kStackUnwindSpace, nullptr, return_value_operand, | 5487 kStackUnwindSpace, nullptr, return_value_operand, |
5488 NULL); | 5488 NULL); |
5489 } | 5489 } |
5490 | 5490 |
5491 #undef __ | 5491 #undef __ |
5492 | 5492 |
5493 } // namespace internal | 5493 } // namespace internal |
5494 } // namespace v8 | 5494 } // namespace v8 |
5495 | 5495 |
5496 #endif // V8_TARGET_ARCH_IA32 | 5496 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |