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 6073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6084 __ add(hash, scratch); | 6084 __ add(hash, scratch); |
6085 // hash ^= hash >> 11; | 6085 // hash ^= hash >> 11; |
6086 __ mov(scratch, hash); | 6086 __ mov(scratch, hash); |
6087 __ shr(scratch, 11); | 6087 __ shr(scratch, 11); |
6088 __ xor_(hash, scratch); | 6088 __ xor_(hash, scratch); |
6089 // hash += hash << 15; | 6089 // hash += hash << 15; |
6090 __ mov(scratch, hash); | 6090 __ mov(scratch, hash); |
6091 __ shl(scratch, 15); | 6091 __ shl(scratch, 15); |
6092 __ add(hash, scratch); | 6092 __ add(hash, scratch); |
6093 | 6093 |
6094 uint32_t kHashShiftCutOffMask = (1 << (32 - String::kHashShift)) - 1; | 6094 __ and_(hash, String::kHashBitMask); |
6095 __ and_(hash, kHashShiftCutOffMask); | |
6096 | 6095 |
6097 // if (hash == 0) hash = 27; | 6096 // if (hash == 0) hash = 27; |
6098 Label hash_not_zero; | 6097 Label hash_not_zero; |
6099 __ test(hash, hash); | |
6100 __ j(not_zero, &hash_not_zero, Label::kNear); | 6098 __ j(not_zero, &hash_not_zero, Label::kNear); |
6101 __ mov(hash, Immediate(27)); | 6099 __ mov(hash, Immediate(StringHasher::kZeroHash)); |
6102 __ bind(&hash_not_zero); | 6100 __ bind(&hash_not_zero); |
6103 } | 6101 } |
6104 | 6102 |
6105 | 6103 |
6106 void SubStringStub::Generate(MacroAssembler* masm) { | 6104 void SubStringStub::Generate(MacroAssembler* masm) { |
6107 Label runtime; | 6105 Label runtime; |
6108 | 6106 |
6109 // Stack frame on entry. | 6107 // Stack frame on entry. |
6110 // esp[0]: return address | 6108 // esp[0]: return address |
6111 // esp[4]: to | 6109 // esp[4]: to |
(...skipping 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7346 false); | 7344 false); |
7347 __ pop(edx); | 7345 __ pop(edx); |
7348 __ ret(0); | 7346 __ ret(0); |
7349 } | 7347 } |
7350 | 7348 |
7351 #undef __ | 7349 #undef __ |
7352 | 7350 |
7353 } } // namespace v8::internal | 7351 } } // namespace v8::internal |
7354 | 7352 |
7355 #endif // V8_TARGET_ARCH_IA32 | 7353 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |