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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 __ b(eq, miss); | 78 __ b(eq, miss); |
79 | 79 |
80 // Check that the properties array is a dictionary. | 80 // Check that the properties array is a dictionary. |
81 __ ldr(t0, FieldMemOperand(t1, JSObject::kPropertiesOffset)); | 81 __ ldr(t0, FieldMemOperand(t1, JSObject::kPropertiesOffset)); |
82 __ ldr(r3, FieldMemOperand(t0, HeapObject::kMapOffset)); | 82 __ ldr(r3, FieldMemOperand(t0, HeapObject::kMapOffset)); |
83 __ cmp(r3, Operand(Factory::hash_table_map())); | 83 __ cmp(r3, Operand(Factory::hash_table_map())); |
84 __ b(ne, miss); | 84 __ b(ne, miss); |
85 | 85 |
86 // Compute the capacity mask. | 86 // Compute the capacity mask. |
87 const int kCapacityOffset = | 87 const int kCapacityOffset = |
88 Array::kHeaderSize + Dictionary::kCapacityIndex * kPointerSize; | 88 Array::kHeaderSize + StringDictionary::kCapacityIndex * kPointerSize; |
89 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset)); | 89 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset)); |
90 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int | 90 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int |
91 __ sub(r3, r3, Operand(1)); | 91 __ sub(r3, r3, Operand(1)); |
92 | 92 |
93 const int kElementsStartOffset = | 93 const int kElementsStartOffset = |
94 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; | 94 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize; |
95 | 95 |
96 // Generate an unrolled loop that performs a few probes before | 96 // Generate an unrolled loop that performs a few probes before |
97 // giving up. Measurements done on Gmail indicate that 2 probes | 97 // giving up. Measurements done on Gmail indicate that 2 probes |
98 // cover ~93% of loads from dictionaries. | 98 // cover ~93% of loads from dictionaries. |
99 static const int kProbes = 4; | 99 static const int kProbes = 4; |
100 for (int i = 0; i < kProbes; i++) { | 100 for (int i = 0; i < kProbes; i++) { |
101 // Compute the masked index: (hash + i + i * i) & mask. | 101 // Compute the masked index: (hash + i + i * i) & mask. |
102 __ ldr(t1, FieldMemOperand(r2, String::kLengthOffset)); | 102 __ ldr(t1, FieldMemOperand(r2, String::kLengthOffset)); |
103 __ mov(t1, Operand(t1, LSR, String::kHashShift)); | 103 __ mov(t1, Operand(t1, LSR, String::kHashShift)); |
104 if (i > 0) { | 104 if (i > 0) { |
105 __ add(t1, t1, Operand(Dictionary::GetProbeOffset(i))); | 105 __ add(t1, t1, Operand(StringDictionary::GetProbeOffset(i))); |
106 } | 106 } |
107 __ and_(t1, t1, Operand(r3)); | 107 __ and_(t1, t1, Operand(r3)); |
108 | 108 |
109 // Scale the index by multiplying by the element size. | 109 // Scale the index by multiplying by the element size. |
110 ASSERT(Dictionary::kElementSize == 3); | 110 ASSERT(StringDictionary::kEntrySize == 3); |
111 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3 | 111 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3 |
112 | 112 |
113 // Check if the key is identical to the name. | 113 // Check if the key is identical to the name. |
114 __ add(t1, t0, Operand(t1, LSL, 2)); | 114 __ add(t1, t0, Operand(t1, LSL, 2)); |
115 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset)); | 115 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset)); |
116 __ cmp(r2, Operand(ip)); | 116 __ cmp(r2, Operand(ip)); |
117 if (i != kProbes - 1) { | 117 if (i != kProbes - 1) { |
118 __ b(eq, &done); | 118 __ b(eq, &done); |
119 } else { | 119 } else { |
120 __ b(ne, miss); | 120 __ b(ne, miss); |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 | 798 |
799 // Perform tail call to the entry. | 799 // Perform tail call to the entry. |
800 __ TailCallRuntime(f, 3); | 800 __ TailCallRuntime(f, 3); |
801 } | 801 } |
802 | 802 |
803 | 803 |
804 #undef __ | 804 #undef __ |
805 | 805 |
806 | 806 |
807 } } // namespace v8::internal | 807 } } // namespace v8::internal |
OLD | NEW |