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 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 Label done; | 503 Label done; |
504 | 504 |
505 GetNumberHash(reg0, reg1); | 505 GetNumberHash(reg0, reg1); |
506 | 506 |
507 // Compute the capacity mask. | 507 // Compute the capacity mask. |
508 lw(reg1, FieldMemOperand(elements, SeededNumberDictionary::kCapacityOffset)); | 508 lw(reg1, FieldMemOperand(elements, SeededNumberDictionary::kCapacityOffset)); |
509 sra(reg1, reg1, kSmiTagSize); | 509 sra(reg1, reg1, kSmiTagSize); |
510 Subu(reg1, reg1, Operand(1)); | 510 Subu(reg1, reg1, Operand(1)); |
511 | 511 |
512 // Generate an unrolled loop that performs a few probes before giving up. | 512 // Generate an unrolled loop that performs a few probes before giving up. |
513 static const int kProbes = 4; | 513 for (int i = 0; i < kNumberDictionaryProbes; i++) { |
514 for (int i = 0; i < kProbes; i++) { | |
515 // Use reg2 for index calculations and keep the hash intact in reg0. | 514 // Use reg2 for index calculations and keep the hash intact in reg0. |
516 mov(reg2, reg0); | 515 mov(reg2, reg0); |
517 // Compute the masked index: (hash + i + i * i) & mask. | 516 // Compute the masked index: (hash + i + i * i) & mask. |
518 if (i > 0) { | 517 if (i > 0) { |
519 Addu(reg2, reg2, Operand(SeededNumberDictionary::GetProbeOffset(i))); | 518 Addu(reg2, reg2, Operand(SeededNumberDictionary::GetProbeOffset(i))); |
520 } | 519 } |
521 and_(reg2, reg2, reg1); | 520 and_(reg2, reg2, reg1); |
522 | 521 |
523 // Scale the index by multiplying by the element size. | 522 // Scale the index by multiplying by the element size. |
524 ASSERT(SeededNumberDictionary::kEntrySize == 3); | 523 ASSERT(SeededNumberDictionary::kEntrySize == 3); |
525 sll(at, reg2, 1); // 2x. | 524 sll(at, reg2, 1); // 2x. |
526 addu(reg2, reg2, at); // reg2 = reg2 * 3. | 525 addu(reg2, reg2, at); // reg2 = reg2 * 3. |
527 | 526 |
528 // Check if the key is identical to the name. | 527 // Check if the key is identical to the name. |
529 sll(at, reg2, kPointerSizeLog2); | 528 sll(at, reg2, kPointerSizeLog2); |
530 addu(reg2, elements, at); | 529 addu(reg2, elements, at); |
531 | 530 |
532 lw(at, FieldMemOperand(reg2, SeededNumberDictionary::kElementsStartOffset)); | 531 lw(at, FieldMemOperand(reg2, SeededNumberDictionary::kElementsStartOffset)); |
533 if (i != kProbes - 1) { | 532 if (i != kNumberDictionaryProbes - 1) { |
534 Branch(&done, eq, key, Operand(at)); | 533 Branch(&done, eq, key, Operand(at)); |
535 } else { | 534 } else { |
536 Branch(miss, ne, key, Operand(at)); | 535 Branch(miss, ne, key, Operand(at)); |
537 } | 536 } |
538 } | 537 } |
539 | 538 |
540 bind(&done); | 539 bind(&done); |
541 // Check that the value is a normal property. | 540 // Check that the value is a normal property. |
542 // reg2: elements + (index * kPointerSize). | 541 // reg2: elements + (index * kPointerSize). |
543 const int kDetailsOffset = | 542 const int kDetailsOffset = |
(...skipping 5116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5660 opcode == BGTZL); | 5659 opcode == BGTZL); |
5661 opcode = (cond == eq) ? BEQ : BNE; | 5660 opcode = (cond == eq) ? BEQ : BNE; |
5662 instr = (instr & ~kOpcodeMask) | opcode; | 5661 instr = (instr & ~kOpcodeMask) | opcode; |
5663 masm_.emit(instr); | 5662 masm_.emit(instr); |
5664 } | 5663 } |
5665 | 5664 |
5666 | 5665 |
5667 } } // namespace v8::internal | 5666 } } // namespace v8::internal |
5668 | 5667 |
5669 #endif // V8_TARGET_ARCH_MIPS | 5668 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |