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 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; | 1034 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; |
1035 __ And(r3, r3, Operand(mask)); | 1035 __ And(r3, r3, Operand(mask)); |
1036 | 1036 |
1037 // 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 |
1038 // check for match. | 1038 // check for match. |
1039 Label try_second_entry, hit_on_first_entry, load_in_object_property; | 1039 Label load_in_object_property; |
| 1040 static const int kEntriesPerBucket = KeyedLookupCache::kEntriesPerBucket; |
| 1041 Label hit_on_nth_entry[kEntriesPerBucket]; |
1040 ExternalReference cache_keys = | 1042 ExternalReference cache_keys = |
1041 ExternalReference::keyed_lookup_cache_keys(isolate); | 1043 ExternalReference::keyed_lookup_cache_keys(isolate); |
| 1044 |
1042 __ mov(r4, Operand(cache_keys)); | 1045 __ mov(r4, Operand(cache_keys)); |
1043 __ add(r4, r4, Operand(r3, LSL, kPointerSizeLog2 + 1)); | 1046 __ 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 | 1047 |
1052 __ bind(&try_second_entry); | 1048 for (int i = 0; i < kEntriesPerBucket - 1; i++) { |
1053 __ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); // Move r4 to symbol. | 1049 Label try_next_entry; |
| 1050 // Load map and move r4 to next entry. |
| 1051 __ ldr(r5, MemOperand(r4, kPointerSize * 2, PostIndex)); |
| 1052 __ cmp(r2, r5); |
| 1053 __ b(ne, &try_next_entry); |
| 1054 __ ldr(r5, MemOperand(r4, -kPointerSize)); // Load symbol |
| 1055 __ cmp(r0, r5); |
| 1056 __ b(eq, &hit_on_nth_entry[i]); |
| 1057 __ bind(&try_next_entry); |
| 1058 } |
| 1059 |
| 1060 // Last entry: Load map and move r4 to symbol. |
| 1061 __ ldr(r5, MemOperand(r4, kPointerSize, PostIndex)); |
1054 __ cmp(r2, r5); | 1062 __ cmp(r2, r5); |
1055 __ b(ne, &slow); | 1063 __ b(ne, &slow); |
1056 __ ldr(r5, MemOperand(r4)); | 1064 __ ldr(r5, MemOperand(r4)); |
1057 __ cmp(r0, r5); | 1065 __ cmp(r0, r5); |
1058 __ b(ne, &slow); | 1066 __ b(ne, &slow); |
1059 | 1067 |
1060 // Get field offset. | 1068 // Get field offset. |
1061 // r0 : key | 1069 // r0 : key |
1062 // r1 : receiver | 1070 // r1 : receiver |
1063 // r2 : receiver's map | 1071 // r2 : receiver's map |
1064 // r3 : lookup cache index | 1072 // r3 : lookup cache index |
1065 ExternalReference cache_field_offsets = | 1073 ExternalReference cache_field_offsets = |
1066 ExternalReference::keyed_lookup_cache_field_offsets(isolate); | 1074 ExternalReference::keyed_lookup_cache_field_offsets(isolate); |
1067 | 1075 |
1068 // Hit on second entry. | 1076 // Hit on nth entry. |
1069 __ mov(r4, Operand(cache_field_offsets)); | 1077 for (int i = kEntriesPerBucket - 1; i >= 0; i--) { |
1070 __ add(r3, r3, Operand(1)); | 1078 __ bind(&hit_on_nth_entry[i]); |
1071 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); | 1079 __ mov(r4, Operand(cache_field_offsets)); |
1072 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); | 1080 if (i != 0) { |
1073 __ sub(r5, r5, r6, SetCC); | 1081 __ add(r3, r3, Operand(i)); |
1074 __ b(ge, &property_array_property); | 1082 } |
1075 __ jmp(&load_in_object_property); | 1083 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); |
1076 | 1084 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); |
1077 // Hit on first entry. | 1085 __ sub(r5, r5, r6, SetCC); |
1078 __ bind(&hit_on_first_entry); | 1086 __ b(ge, &property_array_property); |
1079 __ mov(r4, Operand(cache_field_offsets)); | 1087 if (i != 0) { |
1080 __ ldr(r5, MemOperand(r4, r3, LSL, kPointerSizeLog2)); | 1088 __ jmp(&load_in_object_property); |
1081 __ ldrb(r6, FieldMemOperand(r2, Map::kInObjectPropertiesOffset)); | 1089 } |
1082 __ sub(r5, r5, r6, SetCC); | 1090 } |
1083 __ b(ge, &property_array_property); | |
1084 | 1091 |
1085 // Load in-object property. | 1092 // Load in-object property. |
1086 __ bind(&load_in_object_property); | 1093 __ bind(&load_in_object_property); |
1087 __ ldrb(r6, FieldMemOperand(r2, Map::kInstanceSizeOffset)); | 1094 __ ldrb(r6, FieldMemOperand(r2, Map::kInstanceSizeOffset)); |
1088 __ add(r6, r6, r5); // Index from start of object. | 1095 __ add(r6, r6, r5); // Index from start of object. |
1089 __ sub(r1, r1, Operand(kHeapObjectTag)); // Remove the heap tag. | 1096 __ sub(r1, r1, Operand(kHeapObjectTag)); // Remove the heap tag. |
1090 __ ldr(r0, MemOperand(r1, r6, LSL, kPointerSizeLog2)); | 1097 __ ldr(r0, MemOperand(r1, r6, LSL, kPointerSizeLog2)); |
1091 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), | 1098 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), |
1092 1, r2, r3); | 1099 1, r2, r3); |
1093 __ Ret(); | 1100 __ Ret(); |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 Register reg = Assembler::GetRn(instr_at_patch); | 1710 Register reg = Assembler::GetRn(instr_at_patch); |
1704 patcher.masm()->tst(reg, Operand(kSmiTagMask)); | 1711 patcher.masm()->tst(reg, Operand(kSmiTagMask)); |
1705 patcher.EmitCondition(eq); | 1712 patcher.EmitCondition(eq); |
1706 } | 1713 } |
1707 } | 1714 } |
1708 | 1715 |
1709 | 1716 |
1710 } } // namespace v8::internal | 1717 } } // namespace v8::internal |
1711 | 1718 |
1712 #endif // V8_TARGET_ARCH_ARM | 1719 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |