OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 3962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3973 Label done; | 3973 Label done; |
3974 | 3974 |
3975 GetNumberHash(r0, r1); | 3975 GetNumberHash(r0, r1); |
3976 | 3976 |
3977 // Compute capacity mask. | 3977 // Compute capacity mask. |
3978 SmiToInteger32(r1, FieldOperand(elements, | 3978 SmiToInteger32(r1, FieldOperand(elements, |
3979 SeededNumberDictionary::kCapacityOffset)); | 3979 SeededNumberDictionary::kCapacityOffset)); |
3980 decl(r1); | 3980 decl(r1); |
3981 | 3981 |
3982 // Generate an unrolled loop that performs a few probes before giving up. | 3982 // Generate an unrolled loop that performs a few probes before giving up. |
3983 const int kProbes = 4; | 3983 for (int i = 0; i < kNumberDictionaryProbes; i++) { |
3984 for (int i = 0; i < kProbes; i++) { | |
3985 // Use r2 for index calculations and keep the hash intact in r0. | 3984 // Use r2 for index calculations and keep the hash intact in r0. |
3986 movq(r2, r0); | 3985 movq(r2, r0); |
3987 // Compute the masked index: (hash + i + i * i) & mask. | 3986 // Compute the masked index: (hash + i + i * i) & mask. |
3988 if (i > 0) { | 3987 if (i > 0) { |
3989 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); | 3988 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); |
3990 } | 3989 } |
3991 and_(r2, r1); | 3990 and_(r2, r1); |
3992 | 3991 |
3993 // Scale the index by multiplying by the entry size. | 3992 // Scale the index by multiplying by the entry size. |
3994 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 3993 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
3995 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 3994 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
3996 | 3995 |
3997 // Check if the key matches. | 3996 // Check if the key matches. |
3998 cmpq(key, FieldOperand(elements, | 3997 cmpq(key, FieldOperand(elements, |
3999 r2, | 3998 r2, |
4000 times_pointer_size, | 3999 times_pointer_size, |
4001 SeededNumberDictionary::kElementsStartOffset)); | 4000 SeededNumberDictionary::kElementsStartOffset)); |
4002 if (i != (kProbes - 1)) { | 4001 if (i != (kNumberDictionaryProbes - 1)) { |
4003 j(equal, &done); | 4002 j(equal, &done); |
4004 } else { | 4003 } else { |
4005 j(not_equal, miss); | 4004 j(not_equal, miss); |
4006 } | 4005 } |
4007 } | 4006 } |
4008 | 4007 |
4009 bind(&done); | 4008 bind(&done); |
4010 // Check that the value is a normal propety. | 4009 // Check that the value is a normal propety. |
4011 const int kDetailsOffset = | 4010 const int kDetailsOffset = |
4012 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | 4011 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
(...skipping 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4983 j(equal, found); | 4982 j(equal, found); |
4984 movq(current, FieldOperand(current, Map::kPrototypeOffset)); | 4983 movq(current, FieldOperand(current, Map::kPrototypeOffset)); |
4985 CompareRoot(current, Heap::kNullValueRootIndex); | 4984 CompareRoot(current, Heap::kNullValueRootIndex); |
4986 j(not_equal, &loop_again); | 4985 j(not_equal, &loop_again); |
4987 } | 4986 } |
4988 | 4987 |
4989 | 4988 |
4990 } } // namespace v8::internal | 4989 } } // namespace v8::internal |
4991 | 4990 |
4992 #endif // V8_TARGET_ARCH_X64 | 4991 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |