OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 ASSERT(HasNumberValue()); | 2450 ASSERT(HasNumberValue()); |
2451 if (has_int32_value_) return int32_value_; | 2451 if (has_int32_value_) return int32_value_; |
2452 return DoubleToInt32(double_value_); | 2452 return DoubleToInt32(double_value_); |
2453 } | 2453 } |
2454 bool HasStringValue() const { return handle_->IsString(); } | 2454 bool HasStringValue() const { return handle_->IsString(); } |
2455 | 2455 |
2456 bool ToBoolean() const; | 2456 bool ToBoolean() const; |
2457 | 2457 |
2458 virtual intptr_t Hashcode() { | 2458 virtual intptr_t Hashcode() { |
2459 ASSERT(!HEAP->allow_allocation(false)); | 2459 ASSERT(!HEAP->allow_allocation(false)); |
2460 return reinterpret_cast<intptr_t>(*handle()); | 2460 intptr_t hash = reinterpret_cast<intptr_t>(*handle()); |
| 2461 // Prevent smis from having fewer hash values when truncated to |
| 2462 // the least significant bits. |
| 2463 const int kShiftSize = kSmiShiftSize + kSmiTagSize; |
| 2464 return hash ^ (hash >> kShiftSize); |
2461 } | 2465 } |
2462 | 2466 |
2463 #ifdef DEBUG | 2467 #ifdef DEBUG |
2464 virtual void Verify() { } | 2468 virtual void Verify() { } |
2465 #endif | 2469 #endif |
2466 | 2470 |
2467 DECLARE_CONCRETE_INSTRUCTION(Constant) | 2471 DECLARE_CONCRETE_INSTRUCTION(Constant) |
2468 | 2472 |
2469 protected: | 2473 protected: |
2470 virtual Range* InferRange(); | 2474 virtual Range* InferRange(); |
(...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4766 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 4770 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
4767 }; | 4771 }; |
4768 | 4772 |
4769 | 4773 |
4770 #undef DECLARE_INSTRUCTION | 4774 #undef DECLARE_INSTRUCTION |
4771 #undef DECLARE_CONCRETE_INSTRUCTION | 4775 #undef DECLARE_CONCRETE_INSTRUCTION |
4772 | 4776 |
4773 } } // namespace v8::internal | 4777 } } // namespace v8::internal |
4774 | 4778 |
4775 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 4779 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |