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