| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 const int kElementsStartOffset = StringDictionary::kHeaderSize + | 101 const int kElementsStartOffset = StringDictionary::kHeaderSize + |
| 102 StringDictionary::kElementsStartIndex * kPointerSize; | 102 StringDictionary::kElementsStartIndex * kPointerSize; |
| 103 | 103 |
| 104 // Generate an unrolled loop that performs a few probes before | 104 // Generate an unrolled loop that performs a few probes before |
| 105 // giving up. Measurements done on Gmail indicate that 2 probes | 105 // giving up. Measurements done on Gmail indicate that 2 probes |
| 106 // cover ~93% of loads from dictionaries. | 106 // cover ~93% of loads from dictionaries. |
| 107 static const int kProbes = 4; | 107 static const int kProbes = 4; |
| 108 for (int i = 0; i < kProbes; i++) { | 108 for (int i = 0; i < kProbes; i++) { |
| 109 // Compute the masked index: (hash + i + i * i) & mask. | 109 // Compute the masked index: (hash + i + i * i) & mask. |
| 110 __ ldr(t1, FieldMemOperand(r2, String::kLengthOffset)); | 110 __ ldr(t1, FieldMemOperand(r2, String::kHashFieldOffset)); |
| 111 __ mov(t1, Operand(t1, LSR, String::kHashShift)); | |
| 112 if (i > 0) { | 111 if (i > 0) { |
| 113 __ add(t1, t1, Operand(StringDictionary::GetProbeOffset(i))); | 112 // Add the probe offset (i + i * i) left shifted to avoid right shifting |
| 113 // the hash in a separate instruction. The value hash + i + i * i is right |
| 114 // shifted in the following and instruction. |
| 115 __ add(t1, t1, Operand( |
| 116 StringDictionary::GetProbeOffset(i) << String::kHashFieldOffset)); |
| 114 } | 117 } |
| 115 __ and_(t1, t1, Operand(r3)); | 118 __ and_(t1, r3, Operand(t1, LSR, String::kHashShift)); |
| 116 | 119 |
| 117 // Scale the index by multiplying by the element size. | 120 // Scale the index by multiplying by the element size. |
| 118 ASSERT(StringDictionary::kEntrySize == 3); | 121 ASSERT(StringDictionary::kEntrySize == 3); |
| 119 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3 | 122 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3 |
| 120 | 123 |
| 121 // Check if the key is identical to the name. | 124 // Check if the key is identical to the name. |
| 122 __ add(t1, t0, Operand(t1, LSL, 2)); | 125 __ add(t1, t0, Operand(t1, LSL, 2)); |
| 123 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset)); | 126 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset)); |
| 124 __ cmp(r2, Operand(ip)); | 127 __ cmp(r2, Operand(ip)); |
| 125 if (i != kProbes - 1) { | 128 if (i != kProbes - 1) { |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 | 832 |
| 830 // Perform tail call to the entry. | 833 // Perform tail call to the entry. |
| 831 __ TailCallRuntime(f, 3, 1); | 834 __ TailCallRuntime(f, 3, 1); |
| 832 } | 835 } |
| 833 | 836 |
| 834 | 837 |
| 835 #undef __ | 838 #undef __ |
| 836 | 839 |
| 837 | 840 |
| 838 } } // namespace v8::internal | 841 } } // namespace v8::internal |
| OLD | NEW |