OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/arm64/lithium-codegen-arm64.h" | 7 #include "src/arm64/lithium-codegen-arm64.h" |
8 #include "src/hydrogen-osr.h" | 8 #include "src/hydrogen-osr.h" |
9 #include "src/lithium-inl.h" | 9 #include "src/lithium-inl.h" |
10 | 10 |
(...skipping 1919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1930 // 2^n, -(2^n) | 1930 // 2^n, -(2^n) |
1931 // Without support for overflow detection: | 1931 // Without support for overflow detection: |
1932 // 2^n + 1, -(2^n - 1) | 1932 // 2^n + 1, -(2^n - 1) |
1933 if (most_const->IsConstant()) { | 1933 if (most_const->IsConstant()) { |
1934 int32_t constant = HConstant::cast(most_const)->Integer32Value(); | 1934 int32_t constant = HConstant::cast(most_const)->Integer32Value(); |
1935 bool small_constant = (constant >= -1) && (constant <= 2); | 1935 bool small_constant = (constant >= -1) && (constant <= 2); |
1936 bool end_range_constant = (constant <= -kMaxInt) || (constant == kMaxInt); | 1936 bool end_range_constant = (constant <= -kMaxInt) || (constant == kMaxInt); |
1937 int32_t constant_abs = Abs(constant); | 1937 int32_t constant_abs = Abs(constant); |
1938 | 1938 |
1939 if (!end_range_constant && | 1939 if (!end_range_constant && |
1940 (small_constant || | 1940 (small_constant || (base::bits::IsPowerOfTwo32(constant_abs)) || |
1941 (IsPowerOf2(constant_abs)) || | 1941 (!can_overflow && (base::bits::IsPowerOfTwo32(constant_abs + 1) || |
1942 (!can_overflow && (IsPowerOf2(constant_abs + 1) || | 1942 base::bits::IsPowerOfTwo32(constant_abs - 1))))) { |
1943 IsPowerOf2(constant_abs - 1))))) { | |
1944 LConstantOperand* right = UseConstant(most_const); | 1943 LConstantOperand* right = UseConstant(most_const); |
1945 bool need_register = IsPowerOf2(constant_abs) && !small_constant; | 1944 bool need_register = |
| 1945 base::bits::IsPowerOfTwo32(constant_abs) && !small_constant; |
1946 LOperand* left = need_register ? UseRegister(least_const) | 1946 LOperand* left = need_register ? UseRegister(least_const) |
1947 : UseRegisterAtStart(least_const); | 1947 : UseRegisterAtStart(least_const); |
1948 LInstruction* result = | 1948 LInstruction* result = |
1949 DefineAsRegister(new(zone()) LMulConstIS(left, right)); | 1949 DefineAsRegister(new(zone()) LMulConstIS(left, right)); |
1950 if ((bailout_on_minus_zero && constant <= 0) || can_overflow) { | 1950 if ((bailout_on_minus_zero && constant <= 0) || can_overflow) { |
1951 result = AssignEnvironment(result); | 1951 result = AssignEnvironment(result); |
1952 } | 1952 } |
1953 return result; | 1953 return result; |
1954 } | 1954 } |
1955 } | 1955 } |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2737 HAllocateBlockContext* instr) { | 2737 HAllocateBlockContext* instr) { |
2738 LOperand* context = UseFixed(instr->context(), cp); | 2738 LOperand* context = UseFixed(instr->context(), cp); |
2739 LOperand* function = UseRegisterAtStart(instr->function()); | 2739 LOperand* function = UseRegisterAtStart(instr->function()); |
2740 LAllocateBlockContext* result = | 2740 LAllocateBlockContext* result = |
2741 new(zone()) LAllocateBlockContext(context, function); | 2741 new(zone()) LAllocateBlockContext(context, function); |
2742 return MarkAsCall(DefineFixed(result, cp), instr); | 2742 return MarkAsCall(DefineFixed(result, cp), instr); |
2743 } | 2743 } |
2744 | 2744 |
2745 | 2745 |
2746 } } // namespace v8::internal | 2746 } } // namespace v8::internal |
OLD | NEW |