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

Side by Side Diff: src/x64/code-stubs-x64.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/x64/code-stubs-x64.h ('k') | test/cctest/test-hashing.cc » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_X64 7 #if V8_TARGET_ARCH_X64
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2839 __ movb(Operand(dest, 0), kScratchRegister); 2839 __ movb(Operand(dest, 0), kScratchRegister);
2840 __ incp(src); 2840 __ incp(src);
2841 __ incp(dest); 2841 __ incp(dest);
2842 __ decl(count); 2842 __ decl(count);
2843 __ j(not_zero, &loop); 2843 __ j(not_zero, &loop);
2844 2844
2845 __ bind(&done); 2845 __ bind(&done);
2846 } 2846 }
2847 2847
2848 2848
2849 void StringHelper::GenerateHashInit(MacroAssembler* masm,
2850 Register hash,
2851 Register character,
2852 Register scratch) {
2853 // hash = (seed + character) + ((seed + character) << 10);
2854 __ LoadRoot(scratch, Heap::kHashSeedRootIndex);
2855 __ SmiToInteger32(scratch, scratch);
2856 __ addl(scratch, character);
2857 __ movl(hash, scratch);
2858 __ shll(scratch, Immediate(10));
2859 __ addl(hash, scratch);
2860 // hash ^= hash >> 6;
2861 __ movl(scratch, hash);
2862 __ shrl(scratch, Immediate(6));
2863 __ xorl(hash, scratch);
2864 }
2865
2866
2867 void StringHelper::GenerateHashAddCharacter(MacroAssembler* masm,
2868 Register hash,
2869 Register character,
2870 Register scratch) {
2871 // hash += character;
2872 __ addl(hash, character);
2873 // hash += hash << 10;
2874 __ movl(scratch, hash);
2875 __ shll(scratch, Immediate(10));
2876 __ addl(hash, scratch);
2877 // hash ^= hash >> 6;
2878 __ movl(scratch, hash);
2879 __ shrl(scratch, Immediate(6));
2880 __ xorl(hash, scratch);
2881 }
2882
2883
2884 void StringHelper::GenerateHashGetHash(MacroAssembler* masm,
2885 Register hash,
2886 Register scratch) {
2887 // hash += hash << 3;
2888 __ leal(hash, Operand(hash, hash, times_8, 0));
2889 // hash ^= hash >> 11;
2890 __ movl(scratch, hash);
2891 __ shrl(scratch, Immediate(11));
2892 __ xorl(hash, scratch);
2893 // hash += hash << 15;
2894 __ movl(scratch, hash);
2895 __ shll(scratch, Immediate(15));
2896 __ addl(hash, scratch);
2897
2898 __ andl(hash, Immediate(String::kHashBitMask));
2899
2900 // if (hash == 0) hash = 27;
2901 Label hash_not_zero;
2902 __ j(not_zero, &hash_not_zero);
2903 __ Set(hash, StringHasher::kZeroHash);
2904 __ bind(&hash_not_zero);
2905 }
2906
2907
2908 void SubStringStub::Generate(MacroAssembler* masm) { 2849 void SubStringStub::Generate(MacroAssembler* masm) {
2909 Label runtime; 2850 Label runtime;
2910 2851
2911 // Stack frame on entry. 2852 // Stack frame on entry.
2912 // rsp[0] : return address 2853 // rsp[0] : return address
2913 // rsp[8] : to 2854 // rsp[8] : to
2914 // rsp[16] : from 2855 // rsp[16] : from
2915 // rsp[24] : string 2856 // rsp[24] : string
2916 2857
2917 enum SubStringStubArgumentIndices { 2858 enum SubStringStubArgumentIndices {
(...skipping 1789 matching lines...) Expand 10 before | Expand all | Expand 10 after
4707 return_value_operand, 4648 return_value_operand,
4708 NULL); 4649 NULL);
4709 } 4650 }
4710 4651
4711 4652
4712 #undef __ 4653 #undef __
4713 4654
4714 } } // namespace v8::internal 4655 } } // namespace v8::internal
4715 4656
4716 #endif // V8_TARGET_ARCH_X64 4657 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | test/cctest/test-hashing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698