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

Side by Side Diff: src/arm/ic-arm.cc

Issue 155350: Changed hash table to use more of the hash value when probing. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 5 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 | « no previous file | src/arm/simulator-arm.cc » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset)); 96 __ ldr(r3, FieldMemOperand(t0, kCapacityOffset));
97 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int 97 __ mov(r3, Operand(r3, ASR, kSmiTagSize)); // convert smi to int
98 __ sub(r3, r3, Operand(1)); 98 __ sub(r3, r3, Operand(1));
99 99
100 const int kElementsStartOffset = 100 const int kElementsStartOffset =
101 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize; 101 Array::kHeaderSize + StringDictionary::kElementsStartIndex * kPointerSize;
102 102
103 // Generate an unrolled loop that performs a few probes before 103 // Generate an unrolled loop that performs a few probes before
104 // giving up. Measurements done on Gmail indicate that 2 probes 104 // giving up. Measurements done on Gmail indicate that 2 probes
105 // cover ~93% of loads from dictionaries. 105 // cover ~93% of loads from dictionaries.
106 static const int kProbes = 4; 106 static const uint32_t kProbes =
107 for (int i = 0; i < kProbes; i++) { 107 HashTable<StringDictionaryShape, String*>::kNofFastProbes;
108 // Compute the masked index: (hash + i + i * i) & mask. 108 static const uint32_t kShift =
109 HashTable<StringDictionaryShape, String*>::kHashRotateShift;
110
111 for (uint32_t i = 0; i < kProbes; i++) {
112 // Compute the masked index.
109 __ ldr(t1, FieldMemOperand(r2, String::kLengthOffset)); 113 __ ldr(t1, FieldMemOperand(r2, String::kLengthOffset));
110 __ mov(t1, Operand(t1, LSR, String::kHashShift)); 114 __ mov(t1, Operand(t1, LSR, String::kHashShift));
111 if (i > 0) { 115 __ and_(t1, r3, Operand(t1, ROR, (kShift * i) % kBitsPerInt));
Kasper Lund 2009/07/16 12:41:43 Maybe this needs to be guarded with something like
bak 2009/07/16 12:52:41 Fixed, good catch.
112 __ add(t1, t1, Operand(StringDictionary::GetProbeOffset(i)));
113 }
114 __ and_(t1, t1, Operand(r3));
115 116
116 // Scale the index by multiplying by the element size. 117 // Scale the index by multiplying by the element size.
117 ASSERT(StringDictionary::kEntrySize == 3); 118 ASSERT(StringDictionary::kEntrySize == 3);
118 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3 119 __ add(t1, t1, Operand(t1, LSL, 1)); // t1 = t1 * 3
119 120
120 // Check if the key is identical to the name. 121 // Check if the key is identical to the name.
121 __ add(t1, t0, Operand(t1, LSL, 2)); 122 __ add(t1, t0, Operand(t1, LSL, 2));
122 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset)); 123 __ ldr(ip, FieldMemOperand(t1, kElementsStartOffset));
123 __ cmp(r2, Operand(ip)); 124 __ cmp(r2, Operand(ip));
124 if (i != kProbes - 1) { 125 if (i != kProbes - 1) {
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 809
809 // Perform tail call to the entry. 810 // Perform tail call to the entry.
810 __ TailCallRuntime(f, 3); 811 __ TailCallRuntime(f, 3);
811 } 812 }
812 813
813 814
814 #undef __ 815 #undef __
815 816
816 817
817 } } // namespace v8::internal 818 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/arm/simulator-arm.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698