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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 // sets this flag, it must implement SetSideEffectDominator() and should | 555 // sets this flag, it must implement SetSideEffectDominator() and should |
556 // indicate which side effects to track by setting GVN flags. | 556 // indicate which side effects to track by setting GVN flags. |
557 kTrackSideEffectDominators, | 557 kTrackSideEffectDominators, |
558 kCanOverflow, | 558 kCanOverflow, |
559 kBailoutOnMinusZero, | 559 kBailoutOnMinusZero, |
560 kCanBeDivByZero, | 560 kCanBeDivByZero, |
561 kDeoptimizeOnUndefined, | 561 kDeoptimizeOnUndefined, |
562 kIsArguments, | 562 kIsArguments, |
563 kTruncatingToInt32, | 563 kTruncatingToInt32, |
564 kIsDead, | 564 kIsDead, |
565 kLastFlag = kIsDead | 565 // Instructions that are allowed to produce full range unsigned integer |
| 566 // values are marked with kUint32 flag. If arithmetic shift or a load from |
| 567 // EXTERNAL_UNSIGNED_INT_ELEMENTS array is not marked with this flag |
| 568 // it will deoptimize if result does not fit into signed integer range. |
| 569 // HGraph::ComputeSafeUint32Operations is responsible for setting this |
| 570 // flag. |
| 571 kUint32, |
| 572 kLastFlag = kUint32 |
566 }; | 573 }; |
567 | 574 |
568 STATIC_ASSERT(kLastFlag < kBitsPerInt); | 575 STATIC_ASSERT(kLastFlag < kBitsPerInt); |
569 | 576 |
570 static const int kChangesToDependsFlagsLeftShift = 1; | 577 static const int kChangesToDependsFlagsLeftShift = 1; |
571 | 578 |
572 static GVNFlag ChangesFlagFromInt(int x) { | 579 static GVNFlag ChangesFlagFromInt(int x) { |
573 return static_cast<GVNFlag>(x * 2); | 580 return static_cast<GVNFlag>(x * 2); |
574 } | 581 } |
575 static GVNFlag DependsOnFlagFromInt(int x) { | 582 static GVNFlag DependsOnFlagFromInt(int x) { |
(...skipping 1973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2549 int32_t NumberValueAsInteger32() const { | 2556 int32_t NumberValueAsInteger32() const { |
2550 ASSERT(HasNumberValue()); | 2557 ASSERT(HasNumberValue()); |
2551 // Irrespective of whether a numeric HConstant can be safely | 2558 // Irrespective of whether a numeric HConstant can be safely |
2552 // represented as an int32, we store the (in some cases lossy) | 2559 // represented as an int32, we store the (in some cases lossy) |
2553 // representation of the number in int32_value_. | 2560 // representation of the number in int32_value_. |
2554 return int32_value_; | 2561 return int32_value_; |
2555 } | 2562 } |
2556 | 2563 |
2557 bool ToBoolean(); | 2564 bool ToBoolean(); |
2558 | 2565 |
| 2566 bool IsUint32() { |
| 2567 return HasInteger32Value() && (Integer32Value() >= 0); |
| 2568 } |
| 2569 |
2559 virtual intptr_t Hashcode() { | 2570 virtual intptr_t Hashcode() { |
2560 ASSERT_ALLOCATION_DISABLED; | 2571 ASSERT_ALLOCATION_DISABLED; |
2561 intptr_t hash; | 2572 intptr_t hash; |
2562 | 2573 |
2563 if (has_int32_value_) { | 2574 if (has_int32_value_) { |
2564 hash = static_cast<intptr_t>(int32_value_); | 2575 hash = static_cast<intptr_t>(int32_value_); |
2565 } else if (has_double_value_) { | 2576 } else if (has_double_value_) { |
2566 hash = static_cast<intptr_t>(BitCast<int64_t>(double_value_)); | 2577 hash = static_cast<intptr_t>(BitCast<int64_t>(double_value_)); |
2567 } else { | 2578 } else { |
2568 ASSERT(!handle_.is_null()); | 2579 ASSERT(!handle_.is_null()); |
(...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5248 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); | 5259 DECLARE_CONCRETE_INSTRUCTION(LoadFieldByIndex); |
5249 }; | 5260 }; |
5250 | 5261 |
5251 | 5262 |
5252 #undef DECLARE_INSTRUCTION | 5263 #undef DECLARE_INSTRUCTION |
5253 #undef DECLARE_CONCRETE_INSTRUCTION | 5264 #undef DECLARE_CONCRETE_INSTRUCTION |
5254 | 5265 |
5255 } } // namespace v8::internal | 5266 } } // namespace v8::internal |
5256 | 5267 |
5257 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 5268 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |