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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, Map::kHasNamedInterceptor, | 392 GenerateKeyedLoadReceiverCheck(masm, receiver, eax, Map::kHasNamedInterceptor, |
393 &slow); | 393 &slow); |
394 | 394 |
395 // If the receiver is a fast-case object, check the stub cache. Otherwise | 395 // If the receiver is a fast-case object, check the stub cache. Otherwise |
396 // probe the dictionary. | 396 // probe the dictionary. |
397 __ mov(ebx, FieldOperand(receiver, JSObject::kPropertiesOffset)); | 397 __ mov(ebx, FieldOperand(receiver, JSObject::kPropertiesOffset)); |
398 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), | 398 __ cmp(FieldOperand(ebx, HeapObject::kMapOffset), |
399 Immediate(isolate->factory()->hash_table_map())); | 399 Immediate(isolate->factory()->hash_table_map())); |
400 __ j(equal, &probe_dictionary); | 400 __ j(equal, &probe_dictionary); |
401 | 401 |
402 if (FLAG_vector_ics) { | 402 // The handlers in the stub cache expect a vector and slot. Since we won't |
403 // When vector ics are in use, the handlers in the stub cache expect a | 403 // change the IC from any downstream misses, a dummy vector can be used. |
404 // vector and slot. Since we won't change the IC from any downstream | 404 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( |
405 // misses, a dummy vector can be used. | 405 isolate->factory()->keyed_load_dummy_vector()); |
406 Handle<TypeFeedbackVector> dummy_vector = Handle<TypeFeedbackVector>::cast( | 406 int slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); |
407 isolate->factory()->keyed_load_dummy_vector()); | 407 __ push(Immediate(Smi::FromInt(slot))); |
408 int slot = dummy_vector->GetIndex(FeedbackVectorICSlot(0)); | 408 __ push(Immediate(dummy_vector)); |
409 __ push(Immediate(Smi::FromInt(slot))); | |
410 __ push(Immediate(dummy_vector)); | |
411 } | |
412 | 409 |
413 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( | 410 Code::Flags flags = Code::RemoveTypeAndHolderFromFlags( |
414 Code::ComputeHandlerFlags(Code::LOAD_IC)); | 411 Code::ComputeHandlerFlags(Code::LOAD_IC)); |
415 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, | 412 masm->isolate()->stub_cache()->GenerateProbe(masm, Code::KEYED_LOAD_IC, flags, |
416 false, receiver, key, ebx, edi); | 413 false, receiver, key, ebx, edi); |
417 | 414 |
418 if (FLAG_vector_ics) { | 415 __ pop(VectorLoadICDescriptor::VectorRegister()); |
419 __ pop(VectorLoadICDescriptor::VectorRegister()); | 416 __ pop(VectorLoadICDescriptor::SlotRegister()); |
420 __ pop(VectorLoadICDescriptor::SlotRegister()); | |
421 } | |
422 | 417 |
423 // Cache miss. | 418 // Cache miss. |
424 GenerateMiss(masm); | 419 GenerateMiss(masm); |
425 | 420 |
426 // Do a quick inline probe of the receiver's dictionary, if it | 421 // Do a quick inline probe of the receiver's dictionary, if it |
427 // exists. | 422 // exists. |
428 __ bind(&probe_dictionary); | 423 __ bind(&probe_dictionary); |
429 | 424 |
430 __ mov(eax, FieldOperand(receiver, JSObject::kMapOffset)); | 425 __ mov(eax, FieldOperand(receiver, JSObject::kMapOffset)); |
431 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset)); | 426 __ movzx_b(eax, FieldOperand(eax, Map::kInstanceTypeOffset)); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 | 721 |
727 // Dictionary load failed, go slow (but don't miss). | 722 // Dictionary load failed, go slow (but don't miss). |
728 __ bind(&slow); | 723 __ bind(&slow); |
729 GenerateRuntimeGetProperty(masm); | 724 GenerateRuntimeGetProperty(masm); |
730 } | 725 } |
731 | 726 |
732 | 727 |
733 static void LoadIC_PushArgs(MacroAssembler* masm) { | 728 static void LoadIC_PushArgs(MacroAssembler* masm) { |
734 Register receiver = LoadDescriptor::ReceiverRegister(); | 729 Register receiver = LoadDescriptor::ReceiverRegister(); |
735 Register name = LoadDescriptor::NameRegister(); | 730 Register name = LoadDescriptor::NameRegister(); |
736 if (FLAG_vector_ics) { | |
737 Register slot = VectorLoadICDescriptor::SlotRegister(); | |
738 Register vector = VectorLoadICDescriptor::VectorRegister(); | |
739 DCHECK(!edi.is(receiver) && !edi.is(name) && !edi.is(slot) && | |
740 !edi.is(vector)); | |
741 | 731 |
742 __ pop(edi); | 732 Register slot = VectorLoadICDescriptor::SlotRegister(); |
743 __ push(receiver); | 733 Register vector = VectorLoadICDescriptor::VectorRegister(); |
744 __ push(name); | 734 DCHECK(!edi.is(receiver) && !edi.is(name) && !edi.is(slot) && |
745 __ push(slot); | 735 !edi.is(vector)); |
746 __ push(vector); | |
747 __ push(edi); | |
748 } else { | |
749 DCHECK(!ebx.is(receiver) && !ebx.is(name)); | |
750 | 736 |
751 __ pop(ebx); | 737 __ pop(edi); |
752 __ push(receiver); | 738 __ push(receiver); |
753 __ push(name); | 739 __ push(name); |
754 __ push(ebx); | 740 __ push(slot); |
755 } | 741 __ push(vector); |
| 742 __ push(edi); |
756 } | 743 } |
757 | 744 |
758 | 745 |
759 void LoadIC::GenerateMiss(MacroAssembler* masm) { | 746 void LoadIC::GenerateMiss(MacroAssembler* masm) { |
760 // Return address is on the stack. | 747 // Return address is on the stack. |
761 __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1); | 748 __ IncrementCounter(masm->isolate()->counters()->load_miss(), 1); |
762 LoadIC_PushArgs(masm); | 749 LoadIC_PushArgs(masm); |
763 | 750 |
764 // Perform tail call to the entry. | 751 // Perform tail call to the entry. |
765 ExternalReference ref = | 752 ExternalReference ref = |
766 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); | 753 ExternalReference(IC_Utility(kLoadIC_Miss), masm->isolate()); |
767 int arg_count = FLAG_vector_ics ? 4 : 2; | 754 int arg_count = 4; |
768 __ TailCallExternalReference(ref, arg_count, 1); | 755 __ TailCallExternalReference(ref, arg_count, 1); |
769 } | 756 } |
770 | 757 |
771 | 758 |
772 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 759 void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
773 // Return address is on the stack. | 760 // Return address is on the stack. |
774 Register receiver = LoadDescriptor::ReceiverRegister(); | 761 Register receiver = LoadDescriptor::ReceiverRegister(); |
775 Register name = LoadDescriptor::NameRegister(); | 762 Register name = LoadDescriptor::NameRegister(); |
776 DCHECK(!ebx.is(receiver) && !ebx.is(name)); | 763 DCHECK(!ebx.is(receiver) && !ebx.is(name)); |
777 | 764 |
778 __ pop(ebx); | 765 __ pop(ebx); |
779 __ push(receiver); | 766 __ push(receiver); |
780 __ push(name); | 767 __ push(name); |
781 __ push(ebx); | 768 __ push(ebx); |
782 | 769 |
783 // Perform tail call to the entry. | 770 // Perform tail call to the entry. |
784 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); | 771 __ TailCallRuntime(Runtime::kGetProperty, 2, 1); |
785 } | 772 } |
786 | 773 |
787 | 774 |
788 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { | 775 void KeyedLoadIC::GenerateMiss(MacroAssembler* masm) { |
789 // Return address is on the stack. | 776 // Return address is on the stack. |
790 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); | 777 __ IncrementCounter(masm->isolate()->counters()->keyed_load_miss(), 1); |
791 | 778 |
792 LoadIC_PushArgs(masm); | 779 LoadIC_PushArgs(masm); |
793 | 780 |
794 // Perform tail call to the entry. | 781 // Perform tail call to the entry. |
795 ExternalReference ref = | 782 ExternalReference ref = |
796 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); | 783 ExternalReference(IC_Utility(kKeyedLoadIC_Miss), masm->isolate()); |
797 int arg_count = FLAG_vector_ics ? 4 : 2; | 784 int arg_count = 4; |
798 __ TailCallExternalReference(ref, arg_count, 1); | 785 __ TailCallExternalReference(ref, arg_count, 1); |
799 } | 786 } |
800 | 787 |
801 | 788 |
802 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { | 789 void KeyedLoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) { |
803 // Return address is on the stack. | 790 // Return address is on the stack. |
804 Register receiver = LoadDescriptor::ReceiverRegister(); | 791 Register receiver = LoadDescriptor::ReceiverRegister(); |
805 Register name = LoadDescriptor::NameRegister(); | 792 Register name = LoadDescriptor::NameRegister(); |
806 DCHECK(!ebx.is(receiver) && !ebx.is(name)); | 793 DCHECK(!ebx.is(receiver) && !ebx.is(name)); |
807 | 794 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
959 Condition cc = | 946 Condition cc = |
960 (check == ENABLE_INLINED_SMI_CHECK) | 947 (check == ENABLE_INLINED_SMI_CHECK) |
961 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 948 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
962 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 949 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
963 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 950 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
964 } | 951 } |
965 } | 952 } |
966 } // namespace v8::internal | 953 } // namespace v8::internal |
967 | 954 |
968 #endif // V8_TARGET_ARCH_IA32 | 955 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |