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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 __ LoadRoot(at, Heap::kHashTableMapRootIndex); | 1026 __ LoadRoot(at, Heap::kHashTableMapRootIndex); |
1027 __ Branch(&probe_dictionary, eq, t0, Operand(at)); | 1027 __ Branch(&probe_dictionary, eq, t0, Operand(at)); |
1028 | 1028 |
1029 // Load the map of the receiver, compute the keyed lookup cache hash | 1029 // Load the map of the receiver, compute the keyed lookup cache hash |
1030 // based on 32 bits of the map pointer and the string hash. | 1030 // based on 32 bits of the map pointer and the string hash. |
1031 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); | 1031 __ lw(a2, FieldMemOperand(a1, HeapObject::kMapOffset)); |
1032 __ sra(a3, a2, KeyedLookupCache::kMapHashShift); | 1032 __ sra(a3, a2, KeyedLookupCache::kMapHashShift); |
1033 __ lw(t0, FieldMemOperand(a0, String::kHashFieldOffset)); | 1033 __ lw(t0, FieldMemOperand(a0, String::kHashFieldOffset)); |
1034 __ sra(at, t0, String::kHashShift); | 1034 __ sra(at, t0, String::kHashShift); |
1035 __ xor_(a3, a3, at); | 1035 __ xor_(a3, a3, at); |
1036 __ And(a3, a3, Operand(KeyedLookupCache::kCapacityMask)); | 1036 int mask = KeyedLookupCache::kCapacityMask & KeyedLookupCache::kHashMask; |
| 1037 __ And(a3, a3, Operand(mask)); |
1037 | 1038 |
1038 // Load the key (consisting of map and symbol) from the cache and | 1039 // Load the key (consisting of map and symbol) from the cache and |
1039 // check for match. | 1040 // check for match. |
| 1041 Label try_second_entry, hit_on_first_entry, load_in_object_property; |
1040 ExternalReference cache_keys = | 1042 ExternalReference cache_keys = |
1041 ExternalReference::keyed_lookup_cache_keys(isolate); | 1043 ExternalReference::keyed_lookup_cache_keys(isolate); |
1042 __ li(t0, Operand(cache_keys)); | 1044 __ li(t0, Operand(cache_keys)); |
1043 __ sll(at, a3, kPointerSizeLog2 + 1); | 1045 __ sll(at, a3, kPointerSizeLog2 + 1); |
1044 __ addu(t0, t0, at); | 1046 __ addu(t0, t0, at); |
1045 __ lw(t1, MemOperand(t0)); // Move t0 to symbol. | 1047 __ lw(t1, MemOperand(t0)); |
1046 __ Addu(t0, t0, Operand(kPointerSize)); | 1048 __ Branch(&try_second_entry, ne, a2, Operand(t1)); |
| 1049 __ lw(t1, MemOperand(t0, kPointerSize)); |
| 1050 __ Branch(&hit_on_first_entry, eq, a0, Operand(t1)); |
| 1051 |
| 1052 __ bind(&try_second_entry); |
| 1053 __ lw(t1, MemOperand(t0, kPointerSize * 2)); |
1047 __ Branch(&slow, ne, a2, Operand(t1)); | 1054 __ Branch(&slow, ne, a2, Operand(t1)); |
1048 __ lw(t1, MemOperand(t0)); | 1055 __ lw(t1, MemOperand(t0, kPointerSize * 3)); |
1049 __ Branch(&slow, ne, a0, Operand(t1)); | 1056 __ Branch(&slow, ne, a0, Operand(t1)); |
1050 | 1057 |
1051 // Get field offset. | 1058 // Get field offset. |
1052 // a0 : key | 1059 // a0 : key |
1053 // a1 : receiver | 1060 // a1 : receiver |
1054 // a2 : receiver's map | 1061 // a2 : receiver's map |
1055 // a3 : lookup cache index | 1062 // a3 : lookup cache index |
1056 ExternalReference cache_field_offsets = | 1063 ExternalReference cache_field_offsets = |
1057 ExternalReference::keyed_lookup_cache_field_offsets(isolate); | 1064 ExternalReference::keyed_lookup_cache_field_offsets(isolate); |
| 1065 |
| 1066 // Hit on second entry. |
| 1067 __ li(t0, Operand(cache_field_offsets)); |
| 1068 __ sll(at, a3, kPointerSizeLog2); |
| 1069 __ addu(at, t0, at); |
| 1070 __ lw(t1, MemOperand(at, kPointerSize)); |
| 1071 __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
| 1072 __ Subu(t1, t1, t2); |
| 1073 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
| 1074 __ Branch(&load_in_object_property); |
| 1075 |
| 1076 // Hit on first entry. |
| 1077 __ bind(&hit_on_first_entry); |
1058 __ li(t0, Operand(cache_field_offsets)); | 1078 __ li(t0, Operand(cache_field_offsets)); |
1059 __ sll(at, a3, kPointerSizeLog2); | 1079 __ sll(at, a3, kPointerSizeLog2); |
1060 __ addu(at, t0, at); | 1080 __ addu(at, t0, at); |
1061 __ lw(t1, MemOperand(at)); | 1081 __ lw(t1, MemOperand(at)); |
1062 __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); | 1082 __ lbu(t2, FieldMemOperand(a2, Map::kInObjectPropertiesOffset)); |
1063 __ Subu(t1, t1, t2); | 1083 __ Subu(t1, t1, t2); |
1064 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); | 1084 __ Branch(&property_array_property, ge, t1, Operand(zero_reg)); |
1065 | 1085 |
1066 // Load in-object property. | 1086 // Load in-object property. |
| 1087 __ bind(&load_in_object_property); |
1067 __ lbu(t2, FieldMemOperand(a2, Map::kInstanceSizeOffset)); | 1088 __ lbu(t2, FieldMemOperand(a2, Map::kInstanceSizeOffset)); |
1068 __ addu(t2, t2, t1); // Index from start of object. | 1089 __ addu(t2, t2, t1); // Index from start of object. |
1069 __ Subu(a1, a1, Operand(kHeapObjectTag)); // Remove the heap tag. | 1090 __ Subu(a1, a1, Operand(kHeapObjectTag)); // Remove the heap tag. |
1070 __ sll(at, t2, kPointerSizeLog2); | 1091 __ sll(at, t2, kPointerSizeLog2); |
1071 __ addu(at, a1, at); | 1092 __ addu(at, a1, at); |
1072 __ lw(v0, MemOperand(at)); | 1093 __ lw(v0, MemOperand(at)); |
1073 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), | 1094 __ IncrementCounter(isolate->counters()->keyed_load_generic_lookup_cache(), |
1074 1, | 1095 1, |
1075 a2, | 1096 a2, |
1076 a3); | 1097 a3); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); | 1700 Register reg = Register::from_code(Assembler::GetRs(instr_at_patch)); |
1680 patcher.masm()->andi(at, reg, kSmiTagMask); | 1701 patcher.masm()->andi(at, reg, kSmiTagMask); |
1681 patcher.ChangeBranchCondition(eq); | 1702 patcher.ChangeBranchCondition(eq); |
1682 } | 1703 } |
1683 } | 1704 } |
1684 | 1705 |
1685 | 1706 |
1686 } } // namespace v8::internal | 1707 } } // namespace v8::internal |
1687 | 1708 |
1688 #endif // V8_TARGET_ARCH_MIPS | 1709 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |