OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); | 1024 __ LoadRoot(ip, Heap::kHashTableMapRootIndex); |
1025 __ cmp(r4, ip); | 1025 __ cmp(r4, ip); |
1026 __ b(eq, &probe_dictionary); | 1026 __ b(eq, &probe_dictionary); |
1027 | 1027 |
1028 // Load the map of the receiver, compute the keyed lookup cache hash | 1028 // Load the map of the receiver, compute the keyed lookup cache hash |
1029 // based on 32 bits of the map pointer and the string hash. | 1029 // based on 32 bits of the map pointer and the string hash. |
1030 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); | 1030 __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
1031 __ mov(r3, Operand(r2, ASR, KeyedLookupCache::kMapHashShift)); | 1031 __ mov(r3, Operand(r2, ASR, KeyedLookupCache::kMapHashShift)); |
1032 __ ldr(r4, FieldMemOperand(r0, String::kHashFieldOffset)); | 1032 __ ldr(r4, FieldMemOperand(r0, String::kHashFieldOffset)); |
1033 __ eor(r3, r3, Operand(r4, ASR, String::kHashShift)); | 1033 __ eor(r3, r3, Operand(r4, ASR, String::kHashShift)); |
1034 __ And(r3, r3, Operand(KeyedLookupCache::kCapacityMask)); | 1034 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; |
| 1035 __ And(r3, r3, Operand(mask)); |
1035 | 1036 |
1036 // Load the key (consisting of map and symbol) from the cache and | 1037 // Load the key (consisting of map and symbol) from the cache and |
1037 // check for match. | 1038 // check for match. |
| 1039 Label try_second_entry, hit_on_first_entry, load_in_object_property; |
1038 ExternalReference cache_keys = | 1040 ExternalReference cache_keys = |
1039 ExternalReference::keyed_lookup_cache_keys(isolate); | 1041 ExternalReference::keyed_lookup_cache_keys(isolate); |
1040 __ mov(r4, Operand(cache_keys)); | 1042 __ mov(r4, Operand(cache_keys)); |
1041 __ add(r4, r4, Operand(r3, LSL, kPointerSizeLog2 + 1)); | 1043 __ add(r4, r4, Operand(r3, LSL, kPointerSizeLog2 + 1)); |
| 1044 // Move r4 to second entry. |
| 1045 __ ldr(r5, MemOperand(r4, kPointerSize * 2, PostIndex)); |
| 1046 __ cmp(r2, r5); |
| 1047 __ b(ne, &try_second_entry); |
| 1048 __ ldr(r5, MemOperand(r4, -kPointerSize)); // Load symbol |
| 1049 __ cmp(r0, r5); |
| 1050 __ b(eq, &hit_on_first_entry); |
| 1051 |
| 1052 __ bind(&try_second_entry); |
1042 __ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); // Move r4 to symbol. | 1053 __ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); // Move r4 to symbol. |
1043 __ cmp(r2, r5); | 1054 __ cmp(r2, r5); |
1044 __ b(ne, &slow); | 1055 __ b(ne, &slow); |
1045 __ ldr(r5, MemOperand(r4)); | 1056 __ ldr(r5, MemOperand(r4)); |
1046 __ cmp(r0, r5); | 1057 __ cmp(r0, r5); |
1047 __ b(ne, &slow); | 1058 __ b(ne, &slow); |
1048 | 1059 |
1049 // Get field offset. | 1060 // Get field offset. |
1050 // r0 : key | 1061 // r0 : key |
1051 // r1 : receiver | 1062 // r1 : receiver |
1052 // r2 : receiver's map | 1063 // r2 : receiver's map |
1053 // r3 : lookup cache index | 1064 // r3 : lookup cache index |
1054 ExternalReference cache_field_offsets = | 1065 ExternalReference cache_field_offsets = |
1055 ExternalReference::keyed_lookup_cache_field_offsets(isolate); | 1066 ExternalReference::keyed_lookup_cache_field_offsets(isolate); |
| 1067 |
| 1068 // Hit on second entry. |
| 1069 __ mov(r4, Operand(cache_field_offsets)); |
| 1070 __ add(r3, r3, Operand(1)); |
| 1071 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); |
| 1072 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); |
| 1073 __ sub(r5, r5, r6, SetCC); |
| 1074 __ b(ge, &property_array_property); |
| 1075 __ jmp(&load_in_object_property); |
| 1076 |
| 1077 // Hit on first entry. |
| 1078 __ bind(&hit_on_first_entry); |
1056 __ mov(r4, Operand(cache_field_offsets)); | 1079 __ mov(r4, Operand(cache_field_offsets)); |
1057 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); | 1080 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); |
1058 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); | 1081 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); |
1059 __ sub(r5, r5, r6, SetCC); | 1082 __ sub(r5, r5, r6, SetCC); |
1060 __ b(ge, &property_array_property); | 1083 __ b(ge, &property_array_property); |
1061 | 1084 |
1062 // Load in-object property. | 1085 // Load in-object property. |
| 1086 __ bind(&load_in_object_property); |
1063 __ ldrb(r6, FieldMemOperand(r2, Map::kInstanceSizeOffset)); | 1087 __ ldrb(r6, FieldMemOperand(r2, Map::kInstanceSizeOffset)); |
1064 __ add(r6, r6, r5); // Index from start of object. | 1088 __ add(r6, r6, r5); // Index from start of object. |
1065 __ sub(r1, r1, Operand(kHeapObjectTag)); // Remove the heap tag. | 1089 __ sub(r1, r1, Operand(kHeapObjectTag)); // Remove the heap tag. |
1066 __ ldr(r0, MemOperand(r1, r6, LSL, kPointerSizeLog2)); | 1090 __ ldr(r0, MemOperand(r1, r6, LSL, kPointerSizeLog2)); |
1067 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), | 1091 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), |
1068 1, r2, r3); | 1092 1, r2, r3); |
1069 __ Ret(); | 1093 __ Ret(); |
1070 | 1094 |
1071 // Load property array property. | 1095 // Load property array property. |
1072 __ bind(&property_array_property); | 1096 __ bind(&property_array_property); |
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 Register reg = Assembler::GetRn(instr_at_patch); | 1703 Register reg = Assembler::GetRn(instr_at_patch); |
1680 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 1704 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
1681 patcher.EmitCondition(eq); | 1705 patcher.EmitCondition(eq); |
1682 } | 1706 } |
1683 } | 1707 } |
1684 | 1708 |
1685 | 1709 |
1686 } } // namespace v8::internal | 1710 } } // namespace v8::internal |
1687 | 1711 |
1688 #endif // V8_TARGET_ARCH_ARM | 1712 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |