| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 __ j(equal, miss_label, not_taken); | 76 __ j(equal, miss_label, not_taken); |
| 77 | 77 |
| 78 // Check that the properties array is a dictionary. | 78 // Check that the properties array is a dictionary. |
| 79 __ mov(r0, FieldOperand(r1, JSObject::kPropertiesOffset)); | 79 __ mov(r0, FieldOperand(r1, JSObject::kPropertiesOffset)); |
| 80 __ cmp(FieldOperand(r0, HeapObject::kMapOffset), | 80 __ cmp(FieldOperand(r0, HeapObject::kMapOffset), |
| 81 Immediate(Factory::hash_table_map())); | 81 Immediate(Factory::hash_table_map())); |
| 82 __ j(not_equal, miss_label); | 82 __ j(not_equal, miss_label); |
| 83 | 83 |
| 84 // Compute the capacity mask. | 84 // Compute the capacity mask. |
| 85 const int kCapacityOffset = | 85 const int kCapacityOffset = |
| 86 Array::kHeaderSize + StringDictionary::kCapacityIndex * kPointerSize; | 86 Array::kHeaderSize + Dictionary::kCapacityIndex * kPointerSize; |
| 87 __ mov(r2, FieldOperand(r0, kCapacityOffset)); | 87 __ mov(r2, FieldOperand(r0, kCapacityOffset)); |
| 88 __ shr(r2, kSmiTagSize); // convert smi to int | 88 __ shr(r2, kSmiTagSize); // convert smi to int |
| 89 __ dec(r2); | 89 __ dec(r2); |
| 90 | 90 |
| 91 // Generate an unrolled loop that performs a few probes before | 91 // Generate an unrolled loop that performs a few probes before |
| 92 // giving up. Measurements done on Gmail indicate that 2 probes | 92 // giving up. Measurements done on Gmail indicate that 2 probes |
| 93 // cover ~93% of loads from dictionaries. | 93 // cover ~93% of loads from dictionaries. |
| 94 static const int kProbes = 4; | 94 static const int kProbes = 4; |
| 95 const int kElementsStartOffset = | 95 const int kElementsStartOffset = |
| 96 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize; | 96 Array::kHeaderSize + Dictionary::kElementsStartIndex * kPointerSize; |
| 97 for (int i = 0; i < kProbes; i++) { | 97 for (int i = 0; i < kProbes; i++) { |
| 98 // Compute the masked index: (hash + i + i * i) & mask. | 98 // Compute the masked index: (hash + i + i * i) & mask. |
| 99 __ mov(r1, FieldOperand(name, String::kLengthOffset)); | 99 __ mov(r1, FieldOperand(name, String::kLengthOffset)); |
| 100 __ shr(r1, String::kHashShift); | 100 __ shr(r1, String::kHashShift); |
| 101 if (i > 0) { | 101 if (i > 0) { |
| 102 __ add(Operand(r1), Immediate(StringDictionary::GetProbeOffset(i))); | 102 __ add(Operand(r1), Immediate(Dictionary::GetProbeOffset(i))); |
| 103 } | 103 } |
| 104 __ and_(r1, Operand(r2)); | 104 __ and_(r1, Operand(r2)); |
| 105 | 105 |
| 106 // Scale the index by multiplying by the entry size. | 106 // Scale the index by multiplying by the element size. |
| 107 ASSERT(StringDictionary::kEntrySize == 3); | 107 ASSERT(Dictionary::kElementSize == 3); |
| 108 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 | 108 __ lea(r1, Operand(r1, r1, times_2, 0)); // r1 = r1 * 3 |
| 109 | 109 |
| 110 // Check if the key is identical to the name. | 110 // Check if the key is identical to the name. |
| 111 __ cmp(name, | 111 __ cmp(name, |
| 112 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); | 112 Operand(r0, r1, times_4, kElementsStartOffset - kHeapObjectTag)); |
| 113 if (i != kProbes - 1) { | 113 if (i != kProbes - 1) { |
| 114 __ j(equal, &done, taken); | 114 __ j(equal, &done, taken); |
| 115 } else { | 115 } else { |
| 116 __ j(not_equal, miss_label, not_taken); | 116 __ j(not_equal, miss_label, not_taken); |
| 117 } | 117 } |
| (...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 966 | 966 |
| 967 // Do tail-call to runtime routine. | 967 // Do tail-call to runtime routine. |
| 968 __ TailCallRuntime( | 968 __ TailCallRuntime( |
| 969 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); | 969 ExternalReference(IC_Utility(kSharedStoreIC_ExtendStorage)), 3); |
| 970 } | 970 } |
| 971 | 971 |
| 972 #undef __ | 972 #undef __ |
| 973 | 973 |
| 974 | 974 |
| 975 } } // namespace v8::internal | 975 } } // namespace v8::internal |
| OLD | NEW |