Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(220)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 544613002: Remove dead code for inline string hashing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 __ mov_b(Operand(dest, 0), scratch); 2888 __ mov_b(Operand(dest, 0), scratch);
2889 __ inc(src); 2889 __ inc(src);
2890 __ inc(dest); 2890 __ inc(dest);
2891 __ dec(count); 2891 __ dec(count);
2892 __ j(not_zero, &loop); 2892 __ j(not_zero, &loop);
2893 2893
2894 __ bind(&done); 2894 __ bind(&done);
2895 } 2895 }
2896 2896
2897 2897
2898 void StringHelper::GenerateHashInit(MacroAssembler* masm,
2899 Register hash,
2900 Register character,
2901 Register scratch) {
2902 // hash = (seed + character) + ((seed + character) << 10);
2903 if (masm->serializer_enabled()) {
2904 __ LoadRoot(scratch, Heap::kHashSeedRootIndex);
2905 __ SmiUntag(scratch);
2906 __ add(scratch, character);
2907 __ mov(hash, scratch);
2908 __ shl(scratch, 10);
2909 __ add(hash, scratch);
2910 } else {
2911 int32_t seed = masm->isolate()->heap()->HashSeed();
2912 __ lea(scratch, Operand(character, seed));
2913 __ shl(scratch, 10);
2914 __ lea(hash, Operand(scratch, character, times_1, seed));
2915 }
2916 // hash ^= hash >> 6;
2917 __ mov(scratch, hash);
2918 __ shr(scratch, 6);
2919 __ xor_(hash, scratch);
2920 }
2921
2922
2923 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm,
2924 Register hash,
2925 Register character,
2926 Register scratch) {
2927 // hash += character;
2928 __ add(hash, character);
2929 // hash += hash << 10;
2930 __ mov(scratch, hash);
2931 __ shl(scratch, 10);
2932 __ add(hash, scratch);
2933 // hash ^= hash >> 6;
2934 __ mov(scratch, hash);
2935 __ shr(scratch, 6);
2936 __ xor_(hash, scratch);
2937 }
2938
2939
2940 void StringHelper::GenerateHashGetHash(MacroAssembler* masm,
2941 Register hash,
2942 Register scratch) {
2943 // hash += hash << 3;
2944 __ mov(scratch, hash);
2945 __ shl(scratch, 3);
2946 __ add(hash, scratch);
2947 // hash ^= hash >> 11;
2948 __ mov(scratch, hash);
2949 __ shr(scratch, 11);
2950 __ xor_(hash, scratch);
2951 // hash += hash << 15;
2952 __ mov(scratch, hash);
2953 __ shl(scratch, 15);
2954 __ add(hash, scratch);
2955
2956 __ and_(hash, String::kHashBitMask);
2957
2958 // if (hash == 0) hash = 27;
2959 Label hash_not_zero;
2960 __ j(not_zero, &hash_not_zero, Label::kNear);
2961 __ mov(hash, Immediate(StringHasher::kZeroHash));
2962 __ bind(&hash_not_zero);
2963 }
2964
2965
2966 void SubStringStub::Generate(MacroAssembler* masm) { 2898 void SubStringStub::Generate(MacroAssembler* masm) {
2967 Label runtime; 2899 Label runtime;
2968 2900
2969 // Stack frame on entry. 2901 // Stack frame on entry.
2970 // esp[0]: return address 2902 // esp[0]: return address
2971 // esp[4]: to 2903 // esp[4]: to
2972 // esp[8]: from 2904 // esp[8]: from
2973 // esp[12]: string 2905 // esp[12]: string
2974 2906
2975 // Make sure first argument is a string. 2907 // Make sure first argument is a string.
(...skipping 1771 matching lines...) Expand 10 before | Expand all | Expand 10 after
4747 Operand(ebp, 7 * kPointerSize), 4679 Operand(ebp, 7 * kPointerSize),
4748 NULL); 4680 NULL);
4749 } 4681 }
4750 4682
4751 4683
4752 #undef __ 4684 #undef __
4753 4685
4754 } } // namespace v8::internal 4686 } } // namespace v8::internal
4755 4687
4756 #endif // V8_TARGET_ARCH_IA32 4688 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.h ('k') | src/x64/code-stubs-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698