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 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 Label done; | 1482 Label done; |
1483 | 1483 |
1484 GetNumberHash(r0, r1); | 1484 GetNumberHash(r0, r1); |
1485 | 1485 |
1486 // Compute capacity mask. | 1486 // Compute capacity mask. |
1487 mov(r1, FieldOperand(elements, SeededNumberDictionary::kCapacityOffset)); | 1487 mov(r1, FieldOperand(elements, SeededNumberDictionary::kCapacityOffset)); |
1488 shr(r1, kSmiTagSize); // convert smi to int | 1488 shr(r1, kSmiTagSize); // convert smi to int |
1489 dec(r1); | 1489 dec(r1); |
1490 | 1490 |
1491 // Generate an unrolled loop that performs a few probes before giving up. | 1491 // Generate an unrolled loop that performs a few probes before giving up. |
1492 const int kProbes = 4; | 1492 for (int i = 0; i < kNumberDictionaryProbes; i++) { |
1493 for (int i = 0; i < kProbes; i++) { | |
1494 // Use r2 for index calculations and keep the hash intact in r0. | 1493 // Use r2 for index calculations and keep the hash intact in r0. |
1495 mov(r2, r0); | 1494 mov(r2, r0); |
1496 // Compute the masked index: (hash + i + i * i) & mask. | 1495 // Compute the masked index: (hash + i + i * i) & mask. |
1497 if (i > 0) { | 1496 if (i > 0) { |
1498 add(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); | 1497 add(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); |
1499 } | 1498 } |
1500 and_(r2, r1); | 1499 and_(r2, r1); |
1501 | 1500 |
1502 // Scale the index by multiplying by the entry size. | 1501 // Scale the index by multiplying by the entry size. |
1503 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 1502 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
1504 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 1503 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
1505 | 1504 |
1506 // Check if the key matches. | 1505 // Check if the key matches. |
1507 cmp(key, FieldOperand(elements, | 1506 cmp(key, FieldOperand(elements, |
1508 r2, | 1507 r2, |
1509 times_pointer_size, | 1508 times_pointer_size, |
1510 SeededNumberDictionary::kElementsStartOffset)); | 1509 SeededNumberDictionary::kElementsStartOffset)); |
1511 if (i != (kProbes - 1)) { | 1510 if (i != (kNumberDictionaryProbes - 1)) { |
1512 j(equal, &done); | 1511 j(equal, &done); |
1513 } else { | 1512 } else { |
1514 j(not_equal, miss); | 1513 j(not_equal, miss); |
1515 } | 1514 } |
1516 } | 1515 } |
1517 | 1516 |
1518 bind(&done); | 1517 bind(&done); |
1519 // Check that the value is a normal propety. | 1518 // Check that the value is a normal propety. |
1520 const int kDetailsOffset = | 1519 const int kDetailsOffset = |
1521 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | 1520 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
(...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3615 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3614 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
3616 j(equal, found); | 3615 j(equal, found); |
3617 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3616 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
3618 cmp(current, Immediate(factory->null_value())); | 3617 cmp(current, Immediate(factory->null_value())); |
3619 j(not_equal, &loop_again); | 3618 j(not_equal, &loop_again); |
3620 } | 3619 } |
3621 | 3620 |
3622 } } // namespace v8::internal | 3621 } } // namespace v8::internal |
3623 | 3622 |
3624 #endif // V8_TARGET_ARCH_IA32 | 3623 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |