@@ -6090,7 +6090,9 @@ LocationSummary* ShiftInt64OpInstr::MakeLocationSummary(Zone* zone,
6090
6090
zone, kNumInputs , kNumTemps , LocationSummary::kCallOnSlowPath );
6091
6091
summary->set_in (0 , Location::Pair (Location::RequiresRegister (),
6092
6092
Location::RequiresRegister ()));
6093
- if (ConstantInstr* constant = right ()->definition ()->AsConstant ()) {
6093
+ if (RangeUtils::IsPositive (shift_range ()) &&
6094
+ right ()->definition ()->IsConstant ()) {
6095
+ ConstantInstr* constant = right ()->definition ()->AsConstant ();
6094
6096
summary->set_in (1 , Location::Constant (constant));
6095
6097
} else {
6096
6098
summary->set_in (1 , Location::Pair (Location::RequiresRegister (),
@@ -6114,7 +6116,7 @@ void ShiftInt64OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6114
6116
EmitShiftInt64ByConstant (compiler, op_kind (), out_lo, out_hi, left_lo,
6115
6117
left_hi, locs ()->in (1 ).constant ());
6116
6118
} else {
6117
- // Code for a variable shift amount.
6119
+ // Code for a variable shift amount (or constant that throws) .
6118
6120
PairLocation* right_pair = locs ()->in (1 ).AsPairLocation ();
6119
6121
Register right_lo = right_pair->At (0 ).reg ();
6120
6122
Register right_hi = right_pair->At (1 ).reg ();
@@ -6228,7 +6230,9 @@ LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone,
6228
6230
LocationSummary* summary = new (zone) LocationSummary (
6229
6231
zone, kNumInputs , kNumTemps , LocationSummary::kCallOnSlowPath );
6230
6232
summary->set_in (0 , Location::RequiresRegister ());
6231
- if (ConstantInstr* constant = right ()->definition ()->AsConstant ()) {
6233
+ if (RangeUtils::IsPositive (shift_range ()) &&
6234
+ right ()->definition ()->IsConstant ()) {
6235
+ ConstantInstr* constant = right ()->definition ()->AsConstant ();
6232
6236
summary->set_in (1 , Location::Constant (constant));
6233
6237
} else {
6234
6238
summary->set_in (1 , Location::Pair (Location::RequiresRegister (),
@@ -6248,6 +6252,7 @@ void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6248
6252
EmitShiftUint32ByConstant (compiler, op_kind (), out, left,
6249
6253
locs ()->in (1 ).constant ());
6250
6254
} else {
6255
+ // Code for a variable shift amount (or constant that throws).
6251
6256
PairLocation* right_pair = locs ()->in (1 ).AsPairLocation ();
6252
6257
Register right_lo = right_pair->At (0 ).reg ();
6253
6258
Register right_hi = right_pair->At (1 ).reg ();
@@ -6338,16 +6343,26 @@ LocationSummary* UnaryInt64OpInstr::MakeLocationSummary(Zone* zone,
6338
6343
}
6339
6344
6340
6345
void UnaryInt64OpInstr::EmitNativeCode (FlowGraphCompiler* compiler) {
6341
- ASSERT (op_kind () == Token::kBIT_NOT );
6342
6346
PairLocation* left_pair = locs ()->in (0 ).AsPairLocation ();
6343
6347
Register left_lo = left_pair->At (0 ).reg ();
6344
6348
Register left_hi = left_pair->At (1 ).reg ();
6345
6349
6346
6350
PairLocation* out_pair = locs ()->out (0 ).AsPairLocation ();
6347
6351
Register out_lo = out_pair->At (0 ).reg ();
6348
6352
Register out_hi = out_pair->At (1 ).reg ();
6349
- __ mvn (out_lo, Operand (left_lo));
6350
- __ mvn (out_hi, Operand (left_hi));
6353
+
6354
+ switch (op_kind ()) {
6355
+ case Token::kBIT_NOT :
6356
+ __ mvn (out_lo, Operand (left_lo));
6357
+ __ mvn (out_hi, Operand (left_hi));
6358
+ break ;
6359
+ case Token::kNEGATE :
6360
+ __ rsbs (out_lo, left_lo, Operand (0 ));
6361
+ __ sbc (out_hi, out_hi, Operand (out_hi));
6362
+ __ sub (out_hi, out_hi, Operand (left_hi));
6363
+ default :
6364
+ UNREACHABLE ();
6365
+ }
6351
6366
}
6352
6367
6353
6368
CompileType BinaryUint32OpInstr::ComputeType () const {
0 commit comments