OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
592 __ Integer32ToSmi(key, hash); | 592 __ Integer32ToSmi(key, hash); |
593 } | 593 } |
594 | 594 |
595 | 595 |
596 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { | 596 void KeyedLoadIC::GenerateGeneric(MacroAssembler* masm) { |
597 // ----------- S t a t e ------------- | 597 // ----------- S t a t e ------------- |
598 // -- rax : key | 598 // -- rax : key |
599 // -- rdx : receiver | 599 // -- rdx : receiver |
600 // -- rsp[0] : return address | 600 // -- rsp[0] : return address |
601 // ----------------------------------- | 601 // ----------------------------------- |
602 Label slow, check_string, index_smi, index_string; | 602 Label slow, check_string, index_smi, index_string, property_array_property; |
603 Label check_pixel_array, probe_dictionary, check_number_dictionary; | 603 Label check_pixel_array, probe_dictionary, check_number_dictionary; |
604 | 604 |
605 // Check that the key is a smi. | 605 // Check that the key is a smi. |
606 __ JumpIfNotSmi(rax, &check_string); | 606 __ JumpIfNotSmi(rax, &check_string); |
607 __ bind(&index_smi); | 607 __ bind(&index_smi); |
608 // Now the key is known to be a smi. This place is also jumped to from below | 608 // Now the key is known to be a smi. This place is also jumped to from below |
609 // where a numeric string is converted to a smi. | 609 // where a numeric string is converted to a smi. |
610 | 610 |
611 GenerateKeyedLoadReceiverCheck( | 611 GenerateKeyedLoadReceiverCheck( |
612 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow); | 612 masm, rdx, rcx, Map::kHasIndexedInterceptor, &slow); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
685 ExternalReference cache_keys | 685 ExternalReference cache_keys |
686 = ExternalReference::keyed_lookup_cache_keys(); | 686 = ExternalReference::keyed_lookup_cache_keys(); |
687 __ movq(rdi, rcx); | 687 __ movq(rdi, rcx); |
688 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); | 688 __ shl(rdi, Immediate(kPointerSizeLog2 + 1)); |
689 __ movq(kScratchRegister, cache_keys); | 689 __ movq(kScratchRegister, cache_keys); |
690 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); | 690 __ cmpq(rbx, Operand(kScratchRegister, rdi, times_1, 0)); |
691 __ j(not_equal, &slow); | 691 __ j(not_equal, &slow); |
692 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); | 692 __ cmpq(rax, Operand(kScratchRegister, rdi, times_1, kPointerSize)); |
693 __ j(not_equal, &slow); | 693 __ j(not_equal, &slow); |
694 | 694 |
695 // Get field offset which is a 32-bit integer and check that it is | 695 // Get field offset, which is a 32-bit integer. |
696 // an in-object property. | |
697 ExternalReference cache_field_offsets | 696 ExternalReference cache_field_offsets |
698 = ExternalReference::keyed_lookup_cache_field_offsets(); | 697 = ExternalReference::keyed_lookup_cache_field_offsets(); |
699 __ movq(kScratchRegister, cache_field_offsets); | 698 __ movq(kScratchRegister, cache_field_offsets); |
700 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); | 699 __ movl(rdi, Operand(kScratchRegister, rcx, times_4, 0)); |
701 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); | 700 __ movzxbq(rcx, FieldOperand(rbx, Map::kInObjectPropertiesOffset)); |
702 __ subq(rdi, rcx); | 701 __ subq(rdi, rcx); |
703 __ j(above_equal, &slow); | 702 __ j(above_equal, &property_array_property); |
704 | 703 |
705 // Load in-object property. | 704 // Load in-object property. |
706 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); | 705 __ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
707 __ addq(rcx, rdi); | 706 __ addq(rcx, rdi); |
708 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); | 707 __ movq(rax, FieldOperand(rdx, rcx, times_pointer_size, 0)); |
709 __ IncrementCounter(&Counters::keyed_load_generic_lookup_cache, 1); | 708 __ IncrementCounter(&Counters::keyed_load_generic_lookup_cache, 1); |
710 __ ret(0); | 709 __ ret(0); |
711 | 710 |
| 711 // Load property array property. |
| 712 __ bind(&property_array_property); |
| 713 __ movq(rax, FieldOperand(rdx, JSObject::kPropertiesOffset)); |
| 714 __ movq(rax, FieldOperand(rax, rdi, times_pointer_size, |
| 715 FixedArray::kHeaderSize)); |
| 716 __ IncrementCounter(&Counters::keyed_load_generic_lookup_cache, 1); |
| 717 __ ret(0); |
| 718 |
712 // Do a quick inline probe of the receiver's dictionary, if it | 719 // Do a quick inline probe of the receiver's dictionary, if it |
713 // exists. | 720 // exists. |
714 __ bind(&probe_dictionary); | 721 __ bind(&probe_dictionary); |
715 // rdx: receiver | 722 // rdx: receiver |
716 // rax: key | 723 // rax: key |
717 // rbx: elements | 724 // rbx: elements |
718 | 725 |
719 __ movq(rcx, FieldOperand(rdx, JSObject::kMapOffset)); | 726 __ movq(rcx, FieldOperand(rdx, JSObject::kMapOffset)); |
720 __ movb(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset)); | 727 __ movb(rcx, FieldOperand(rcx, Map::kInstanceTypeOffset)); |
721 GenerateGlobalInstanceTypeCheck(masm, rcx, &slow); | 728 GenerateGlobalInstanceTypeCheck(masm, rcx, &slow); |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1898 GenerateMiss(masm); | 1905 GenerateMiss(masm); |
1899 } | 1906 } |
1900 | 1907 |
1901 | 1908 |
1902 #undef __ | 1909 #undef __ |
1903 | 1910 |
1904 | 1911 |
1905 } } // namespace v8::internal | 1912 } } // namespace v8::internal |
1906 | 1913 |
1907 #endif // V8_TARGET_ARCH_X64 | 1914 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |