Chromium Code Reviews| Index: src/hydrogen.cc |
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
| index 3b232e6e93ee2d307e5ea9504266825fb9f11b36..1126a5e9c974c88b5a4251547507c40f48ca1307 100644 |
| --- a/src/hydrogen.cc |
| +++ b/src/hydrogen.cc |
| @@ -1915,6 +1915,39 @@ HValue* HGraphBuilder::BuildCloneShallowArray(HValue* boilerplate, |
| } |
| +HValue* HGraphBuilder::BuildElementIndexHash(HValue* index) { |
|
mvstanton
2013/11/04 15:28:24
Could you update the comment in macro-assembler-X.
danno
2013/11/15 17:54:09
Done.
|
| + int32_t seed_value = static_cast<uint32_t>(isolate()->heap()->HashSeed()); |
| + HValue* seed = Add<HConstant>(seed_value); |
| + HValue* hash = Add<HBitwise>(Token::BIT_XOR, index, seed); |
| + |
| + // hash = ~hash + (hash << 15); |
| + HValue* shifted_hash = Add<HShl>(hash, Add<HConstant>(15)); |
| + HValue* not_hash = Add<HBitwise>(Token::BIT_XOR, hash, |
| + graph()->GetConstantMinus1()); |
| + hash = Add<HAdd>(shifted_hash, not_hash); |
| + |
| + // hash = hash ^ (hash >> 12); |
| + shifted_hash = Add<HShr>(hash, Add<HConstant>(12)); |
| + hash = Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash); |
| + |
| + // hash = hash + (hash << 2); |
| + shifted_hash = Add<HShl>(hash, Add<HConstant>(2)); |
| + hash = Add<HAdd>(hash, shifted_hash); |
| + |
| + // hash = hash ^ (hash >> 4); |
| + shifted_hash = Add<HShr>(hash, Add<HConstant>(4)); |
| + hash = Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash); |
| + |
| + // hash = hash * 2057; |
| + hash = Add<HMul>(hash, Add<HConstant>(2057)); |
| + hash->ClearFlag(HValue::kCanOverflow); |
| + |
| + // hash = hash ^ (hash >> 16); |
| + shifted_hash = Add<HShr>(hash, Add<HConstant>(16)); |
| + return Add<HBitwise>(Token::BIT_XOR, hash, shifted_hash); |
| +} |
| + |
| + |
| void HGraphBuilder::BuildCompareNil( |
| HValue* value, |
| Handle<Type> type, |