| 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/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 4555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4566 | 4566 |
| 4567 void VectorStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { | 4567 void VectorStoreICStub::GenerateForTrampoline(MacroAssembler* masm) { |
| 4568 GenerateImpl(masm, true); | 4568 GenerateImpl(masm, true); |
| 4569 } | 4569 } |
| 4570 | 4570 |
| 4571 | 4571 |
| 4572 // value is on the stack already. | 4572 // value is on the stack already. |
| 4573 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, | 4573 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
| 4574 Register key, Register vector, | 4574 Register key, Register vector, |
| 4575 Register slot, Register feedback, | 4575 Register slot, Register feedback, |
| 4576 Label* miss) { | 4576 bool is_polymorphic, Label* miss) { |
| 4577 // feedback initially contains the feedback array | 4577 // feedback initially contains the feedback array |
| 4578 Label next, next_loop, prepare_next; | 4578 Label next, next_loop, prepare_next; |
| 4579 Label load_smi_map, compare_map; | 4579 Label load_smi_map, compare_map; |
| 4580 Label start_polymorphic; | 4580 Label start_polymorphic; |
| 4581 Label pop_and_miss; |
| 4581 ExternalReference virtual_register = | 4582 ExternalReference virtual_register = |
| 4582 ExternalReference::virtual_handler_register(masm->isolate()); | 4583 ExternalReference::virtual_handler_register(masm->isolate()); |
| 4583 | 4584 |
| 4584 __ push(receiver); | 4585 __ push(receiver); |
| 4585 __ push(vector); | 4586 __ push(vector); |
| 4586 | 4587 |
| 4587 Register receiver_map = receiver; | 4588 Register receiver_map = receiver; |
| 4588 Register cached_map = vector; | 4589 Register cached_map = vector; |
| 4589 | 4590 |
| 4590 // Receiver might not be a heap object. | 4591 // Receiver might not be a heap object. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4604 DCHECK(handler.is(VectorStoreICDescriptor::ValueRegister())); | 4605 DCHECK(handler.is(VectorStoreICDescriptor::ValueRegister())); |
| 4605 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); | 4606 __ mov(handler, FieldOperand(feedback, FixedArray::OffsetOfElementAt(1))); |
| 4606 __ pop(vector); | 4607 __ pop(vector); |
| 4607 __ pop(receiver); | 4608 __ pop(receiver); |
| 4608 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); | 4609 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
| 4609 __ mov(Operand::StaticVariable(virtual_register), handler); | 4610 __ mov(Operand::StaticVariable(virtual_register), handler); |
| 4610 __ pop(handler); // Pop "value". | 4611 __ pop(handler); // Pop "value". |
| 4611 __ jmp(Operand::StaticVariable(virtual_register)); | 4612 __ jmp(Operand::StaticVariable(virtual_register)); |
| 4612 | 4613 |
| 4613 // Polymorphic, we have to loop from 2 to N | 4614 // Polymorphic, we have to loop from 2 to N |
| 4614 | |
| 4615 // TODO(mvstanton): I think there is a bug here, we are assuming the | |
| 4616 // array has more than one map/handler pair, but we call this function in the | |
| 4617 // keyed store with a string key case, where it might be just an array of two | |
| 4618 // elements. | |
| 4619 | |
| 4620 __ bind(&start_polymorphic); | 4615 __ bind(&start_polymorphic); |
| 4621 __ push(key); | 4616 __ push(key); |
| 4622 Register counter = key; | 4617 Register counter = key; |
| 4623 __ mov(counter, Immediate(Smi::FromInt(2))); | 4618 __ mov(counter, Immediate(Smi::FromInt(2))); |
| 4619 |
| 4620 if (!is_polymorphic) { |
| 4621 // If is_polymorphic is false, we may only have a two element array. |
| 4622 // Check against length now in that case. |
| 4623 __ cmp(counter, FieldOperand(feedback, FixedArray::kLengthOffset)); |
| 4624 __ j(greater_equal, &pop_and_miss); |
| 4625 } |
| 4626 |
| 4624 __ bind(&next_loop); | 4627 __ bind(&next_loop); |
| 4625 __ mov(cached_map, FieldOperand(feedback, counter, times_half_pointer_size, | 4628 __ mov(cached_map, FieldOperand(feedback, counter, times_half_pointer_size, |
| 4626 FixedArray::kHeaderSize)); | 4629 FixedArray::kHeaderSize)); |
| 4627 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); | 4630 __ cmp(receiver_map, FieldOperand(cached_map, WeakCell::kValueOffset)); |
| 4628 __ j(not_equal, &prepare_next); | 4631 __ j(not_equal, &prepare_next); |
| 4629 __ mov(handler, FieldOperand(feedback, counter, times_half_pointer_size, | 4632 __ mov(handler, FieldOperand(feedback, counter, times_half_pointer_size, |
| 4630 FixedArray::kHeaderSize + kPointerSize)); | 4633 FixedArray::kHeaderSize + kPointerSize)); |
| 4631 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); | 4634 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
| 4632 __ pop(key); | 4635 __ pop(key); |
| 4633 __ pop(vector); | 4636 __ pop(vector); |
| 4634 __ pop(receiver); | 4637 __ pop(receiver); |
| 4635 __ mov(Operand::StaticVariable(virtual_register), handler); | 4638 __ mov(Operand::StaticVariable(virtual_register), handler); |
| 4636 __ pop(handler); // Pop "value". | 4639 __ pop(handler); // Pop "value". |
| 4637 __ jmp(Operand::StaticVariable(virtual_register)); | 4640 __ jmp(Operand::StaticVariable(virtual_register)); |
| 4638 | 4641 |
| 4639 __ bind(&prepare_next); | 4642 __ bind(&prepare_next); |
| 4640 __ add(counter, Immediate(Smi::FromInt(2))); | 4643 __ add(counter, Immediate(Smi::FromInt(2))); |
| 4641 __ cmp(counter, FieldOperand(feedback, FixedArray::kLengthOffset)); | 4644 __ cmp(counter, FieldOperand(feedback, FixedArray::kLengthOffset)); |
| 4642 __ j(less, &next_loop); | 4645 __ j(less, &next_loop); |
| 4643 | 4646 |
| 4644 // We exhausted our array of map handler pairs. | 4647 // We exhausted our array of map handler pairs. |
| 4648 __ bind(&pop_and_miss); |
| 4645 __ pop(key); | 4649 __ pop(key); |
| 4646 __ pop(vector); | 4650 __ pop(vector); |
| 4647 __ pop(receiver); | 4651 __ pop(receiver); |
| 4648 __ jmp(miss); | 4652 __ jmp(miss); |
| 4649 | 4653 |
| 4650 __ bind(&load_smi_map); | 4654 __ bind(&load_smi_map); |
| 4651 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | 4655 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); |
| 4652 __ jmp(&compare_map); | 4656 __ jmp(&compare_map); |
| 4653 } | 4657 } |
| 4654 | 4658 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4715 Label try_array; | 4719 Label try_array; |
| 4716 Label not_array, smi_key, key_okay; | 4720 Label not_array, smi_key, key_okay; |
| 4717 __ CompareRoot(FieldOperand(scratch, 0), Heap::kWeakCellMapRootIndex); | 4721 __ CompareRoot(FieldOperand(scratch, 0), Heap::kWeakCellMapRootIndex); |
| 4718 __ j(not_equal, &try_array); | 4722 __ j(not_equal, &try_array); |
| 4719 HandleMonomorphicStoreCase(masm, receiver, key, vector, slot, scratch, &miss); | 4723 HandleMonomorphicStoreCase(masm, receiver, key, vector, slot, scratch, &miss); |
| 4720 | 4724 |
| 4721 // Is it a fixed array? | 4725 // Is it a fixed array? |
| 4722 __ bind(&try_array); | 4726 __ bind(&try_array); |
| 4723 __ CompareRoot(FieldOperand(scratch, 0), Heap::kFixedArrayMapRootIndex); | 4727 __ CompareRoot(FieldOperand(scratch, 0), Heap::kFixedArrayMapRootIndex); |
| 4724 __ j(not_equal, ¬_array); | 4728 __ j(not_equal, ¬_array); |
| 4725 HandlePolymorphicStoreCase(masm, receiver, key, vector, slot, scratch, &miss); | 4729 HandlePolymorphicStoreCase(masm, receiver, key, vector, slot, scratch, true, |
| 4730 &miss); |
| 4726 | 4731 |
| 4727 __ bind(¬_array); | 4732 __ bind(¬_array); |
| 4728 __ CompareRoot(scratch, Heap::kmegamorphic_symbolRootIndex); | 4733 __ CompareRoot(scratch, Heap::kmegamorphic_symbolRootIndex); |
| 4729 __ j(not_equal, &miss); | 4734 __ j(not_equal, &miss); |
| 4730 | 4735 |
| 4731 __ pop(value); | 4736 __ pop(value); |
| 4732 __ push(slot); | 4737 __ push(slot); |
| 4733 __ push(vector); | 4738 __ push(vector); |
| 4734 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( | 4739 Code::Flags code_flags = Code::RemoveTypeAndHolderFromFlags( |
| 4735 Code::ComputeHandlerFlags(Code::STORE_IC)); | 4740 Code::ComputeHandlerFlags(Code::STORE_IC)); |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4906 __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET); | 4911 __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET); |
| 4907 | 4912 |
| 4908 __ bind(&try_poly_name); | 4913 __ bind(&try_poly_name); |
| 4909 // We might have a name in feedback, and a fixed array in the next slot. | 4914 // We might have a name in feedback, and a fixed array in the next slot. |
| 4910 __ cmp(key, scratch); | 4915 __ cmp(key, scratch); |
| 4911 __ j(not_equal, &miss); | 4916 __ j(not_equal, &miss); |
| 4912 // If the name comparison succeeded, we know we have a fixed array with | 4917 // If the name comparison succeeded, we know we have a fixed array with |
| 4913 // at least one map/handler pair. | 4918 // at least one map/handler pair. |
| 4914 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, | 4919 __ mov(scratch, FieldOperand(vector, slot, times_half_pointer_size, |
| 4915 FixedArray::kHeaderSize + kPointerSize)); | 4920 FixedArray::kHeaderSize + kPointerSize)); |
| 4916 HandlePolymorphicStoreCase(masm, receiver, key, vector, slot, scratch, &miss); | 4921 HandlePolymorphicStoreCase(masm, receiver, key, vector, slot, scratch, false, |
| 4922 &miss); |
| 4917 | 4923 |
| 4918 __ bind(&miss); | 4924 __ bind(&miss); |
| 4919 __ pop(value); | 4925 __ pop(value); |
| 4920 KeyedStoreIC::GenerateMiss(masm); | 4926 KeyedStoreIC::GenerateMiss(masm); |
| 4921 } | 4927 } |
| 4922 | 4928 |
| 4923 | 4929 |
| 4924 void CallICTrampolineStub::Generate(MacroAssembler* masm) { | 4930 void CallICTrampolineStub::Generate(MacroAssembler* masm) { |
| 4925 __ EmitLoadTypeFeedbackVector(ebx); | 4931 __ EmitLoadTypeFeedbackVector(ebx); |
| 4926 CallICStub stub(isolate(), state()); | 4932 CallICStub stub(isolate(), state()); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5843 Operand(ebp, 7 * kPointerSize), NULL); | 5849 Operand(ebp, 7 * kPointerSize), NULL); |
| 5844 } | 5850 } |
| 5845 | 5851 |
| 5846 | 5852 |
| 5847 #undef __ | 5853 #undef __ |
| 5848 | 5854 |
| 5849 } // namespace internal | 5855 } // namespace internal |
| 5850 } // namespace v8 | 5856 } // namespace v8 |
| 5851 | 5857 |
| 5852 #endif // V8_TARGET_ARCH_IA32 | 5858 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |