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

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

Issue 494053002: ARM64: Slightly simplify LShiftI and LShiftS. (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/lithium-arm64.cc ('k') | no next file » | 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 4908 matching lines...) Expand 10 before | Expand all | Expand 10 after
4919 } 4919 }
4920 } 4920 }
4921 } 4921 }
4922 4922
4923 4923
4924 void LCodeGen::DoShiftS(LShiftS* instr) { 4924 void LCodeGen::DoShiftS(LShiftS* instr) {
4925 LOperand* right_op = instr->right(); 4925 LOperand* right_op = instr->right();
4926 Register left = ToRegister(instr->left()); 4926 Register left = ToRegister(instr->left());
4927 Register result = ToRegister(instr->result()); 4927 Register result = ToRegister(instr->result());
4928 4928
4929 // Only ROR by register needs a temp.
4930 DCHECK(((instr->op() == Token::ROR) && right_op->IsRegister()) ||
4931 (instr->temp() == NULL));
4932
4933 if (right_op->IsRegister()) { 4929 if (right_op->IsRegister()) {
4934 Register right = ToRegister(instr->right()); 4930 Register right = ToRegister(instr->right());
4931
4932 // JavaScript shifts only look at the bottom 5 bits of the 'right' operand.
4933 // Since we're handling smis in X registers, we have to extract these bits
4934 // explicitly.
4935 __ Ubfx(result, right, kSmiShift, 5);
4936
4935 switch (instr->op()) { 4937 switch (instr->op()) {
4936 case Token::ROR: { 4938 case Token::ROR: {
4937 Register temp = ToRegister(instr->temp()); 4939 // This is the only case that needs a scratch register. To keep things
4938 __ Ubfx(temp, right, kSmiShift, 5); 4940 // simple for the other cases, borrow a MacroAssembler scratch register.
4939 __ SmiUntag(result, left); 4941 UseScratchRegisterScope temps(masm());
ulan 2014/08/21 11:13:04 Didn't we want to reduce usage of scratch register
4940 __ Ror(result.W(), result.W(), temp.W()); 4942 Register temp = temps.AcquireW();
4943 __ SmiUntag(temp, left);
4944 __ Ror(result.W(), temp.W(), result.W());
4941 __ SmiTag(result); 4945 __ SmiTag(result);
4942 break; 4946 break;
4943 } 4947 }
4944 case Token::SAR: 4948 case Token::SAR:
4945 __ Ubfx(result, right, kSmiShift, 5);
4946 __ Asr(result, left, result); 4949 __ Asr(result, left, result);
4947 __ Bic(result, result, kSmiShiftMask); 4950 __ Bic(result, result, kSmiShiftMask);
4948 break; 4951 break;
4949 case Token::SHL: 4952 case Token::SHL:
4950 __ Ubfx(result, right, kSmiShift, 5);
4951 __ Lsl(result, left, result); 4953 __ Lsl(result, left, result);
4952 break; 4954 break;
4953 case Token::SHR: 4955 case Token::SHR:
4954 __ Ubfx(result, right, kSmiShift, 5);
4955 __ Lsr(result, left, result); 4956 __ Lsr(result, left, result);
4956 __ Bic(result, result, kSmiShiftMask); 4957 __ Bic(result, result, kSmiShiftMask);
4957 if (instr->can_deopt()) { 4958 if (instr->can_deopt()) {
4958 // If `left >>> right` >= 0x80000000, the result is not representable 4959 // If `left >>> right` >= 0x80000000, the result is not representable
4959 // in a signed 32-bit smi. 4960 // in a signed 32-bit smi.
4960 DeoptimizeIfNegative(result, instr->environment()); 4961 DeoptimizeIfNegative(result, instr->environment());
4961 } 4962 }
4962 break; 4963 break;
4963 default: UNREACHABLE(); 4964 default: UNREACHABLE();
4964 } 4965 }
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
6025 Handle<ScopeInfo> scope_info = instr->scope_info(); 6026 Handle<ScopeInfo> scope_info = instr->scope_info();
6026 __ Push(scope_info); 6027 __ Push(scope_info);
6027 __ Push(ToRegister(instr->function())); 6028 __ Push(ToRegister(instr->function()));
6028 CallRuntime(Runtime::kPushBlockContext, 2, instr); 6029 CallRuntime(Runtime::kPushBlockContext, 2, instr);
6029 RecordSafepoint(Safepoint::kNoLazyDeopt); 6030 RecordSafepoint(Safepoint::kNoLazyDeopt);
6030 } 6031 }
6031 6032
6032 6033
6033 6034
6034 } } // namespace v8::internal 6035 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/lithium-arm64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698