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 5559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5570 __ jmp(not_found); | 5570 __ jmp(not_found); |
| 5571 | 5571 |
| 5572 // Scratch register contains result when we fall through to here. | 5572 // Scratch register contains result when we fall through to here. |
| 5573 Register result = candidate; | 5573 Register result = candidate; |
| 5574 __ bind(&found_in_symbol_table); | 5574 __ bind(&found_in_symbol_table); |
| 5575 __ mov(v0, result); | 5575 __ mov(v0, result); |
| 5576 } | 5576 } |
| 5577 | 5577 |
| 5578 | 5578 |
| 5579 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 5579 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
| 5580 Register hash, | 5580 Register hash, |
| 5581 Register character) { | 5581 Register character) { |
| 5582 // hash = character + (character << 10); | 5582 // hash = seed + character + ((seed + character) << 10); |
| 5583 __ sll(hash, character, 10); | 5583 __ LoadRoot(hash, Heap::kStringHashSeedRootIndex); |
| 5584 // Untag smi seed and add the character. | |
| 5585 __ SmiUntag(hash); | |
| 5584 __ addu(hash, hash, character); | 5586 __ addu(hash, hash, character); |
| 5587 __ sll(at, hash, 10); | |
| 5588 __ addu(hash, hash, at); | |
| 5585 // hash ^= hash >> 6; | 5589 // hash ^= hash >> 6; |
| 5586 __ sra(at, hash, 6); | 5590 __ sra(at, hash, 6); |
| 5587 __ xor_(hash, hash, at); | 5591 __ xor_(hash, hash, at); |
| 5588 } | 5592 } |
| 5589 | 5593 |
| 5590 | 5594 |
| 5591 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | 5595 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, |
| 5592 Register hash, | 5596 Register hash, |
| 5593 Register character) { | 5597 Register character) { |
| 5594 // hash += character; | 5598 // hash += character; |
| 5595 __ addu(hash, hash, character); | 5599 __ addu(hash, hash, character); |
| 5596 // hash += hash << 10; | 5600 // hash += hash << 10; |
| 5597 __ sll(at, hash, 10); | 5601 __ sll(at, hash, 10); |
| 5598 __ addu(hash, hash, at); | 5602 __ addu(hash, hash, at); |
| 5599 // hash ^= hash >> 6; | 5603 // hash ^= hash >> 6; |
| 5600 __ sra(at, hash, 6); | 5604 __ sra(at, hash, 6); |
| 5601 __ xor_(hash, hash, at); | 5605 __ xor_(hash, hash, at); |
| 5602 } | 5606 } |
| 5603 | 5607 |
| 5604 | 5608 |
| 5605 void StringHelper::GenerateHashGetHash(MacroAssembler* masm, | 5609 void StringHelper::GenerateHashGetHash(MacroAssembler* masm, |
| 5606 Register hash) { | 5610 Register hash) { |
| 5607 // hash += hash << 3; | 5611 // hash += hash << 3; |
| 5608 __ sll(at, hash, 3); | 5612 __ sll(at, hash, 3); |
| 5609 __ addu(hash, hash, at); | 5613 __ addu(hash, hash, at); |
| 5610 // hash ^= hash >> 11; | 5614 // hash ^= hash >> 11; |
| 5611 __ sra(at, hash, 11); | 5615 __ sra(at, hash, 11); |
| 5612 __ xor_(hash, hash, at); | 5616 __ xor_(hash, hash, at); |
| 5613 // hash += hash << 15; | 5617 // hash += hash << 15; |
| 5614 __ sll(at, hash, 15); | 5618 __ sll(at, hash, 15); |
| 5615 __ addu(hash, hash, at); | 5619 __ addu(hash, hash, at); |
| 5616 | 5620 |
| 5617 // if (hash == 0) hash = 27; | 5621 // if (hash == 0) hash = 27; |
|
Vyacheslav Egorov (Chromium)
2012/01/09 19:09:33
should not there be some special masking here?
Erik Corry
2012/01/10 00:18:44
As noted in the description I wasn't able to get M
| |
| 5618 __ ori(at, zero_reg, 27); | 5622 __ ori(at, zero_reg, 27); |
| 5619 __ movz(hash, at, hash); | 5623 __ movz(hash, at, hash); |
| 5620 } | 5624 } |
| 5621 | 5625 |
| 5622 | 5626 |
| 5623 void SubStringStub::Generate(MacroAssembler* masm) { | 5627 void SubStringStub::Generate(MacroAssembler* masm) { |
| 5624 Label sub_string_runtime; | 5628 Label sub_string_runtime; |
| 5625 // Stack frame on entry. | 5629 // Stack frame on entry. |
| 5626 // ra: return address | 5630 // ra: return address |
| 5627 // sp[0]: to | 5631 // sp[0]: to |
| (...skipping 1330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6958 __ mov(result, zero_reg); | 6962 __ mov(result, zero_reg); |
| 6959 __ Ret(); | 6963 __ Ret(); |
| 6960 } | 6964 } |
| 6961 | 6965 |
| 6962 | 6966 |
| 6963 #undef __ | 6967 #undef __ |
| 6964 | 6968 |
| 6965 } } // namespace v8::internal | 6969 } } // namespace v8::internal |
| 6966 | 6970 |
| 6967 #endif // V8_TARGET_ARCH_MIPS | 6971 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |