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 3951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3962 Label done; | 3962 Label done; |
3963 | 3963 |
3964 GetNumberHash(r0, r1); | 3964 GetNumberHash(r0, r1); |
3965 | 3965 |
3966 // Compute capacity mask. | 3966 // Compute capacity mask. |
3967 SmiToInteger32(r1, FieldOperand(elements, | 3967 SmiToInteger32(r1, FieldOperand(elements, |
3968 SeededNumberDictionary::kCapacityOffset)); | 3968 SeededNumberDictionary::kCapacityOffset)); |
3969 decl(r1); | 3969 decl(r1); |
3970 | 3970 |
3971 // Generate an unrolled loop that performs a few probes before giving up. | 3971 // Generate an unrolled loop that performs a few probes before giving up. |
3972 const int kProbes = 4; | 3972 for (int i = 0; i < kNumberDictionaryProbes; i++) { |
3973 for (int i = 0; i < kProbes; i++) { | |
3974 // Use r2 for index calculations and keep the hash intact in r0. | 3973 // Use r2 for index calculations and keep the hash intact in r0. |
3975 movq(r2, r0); | 3974 movq(r2, r0); |
3976 // Compute the masked index: (hash + i + i * i) & mask. | 3975 // Compute the masked index: (hash + i + i * i) & mask. |
3977 if (i > 0) { | 3976 if (i > 0) { |
3978 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); | 3977 addl(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); |
3979 } | 3978 } |
3980 and_(r2, r1); | 3979 and_(r2, r1); |
3981 | 3980 |
3982 // Scale the index by multiplying by the entry size. | 3981 // Scale the index by multiplying by the entry size. |
3983 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 3982 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
3984 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 3983 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
3985 | 3984 |
3986 // Check if the key matches. | 3985 // Check if the key matches. |
3987 cmpq(key, FieldOperand(elements, | 3986 cmpq(key, FieldOperand(elements, |
3988 r2, | 3987 r2, |
3989 times_pointer_size, | 3988 times_pointer_size, |
3990 SeededNumberDictionary::kElementsStartOffset)); | 3989 SeededNumberDictionary::kElementsStartOffset)); |
3991 if (i != (kProbes - 1)) { | 3990 if (i != (kNumberDictionaryProbes - 1)) { |
3992 j(equal, &done); | 3991 j(equal, &done); |
3993 } else { | 3992 } else { |
3994 j(not_equal, miss); | 3993 j(not_equal, miss); |
3995 } | 3994 } |
3996 } | 3995 } |
3997 | 3996 |
3998 bind(&done); | 3997 bind(&done); |
3999 // Check that the value is a normal propety. | 3998 // Check that the value is a normal propety. |
4000 const int kDetailsOffset = | 3999 const int kDetailsOffset = |
4001 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | 4000 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
(...skipping 962 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4964 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); | 4963 movq(arg_reg_1, isolate, RelocInfo::EXTERNAL_REFERENCE); |
4965 CallCFunction( | 4964 CallCFunction( |
4966 ExternalReference::record_object_allocation_function(isolate), 3); | 4965 ExternalReference::record_object_allocation_function(isolate), 3); |
4967 PopSafepointRegisters(); | 4966 PopSafepointRegisters(); |
4968 } | 4967 } |
4969 | 4968 |
4970 | 4969 |
4971 } } // namespace v8::internal | 4970 } } // namespace v8::internal |
4972 | 4971 |
4973 #endif // V8_TARGET_ARCH_X64 | 4972 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |