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

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

Issue 2266003: X64: Many small tweaks and more usages of "load smi as int32". (Closed)
Patch Set: Created 10 years, 7 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
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 if (check_dictionary == CHECK_DICTIONARY) { 97 if (check_dictionary == CHECK_DICTIONARY) {
98 // Check that the properties array is a dictionary. 98 // Check that the properties array is a dictionary.
99 __ Cmp(FieldOperand(r0, HeapObject::kMapOffset), Factory::hash_table_map()); 99 __ Cmp(FieldOperand(r0, HeapObject::kMapOffset), Factory::hash_table_map());
100 __ j(not_equal, miss_label); 100 __ j(not_equal, miss_label);
101 } 101 }
102 102
103 // Compute the capacity mask. 103 // Compute the capacity mask.
104 const int kCapacityOffset = 104 const int kCapacityOffset =
105 StringDictionary::kHeaderSize + 105 StringDictionary::kHeaderSize +
106 StringDictionary::kCapacityIndex * kPointerSize; 106 StringDictionary::kCapacityIndex * kPointerSize;
107 __ movq(r2, FieldOperand(r0, kCapacityOffset)); 107 __ SmiToInteger32(r2, FieldOperand(r0, kCapacityOffset));
108 __ SmiToInteger32(r2, r2);
109 __ decl(r2); 108 __ decl(r2);
110 109
111 // Generate an unrolled loop that performs a few probes before 110 // Generate an unrolled loop that performs a few probes before
112 // giving up. Measurements done on Gmail indicate that 2 probes 111 // giving up. Measurements done on Gmail indicate that 2 probes
113 // cover ~93% of loads from dictionaries. 112 // cover ~93% of loads from dictionaries.
114 static const int kProbes = 4; 113 static const int kProbes = 4;
115 const int kElementsStartOffset = 114 const int kElementsStartOffset =
116 StringDictionary::kHeaderSize + 115 StringDictionary::kHeaderSize +
117 StringDictionary::kElementsStartIndex * kPointerSize; 116 StringDictionary::kElementsStartIndex * kPointerSize;
118 for (int i = 0; i < kProbes; i++) { 117 for (int i = 0; i < kProbes; i++) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 __ shrl(r1, Immediate(4)); 194 __ shrl(r1, Immediate(4));
196 __ xorl(r0, r1); 195 __ xorl(r0, r1);
197 // hash = hash * 2057; 196 // hash = hash * 2057;
198 __ imull(r0, r0, Immediate(2057)); 197 __ imull(r0, r0, Immediate(2057));
199 // hash = hash ^ (hash >> 16); 198 // hash = hash ^ (hash >> 16);
200 __ movl(r1, r0); 199 __ movl(r1, r0);
201 __ shrl(r1, Immediate(16)); 200 __ shrl(r1, Immediate(16));
202 __ xorl(r0, r1); 201 __ xorl(r0, r1);
203 202
204 // Compute capacity mask. 203 // Compute capacity mask.
205 __ movq(r1, FieldOperand(elements, NumberDictionary::kCapacityOffset)); 204 __ SmiToInteger32(r1,
206 __ SmiToInteger32(r1, r1); 205 FieldOperand(elements, NumberDictionary::kCapacityOffset));
207 __ decl(r1); 206 __ decl(r1);
208 207
209 // Generate an unrolled loop that performs a few probes before giving up. 208 // Generate an unrolled loop that performs a few probes before giving up.
210 const int kProbes = 4; 209 const int kProbes = 4;
211 for (int i = 0; i < kProbes; i++) { 210 for (int i = 0; i < kProbes; i++) {
212 // Use r2 for index calculations and keep the hash intact in r0. 211 // Use r2 for index calculations and keep the hash intact in r0.
213 __ movq(r2, r0); 212 __ movq(r2, r0);
214 // Compute the masked index: (hash + i + i * i) & mask. 213 // Compute the masked index: (hash + i + i * i) & mask.
215 if (i > 0) { 214 if (i > 0) {
216 __ addl(r2, Immediate(NumberDictionary::GetProbeOffset(i))); 215 __ addl(r2, Immediate(NumberDictionary::GetProbeOffset(i)));
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1616 GenerateMiss(masm); 1615 GenerateMiss(masm);
1617 } 1616 }
1618 1617
1619 1618
1620 #undef __ 1619 #undef __
1621 1620
1622 1621
1623 } } // namespace v8::internal 1622 } } // namespace v8::internal
1624 1623
1625 #endif // V8_TARGET_ARCH_X64 1624 #endif // V8_TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698