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 5906 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5917 __ jmp(not_found); | 5917 __ jmp(not_found); |
5918 | 5918 |
5919 // Scratch register contains result when we fall through to here. | 5919 // Scratch register contains result when we fall through to here. |
5920 Register result = candidate; | 5920 Register result = candidate; |
5921 __ bind(&found_in_symbol_table); | 5921 __ bind(&found_in_symbol_table); |
5922 __ mov(v0, result); | 5922 __ mov(v0, result); |
5923 } | 5923 } |
5924 | 5924 |
5925 | 5925 |
5926 void StringHelper::GenerateHashInit(MacroAssembler* masm, | 5926 void StringHelper::GenerateHashInit(MacroAssembler* masm, |
5927 Register hash, | 5927 Register hash, |
5928 Register character) { | 5928 Register character) { |
5929 // hash = character + (character << 10); | 5929 // hash = character + (character << 10); |
Vyacheslav Egorov (Chromium)
2012/01/04 14:30:57
comment is outdated
Erik Corry
2012/01/04 15:48:59
Done.
| |
5930 __ sll(hash, character, 10); | 5930 __ LoadRoot(hash, Heap::kStringHashSeedRootIndex); |
5931 // Untag smi seed and add the character. | |
5932 __ SmiUntag(hash); | |
5931 __ addu(hash, hash, character); | 5933 __ addu(hash, hash, character); |
5934 __ sll(at, hash, 10); | |
5935 __ addu(hash, hash, at); | |
5932 // hash ^= hash >> 6; | 5936 // hash ^= hash >> 6; |
5933 __ srl(at, hash, 6); | 5937 __ srl(at, hash, 6); |
5934 __ xor_(hash, hash, at); | 5938 __ xor_(hash, hash, at); |
5935 } | 5939 } |
5936 | 5940 |
5937 | 5941 |
5938 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, | 5942 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm, |
5939 Register hash, | 5943 Register hash, |
5940 Register character) { | 5944 Register character) { |
5941 // hash += character; | 5945 // hash += character; |
5942 __ addu(hash, hash, character); | 5946 __ addu(hash, hash, character); |
5943 // hash += hash << 10; | 5947 // hash += hash << 10; |
5944 __ sll(at, hash, 10); | 5948 __ sll(at, hash, 10); |
5945 __ addu(hash, hash, at); | 5949 __ addu(hash, hash, at); |
5946 // hash ^= hash >> 6; | 5950 // hash ^= hash >> 6; |
5947 __ srl(at, hash, 6); | 5951 __ srl(at, hash, 6); |
5948 __ xor_(hash, hash, at); | 5952 __ xor_(hash, hash, at); |
5949 } | 5953 } |
5950 | 5954 |
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7578 __ Ret(USE_DELAY_SLOT); | 7582 __ Ret(USE_DELAY_SLOT); |
7579 __ mov(v0, a0); | 7583 __ mov(v0, a0); |
7580 } | 7584 } |
7581 | 7585 |
7582 | 7586 |
7583 #undef __ | 7587 #undef __ |
7584 | 7588 |
7585 } } // namespace v8::internal | 7589 } } // namespace v8::internal |
7586 | 7590 |
7587 #endif // V8_TARGET_ARCH_MIPS | 7591 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |