| Index: runtime/vm/intermediate_language_x64.cc
|
| ===================================================================
|
| --- runtime/vm/intermediate_language_x64.cc (revision 25633)
|
| +++ runtime/vm/intermediate_language_x64.cc (working copy)
|
| @@ -2151,18 +2151,20 @@
|
| }
|
|
|
|
|
| -static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler,
|
| +static void Emit54BitOverflowCheck(FlowGraphCompiler* compiler,
|
| Label* overflow,
|
| Register result) {
|
| if (FLAG_throw_on_javascript_int_overflow) {
|
| ASSERT(overflow != NULL);
|
| __ movq(TMP, result); // result is a tagged Smi.
|
| - // Bits 54...64 must be all 0 or all 1. (It would be bit 53, but result
|
| + // Bits 55...64 must be all 0 or all 1. (It would be bit 54, but result
|
| // is tagged.)
|
| - __ shlq(result, Immediate(64 - 54));
|
| - __ sarq(result, Immediate(64 - 54));
|
| + __ shlq(result, Immediate(64 - 55));
|
| + __ sarq(result, Immediate(64 - 55));
|
| __ cmpq(result, TMP);
|
| - __ j(NOT_EQUAL, overflow); // 53-bit overflow.
|
| + __ j(NOT_EQUAL, overflow); // 54-bit overflow.
|
| + __ cmpq(result, Immediate(-0x1FFFFFFFFFFFFF-1));
|
| + __ j(EQUAL, overflow); // The most negative 54-bit int is also disallowed.
|
| }
|
| }
|
|
|
| @@ -2206,7 +2208,7 @@
|
| // Shift for result now we know there is no overflow.
|
| __ shlq(left, Immediate(value));
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| return;
|
| }
|
|
|
| @@ -2236,7 +2238,7 @@
|
| __ SmiUntag(right);
|
| __ shlq(left, right);
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| return;
|
| }
|
|
|
| @@ -2287,7 +2289,7 @@
|
| // Shift for result now we know there is no overflow.
|
| __ shlq(left, right);
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| }
|
|
|
|
|
| @@ -2486,7 +2488,7 @@
|
| UNREACHABLE();
|
| break;
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| return;
|
| } // locs()->in(1).IsConstant().
|
|
|
| @@ -2529,7 +2531,7 @@
|
| UNREACHABLE();
|
| break;
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| return;
|
| } // locs()->in(1).IsStackSlot().
|
|
|
| @@ -2659,7 +2661,7 @@
|
| UNREACHABLE();
|
| break;
|
| }
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| }
|
|
|
|
|
| @@ -3840,7 +3842,7 @@
|
| kDeoptUnaryOp);
|
| __ negq(value);
|
| __ j(OVERFLOW, deopt);
|
| - Emit53BitOverflowCheck(compiler, deopt, value);
|
| + Emit54BitOverflowCheck(compiler, deopt, value);
|
| break;
|
| }
|
| case Token::kBIT_NOT:
|
| @@ -3901,7 +3903,7 @@
|
| __ shlq(temp, Immediate(1));
|
| __ j(OVERFLOW, &do_call, Assembler::kNearJump);
|
| __ SmiTag(result);
|
| - Emit53BitOverflowCheck(compiler, &do_call, result);
|
| + Emit54BitOverflowCheck(compiler, &do_call, result);
|
| __ jmp(&done);
|
| __ Bind(&do_call);
|
| ASSERT(instance_call()->HasICData());
|
| @@ -3947,7 +3949,7 @@
|
| __ shlq(temp, Immediate(1));
|
| __ j(OVERFLOW, deopt);
|
| __ SmiTag(result);
|
| - Emit53BitOverflowCheck(compiler, deopt, result);
|
| + Emit54BitOverflowCheck(compiler, deopt, result);
|
| }
|
|
|
|
|
|
|