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

Side by Side Diff: src/arm64/lithium-codegen-arm64.cc

Issue 487913005: ARM64: Fix SHR logic error. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | « src/arm64/full-codegen-arm64.cc ('k') | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/arm64/lithium-gap-resolver-arm64.h" 8 #include "src/arm64/lithium-gap-resolver-arm64.h"
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/hydrogen-osr.h" 10 #include "src/hydrogen-osr.h"
(...skipping 4873 matching lines...) Expand 10 before | Expand all | Expand 10 after
4884 Register left = ToRegister32(instr->left()); 4884 Register left = ToRegister32(instr->left());
4885 Register result = ToRegister32(instr->result()); 4885 Register result = ToRegister32(instr->result());
4886 4886
4887 if (right_op->IsRegister()) { 4887 if (right_op->IsRegister()) {
4888 Register right = ToRegister32(instr->right()); 4888 Register right = ToRegister32(instr->right());
4889 switch (instr->op()) { 4889 switch (instr->op()) {
4890 case Token::ROR: __ Ror(result, left, right); break; 4890 case Token::ROR: __ Ror(result, left, right); break;
4891 case Token::SAR: __ Asr(result, left, right); break; 4891 case Token::SAR: __ Asr(result, left, right); break;
4892 case Token::SHL: __ Lsl(result, left, right); break; 4892 case Token::SHL: __ Lsl(result, left, right); break;
4893 case Token::SHR: 4893 case Token::SHR:
4894 __ Lsr(result, left, right);
4894 if (instr->can_deopt()) { 4895 if (instr->can_deopt()) {
4895 Label right_not_zero; 4896 // If `left >>> right` >= 0x80000000, the result is not representable
4896 __ Cbnz(right, &right_not_zero); 4897 // in a signed 32-bit smi.
4897 DeoptimizeIfNegative(left, instr->environment()); 4898 DeoptimizeIfNegative(result, instr->environment());
4898 __ Bind(&right_not_zero);
4899 } 4899 }
4900 __ Lsr(result, left, right);
4901 break; 4900 break;
4902 default: UNREACHABLE(); 4901 default: UNREACHABLE();
4903 } 4902 }
4904 } else { 4903 } else {
4905 DCHECK(right_op->IsConstantOperand()); 4904 DCHECK(right_op->IsConstantOperand());
4906 int shift_count = JSShiftAmountFromLConstant(right_op); 4905 int shift_count = JSShiftAmountFromLConstant(right_op);
4907 if (shift_count == 0) { 4906 if (shift_count == 0) {
4908 if ((instr->op() == Token::SHR) && instr->can_deopt()) { 4907 if ((instr->op() == Token::SHR) && instr->can_deopt()) {
4909 DeoptimizeIfNegative(left, instr->environment()); 4908 DeoptimizeIfNegative(left, instr->environment());
4910 } 4909 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4945 case Token::SAR: 4944 case Token::SAR:
4946 __ Ubfx(result, right, kSmiShift, 5); 4945 __ Ubfx(result, right, kSmiShift, 5);
4947 __ Asr(result, left, result); 4946 __ Asr(result, left, result);
4948 __ Bic(result, result, kSmiShiftMask); 4947 __ Bic(result, result, kSmiShiftMask);
4949 break; 4948 break;
4950 case Token::SHL: 4949 case Token::SHL:
4951 __ Ubfx(result, right, kSmiShift, 5); 4950 __ Ubfx(result, right, kSmiShift, 5);
4952 __ Lsl(result, left, result); 4951 __ Lsl(result, left, result);
4953 break; 4952 break;
4954 case Token::SHR: 4953 case Token::SHR:
4955 if (instr->can_deopt()) {
4956 Label right_not_zero;
4957 __ Cbnz(right, &right_not_zero);
4958 DeoptimizeIfNegative(left, instr->environment());
4959 __ Bind(&right_not_zero);
4960 }
4961 __ Ubfx(result, right, kSmiShift, 5); 4954 __ Ubfx(result, right, kSmiShift, 5);
4962 __ Lsr(result, left, result); 4955 __ Lsr(result, left, result);
4963 __ Bic(result, result, kSmiShiftMask); 4956 __ Bic(result, result, kSmiShiftMask);
4957 if (instr->can_deopt()) {
4958 // If `left >>> right` >= 0x80000000, the result is not representable
4959 // in a signed 32-bit smi.
4960 DeoptimizeIfNegative(result, instr->environment());
4961 }
4964 break; 4962 break;
4965 default: UNREACHABLE(); 4963 default: UNREACHABLE();
4966 } 4964 }
4967 } else { 4965 } else {
4968 DCHECK(right_op->IsConstantOperand()); 4966 DCHECK(right_op->IsConstantOperand());
4969 int shift_count = JSShiftAmountFromLConstant(right_op); 4967 int shift_count = JSShiftAmountFromLConstant(right_op);
4970 if (shift_count == 0) { 4968 if (shift_count == 0) {
4971 if ((instr->op() == Token::SHR) && instr->can_deopt()) { 4969 if ((instr->op() == Token::SHR) && instr->can_deopt()) {
4972 DeoptimizeIfNegative(left, instr->environment()); 4970 DeoptimizeIfNegative(left, instr->environment());
4973 } 4971 }
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after
6027 Handle<ScopeInfo> scope_info = instr->scope_info(); 6025 Handle<ScopeInfo> scope_info = instr->scope_info();
6028 __ Push(scope_info); 6026 __ Push(scope_info);
6029 __ Push(ToRegister(instr->function())); 6027 __ Push(ToRegister(instr->function()));
6030 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6028 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6031 RecordSafepoint(Safepoint::kNoLazyDeopt); 6029 RecordSafepoint(Safepoint::kNoLazyDeopt);
6032 } 6030 }
6033 6031
6034 6032
6035 6033
6036 } } // namespace v8::internal 6034 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | test/mjsunit/compiler/shift-shr.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698