| 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 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1405 int token_offset = Context::kHeaderSize + | 1405 int token_offset = Context::kHeaderSize + |
| 1406 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 1406 Context::SECURITY_TOKEN_INDEX * kPointerSize; |
| 1407 mov(scratch1, FieldOperand(scratch1, token_offset)); | 1407 mov(scratch1, FieldOperand(scratch1, token_offset)); |
| 1408 cmp(scratch1, FieldOperand(scratch2, token_offset)); | 1408 cmp(scratch1, FieldOperand(scratch2, token_offset)); |
| 1409 j(not_equal, miss); | 1409 j(not_equal, miss); |
| 1410 | 1410 |
| 1411 bind(&same_contexts); | 1411 bind(&same_contexts); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 | 1414 |
| 1415 // Compute the hash code from the untagged key. This must be kept in sync | 1415 // Compute the hash code from the untagged key. This must be kept in sync with |
| 1416 // with ComputeIntegerHash in utils.h. | 1416 // ComputeIntegerHash in utils.h and KeyedLoadGenericElementStub in |
| 1417 // code-stub-hydrogen.cc |
| 1417 // | 1418 // |
| 1418 // Note: r0 will contain hash code | 1419 // Note: r0 will contain hash code |
| 1419 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { | 1420 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { |
| 1420 // Xor original key with a seed. | 1421 // Xor original key with a seed. |
| 1421 if (Serializer::enabled()) { | 1422 if (Serializer::enabled()) { |
| 1422 ExternalReference roots_array_start = | 1423 ExternalReference roots_array_start = |
| 1423 ExternalReference::roots_array_start(isolate()); | 1424 ExternalReference::roots_array_start(isolate()); |
| 1424 mov(scratch, Immediate(Heap::kHashSeedRootIndex)); | 1425 mov(scratch, Immediate(Heap::kHashSeedRootIndex)); |
| 1425 mov(scratch, | 1426 mov(scratch, |
| 1426 Operand::StaticArray(scratch, times_pointer_size, roots_array_start)); | 1427 Operand::StaticArray(scratch, times_pointer_size, roots_array_start)); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1482 Label done; | 1483 Label done; |
| 1483 | 1484 |
| 1484 GetNumberHash(r0, r1); | 1485 GetNumberHash(r0, r1); |
| 1485 | 1486 |
| 1486 // Compute capacity mask. | 1487 // Compute capacity mask. |
| 1487 mov(r1, FieldOperand(elements, SeededNumberDictionary::kCapacityOffset)); | 1488 mov(r1, FieldOperand(elements, SeededNumberDictionary::kCapacityOffset)); |
| 1488 shr(r1, kSmiTagSize); // convert smi to int | 1489 shr(r1, kSmiTagSize); // convert smi to int |
| 1489 dec(r1); | 1490 dec(r1); |
| 1490 | 1491 |
| 1491 // Generate an unrolled loop that performs a few probes before giving up. | 1492 // Generate an unrolled loop that performs a few probes before giving up. |
| 1492 const int kProbes = 4; | 1493 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. | 1494 // Use r2 for index calculations and keep the hash intact in r0. |
| 1495 mov(r2, r0); | 1495 mov(r2, r0); |
| 1496 // Compute the masked index: (hash + i + i * i) & mask. | 1496 // Compute the masked index: (hash + i + i * i) & mask. |
| 1497 if (i > 0) { | 1497 if (i > 0) { |
| 1498 add(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); | 1498 add(r2, Immediate(SeededNumberDictionary::GetProbeOffset(i))); |
| 1499 } | 1499 } |
| 1500 and_(r2, r1); | 1500 and_(r2, r1); |
| 1501 | 1501 |
| 1502 // Scale the index by multiplying by the entry size. | 1502 // Scale the index by multiplying by the entry size. |
| 1503 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 1503 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
| 1504 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 | 1504 lea(r2, Operand(r2, r2, times_2, 0)); // r2 = r2 * 3 |
| 1505 | 1505 |
| 1506 // Check if the key matches. | 1506 // Check if the key matches. |
| 1507 cmp(key, FieldOperand(elements, | 1507 cmp(key, FieldOperand(elements, |
| 1508 r2, | 1508 r2, |
| 1509 times_pointer_size, | 1509 times_pointer_size, |
| 1510 SeededNumberDictionary::kElementsStartOffset)); | 1510 SeededNumberDictionary::kElementsStartOffset)); |
| 1511 if (i != (kProbes - 1)) { | 1511 if (i != (kNumberDictionaryProbes - 1)) { |
| 1512 j(equal, &done); | 1512 j(equal, &done); |
| 1513 } else { | 1513 } else { |
| 1514 j(not_equal, miss); | 1514 j(not_equal, miss); |
| 1515 } | 1515 } |
| 1516 } | 1516 } |
| 1517 | 1517 |
| 1518 bind(&done); | 1518 bind(&done); |
| 1519 // Check that the value is a normal propety. | 1519 // Check that the value is a normal propety. |
| 1520 const int kDetailsOffset = | 1520 const int kDetailsOffset = |
| 1521 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; | 1521 SeededNumberDictionary::kElementsStartOffset + 2 * kPointerSize; |
| (...skipping 2093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3615 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); | 3615 cmp(scratch1, Immediate(DICTIONARY_ELEMENTS)); |
| 3616 j(equal, found); | 3616 j(equal, found); |
| 3617 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3617 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
| 3618 cmp(current, Immediate(factory->null_value())); | 3618 cmp(current, Immediate(factory->null_value())); |
| 3619 j(not_equal, &loop_again); | 3619 j(not_equal, &loop_again); |
| 3620 } | 3620 } |
| 3621 | 3621 |
| 3622 } } // namespace v8::internal | 3622 } } // namespace v8::internal |
| 3623 | 3623 |
| 3624 #endif // V8_TARGET_ARCH_IA32 | 3624 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |