Chromium Code Reviews| OLD | NEW | 
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 745 Context::SECURITY_TOKEN_INDEX * kPointerSize; | 
| 746 mov(scratch, FieldOperand(scratch, token_offset)); | 746 mov(scratch, FieldOperand(scratch, token_offset)); | 
| 747 cmp(scratch, FieldOperand(holder_reg, token_offset)); | 747 cmp(scratch, FieldOperand(holder_reg, token_offset)); | 
| 748 pop(holder_reg); | 748 pop(holder_reg); | 
| 749 j(not_equal, miss); | 749 j(not_equal, miss); | 
| 750 | 750 | 
| 751 bind(&same_contexts); | 751 bind(&same_contexts); | 
| 752 } | 752 } | 
| 753 | 753 | 
| 754 | 754 | 
| 755 // Compute the hash code from the untagged key. This must be kept in sync | |
| 756 // with ComputeIntegerHash in utils.h. | |
| 757 // | |
| 758 // Note: r0 will contain hash code | |
| 759 void MacroAssembler::GetNumberHash(Register r0, Register scratch) { | |
| 760 // Xor original key with a seed. | |
| 761 if (Serializer::enabled()) { | |
| 762 ExternalReference roots_address = | |
| 763 ExternalReference::roots_address(isolate()); | |
| 764 mov(scratch, Immediate(Heap::kHashSeedRootIndex)); | |
| 
 
Erik Corry
2012/01/11 10:20:35
There's a missing SmiUntag here.  Probably it does
 
 | |
| 765 xor_(r0, Operand::StaticArray(scratch, | |
| 766 times_pointer_size, | |
| 
 
Erik Corry
2012/01/11 10:20:35
Somehow the indentation got borked here.
 
 | |
| 767 roots_address)); | |
| 768 } else { | |
| 769 int32_t seed = isolate()->heap()->HashSeed(); | |
| 770 xor_(r0, seed); | |
| 771 } | |
| 772 | |
| 773 // hash = ~hash + (hash << 15); | |
| 774 mov(scratch, r0); | |
| 775 not_(r0); | |
| 776 shl(scratch, 15); | |
| 777 add(r0, Operand(scratch)); | |
| 778 // hash = hash ^ (hash >> 12); | |
| 779 mov(scratch, r0); | |
| 780 shr(scratch, 12); | |
| 781 xor_(r0, Operand(scratch)); | |
| 782 // hash = hash + (hash << 2); | |
| 783 lea(r0, Operand(r0, r0, times_4, 0)); | |
| 784 // hash = hash ^ (hash >> 4); | |
| 785 mov(scratch, r0); | |
| 786 shr(scratch, 4); | |
| 787 xor_(r0, Operand(scratch)); | |
| 788 // hash = hash * 2057; | |
| 789 imul(r0, r0, 2057); | |
| 790 // hash = hash ^ (hash >> 16); | |
| 791 mov(scratch, r0); | |
| 792 shr(scratch, 16); | |
| 793 xor_(r0, Operand(scratch)); | |
| 794 } | |
| 795 | |
| 796 | |
| 797 | |
| 755 void MacroAssembler::LoadFromNumberDictionary(Label* miss, | 798 void MacroAssembler::LoadFromNumberDictionary(Label* miss, | 
| 756 Register elements, | 799 Register elements, | 
| 757 Register key, | 800 Register key, | 
| 758 Register r0, | 801 Register r0, | 
| 759 Register r1, | 802 Register r1, | 
| 760 Register r2, | 803 Register r2, | 
| 761 Register result) { | 804 Register result) { | 
| 762 // Register use: | 805 // Register use: | 
| 763 // | 806 // | 
| 764 // elements - holds the slow-case elements of the receiver and is unchanged. | 807 // elements - holds the slow-case elements of the receiver and is unchanged. | 
| 765 // | 808 // | 
| 766 // key - holds the smi key on entry and is unchanged. | 809 // key - holds the smi key on entry and is unchanged. | 
| 767 // | 810 // | 
| 768 // Scratch registers: | 811 // Scratch registers: | 
| 769 // | 812 // | 
| 770 // r0 - holds the untagged key on entry and holds the hash once computed. | 813 // r0 - holds the untagged key on entry and holds the hash once computed. | 
| 771 // | 814 // | 
| 772 // r1 - used to hold the capacity mask of the dictionary | 815 // r1 - used to hold the capacity mask of the dictionary | 
| 773 // | 816 // | 
| 774 // r2 - used for the index into the dictionary. | 817 // r2 - used for the index into the dictionary. | 
| 775 // | 818 // | 
| 776 // result - holds the result on exit if the load succeeds and we fall through. | 819 // result - holds the result on exit if the load succeeds and we fall through. | 
| 777 | 820 | 
| 778 Label done; | 821 Label done; | 
| 779 | 822 | 
| 780 // Compute the hash code from the untagged key. This must be kept in sync | 823 GetNumberHash(r0, r1); | 
| 781 // with ComputeIntegerHash in utils.h. | |
| 782 // | |
| 783 // hash = ~hash + (hash << 15); | |
| 784 mov(r1, r0); | |
| 785 not_(r0); | |
| 786 shl(r1, 15); | |
| 787 add(r0, Operand(r1)); | |
| 788 // hash = hash ^ (hash >> 12); | |
| 789 mov(r1, r0); | |
| 790 shr(r1, 12); | |
| 791 xor_(r0, Operand(r1)); | |
| 792 // hash = hash + (hash << 2); | |
| 793 lea(r0, Operand(r0, r0, times_4, 0)); | |
| 794 // hash = hash ^ (hash >> 4); | |
| 795 mov(r1, r0); | |
| 796 shr(r1, 4); | |
| 797 xor_(r0, Operand(r1)); | |
| 798 // hash = hash * 2057; | |
| 799 imul(r0, r0, 2057); | |
| 800 // hash = hash ^ (hash >> 16); | |
| 801 mov(r1, r0); | |
| 802 shr(r1, 16); | |
| 803 xor_(r0, Operand(r1)); | |
| 804 | 824 | 
| 805 // Compute capacity mask. | 825 // Compute capacity mask. | 
| 806 mov(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset)); | 826 mov(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset)); | 
| 807 shr(r1, kSmiTagSize); // convert smi to int | 827 shr(r1, kSmiTagSize); // convert smi to int | 
| 808 dec(r1); | 828 dec(r1); | 
| 809 | 829 | 
| 810 // Generate an unrolled loop that performs a few probes before giving up. | 830 // Generate an unrolled loop that performs a few probes before giving up. | 
| 811 const int kProbes = 4; | 831 const int kProbes = 4; | 
| 812 for (int i = 0; i < kProbes; i++) { | 832 for (int i = 0; i < kProbes; i++) { | 
| 813 // Use r2 for index calculations and keep the hash intact in r0. | 833 // Use r2 for index calculations and keep the hash intact in r0. | 
| (...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2282 | 2302 | 
| 2283 // Check that the code was patched as expected. | 2303 // Check that the code was patched as expected. | 
| 2284 ASSERT(masm_.pc_ == address_ + size_); | 2304 ASSERT(masm_.pc_ == address_ + size_); | 
| 2285 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2305 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 
| 2286 } | 2306 } | 
| 2287 | 2307 | 
| 2288 | 2308 | 
| 2289 } } // namespace v8::internal | 2309 } } // namespace v8::internal | 
| 2290 | 2310 | 
| 2291 #endif // V8_TARGET_ARCH_IA32 | 2311 #endif // V8_TARGET_ARCH_IA32 | 
| OLD | NEW |