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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 9153002: Use shift and add instead of mul on ARM for integer hash. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 11 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 // hash = ~hash + (hash << 15); 1449 // hash = ~hash + (hash << 15);
1450 mvn(t1, Operand(t0)); 1450 mvn(t1, Operand(t0));
1451 add(t0, t1, Operand(t0, LSL, 15)); 1451 add(t0, t1, Operand(t0, LSL, 15));
1452 // hash = hash ^ (hash >> 12); 1452 // hash = hash ^ (hash >> 12);
1453 eor(t0, t0, Operand(t0, LSR, 12)); 1453 eor(t0, t0, Operand(t0, LSR, 12));
1454 // hash = hash + (hash << 2); 1454 // hash = hash + (hash << 2);
1455 add(t0, t0, Operand(t0, LSL, 2)); 1455 add(t0, t0, Operand(t0, LSL, 2));
1456 // hash = hash ^ (hash >> 4); 1456 // hash = hash ^ (hash >> 4);
1457 eor(t0, t0, Operand(t0, LSR, 4)); 1457 eor(t0, t0, Operand(t0, LSR, 4));
1458 // hash = hash * 2057; 1458 // hash = hash * 2057;
1459 mov(t1, Operand(2057)); 1459 mov(t1, Operand(t0, LSL, 11));
1460 mul(t0, t0, t1); 1460 add(t0, t0, Operand(t0, LSL, 3));
1461 add(t0, t0, t1);
1461 // hash = hash ^ (hash >> 16); 1462 // hash = hash ^ (hash >> 16);
1462 eor(t0, t0, Operand(t0, LSR, 16)); 1463 eor(t0, t0, Operand(t0, LSR, 16));
1463 1464
1464 // Compute the capacity mask. 1465 // Compute the capacity mask.
1465 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset)); 1466 ldr(t1, FieldMemOperand(elements, NumberDictionary::kCapacityOffset));
1466 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int 1467 mov(t1, Operand(t1, ASR, kSmiTagSize)); // convert smi to int
1467 sub(t1, t1, Operand(1)); 1468 sub(t1, t1, Operand(1));
1468 1469
1469 // Generate an unrolled loop that performs a few probes before giving up. 1470 // Generate an unrolled loop that performs a few probes before giving up.
1470 static const int kProbes = 4; 1471 static const int kProbes = 4;
(...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after
3625 void CodePatcher::EmitCondition(Condition cond) { 3626 void CodePatcher::EmitCondition(Condition cond) {
3626 Instr instr = Assembler::instr_at(masm_.pc_); 3627 Instr instr = Assembler::instr_at(masm_.pc_);
3627 instr = (instr & ~kCondMask) | cond; 3628 instr = (instr & ~kCondMask) | cond;
3628 masm_.emit(instr); 3629 masm_.emit(instr);
3629 } 3630 }
3630 3631
3631 3632
3632 } } // namespace v8::internal 3633 } } // namespace v8::internal
3633 3634
3634 #endif // V8_TARGET_ARCH_ARM 3635 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698