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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 // Generate an unrolled loop that performs a few probes before | 84 // Generate an unrolled loop that performs a few probes before |
85 // giving up. Measurements done on Gmail indicate that 2 probes | 85 // giving up. Measurements done on Gmail indicate that 2 probes |
86 // cover ~93% of loads from dictionaries. | 86 // cover ~93% of loads from dictionaries. |
87 static const int kProbes = 4; | 87 static const int kProbes = 4; |
88 const int kElementsStartOffset = | 88 const int kElementsStartOffset = |
89 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; | 89 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; |
90 for (int i = 0; i < kProbes; i++) { | 90 for (int i = 0; i < kProbes; i++) { |
91 // Compute the masked index: (hash + i + i * i) & mask. | 91 // Compute the masked index: (hash + i + i * i) & mask. |
92 __ mov(r1, FieldOperand(name, String::kLengthOffset)); | 92 __ mov(r1, FieldOperand(name, String::kLengthOffset)); |
| 93 __ shr(r1, String::kHashShift); |
93 if (i > 0) __ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i))); | 94 if (i > 0) __ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i))); |
94 __ and_(r1, Operand(r2)); | 95 __ and_(r1, Operand(r2)); |
95 | 96 |
96 // Scale the index by multiplying by the element size. | 97 // Scale the index by multiplying by the element size. |
97 ASSERT(Dictionary::kElementSize == 3); | 98 ASSERT(Dictionary::kElementSize == 3); |
98 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 | 99 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 |
99 | 100 |
100 // Check if the key is identical to the name. | 101 // Check if the key is identical to the name. |
101 __ cmp(name, | 102 __ cmp(name, |
102 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); | 103 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 | 747 |
747 // Do tail-call to runtime routine. | 748 // Do tail-call to runtime routine. |
748 __ TailCallRuntime(f, 3); | 749 __ TailCallRuntime(f, 3); |
749 } | 750 } |
750 | 751 |
751 | 752 |
752 #undef __ | 753 #undef __ |
753 | 754 |
754 | 755 |
755 } } // namespace v8::internal | 756 } } // namespace v8::internal |
OLD | NEW |