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

Unified Diff: runtime/vm/intermediate_language_x64.cc

Issue 21876005: Fixes obo error in javascript int checking. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/integers.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/intermediate_language_x64.cc
===================================================================
--- runtime/vm/intermediate_language_x64.cc (revision 25732)
+++ runtime/vm/intermediate_language_x64.cc (working copy)
@@ -2151,20 +2151,15 @@
}
-static void Emit54BitOverflowCheck(FlowGraphCompiler* compiler,
- Label* overflow,
- Register result) {
+static void EmitJavascriptOverflowCheck(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 55...64 must be all 0 or all 1. (It would be bit 54, but result
- // is tagged.)
- __ shlq(result, Immediate(64 - 55));
- __ sarq(result, Immediate(64 - 55));
- __ cmpq(result, TMP);
- __ j(NOT_EQUAL, overflow); // 54-bit overflow.
- __ cmpq(result, Immediate(-0x1FFFFFFFFFFFFFLL - 1));
- __ j(EQUAL, overflow); // The most negative 54-bit int is also disallowed.
+ __ cmpq(result, Immediate(-0x20000000000000));
+ __ j(LESS, overflow);
+ __ cmpq(result, Immediate(0x20000000000000));
+ __ j(GREATER, overflow);
}
}
@@ -2208,7 +2203,7 @@
// Shift for result now we know there is no overflow.
__ shlq(left, Immediate(value));
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
return;
}
@@ -2238,7 +2233,7 @@
__ SmiUntag(right);
__ shlq(left, right);
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
return;
}
@@ -2289,7 +2284,7 @@
// Shift for result now we know there is no overflow.
__ shlq(left, right);
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
}
@@ -2488,7 +2483,7 @@
UNREACHABLE();
break;
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
return;
} // locs()->in(1).IsConstant().
@@ -2531,7 +2526,7 @@
UNREACHABLE();
break;
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
return;
} // locs()->in(1).IsStackSlot().
@@ -2661,7 +2656,7 @@
UNREACHABLE();
break;
}
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
}
@@ -3839,7 +3834,7 @@
kDeoptUnaryOp);
__ negq(value);
__ j(OVERFLOW, deopt);
- Emit54BitOverflowCheck(compiler, deopt, value);
+ EmitJavascriptOverflowCheck(compiler, deopt, value);
break;
}
case Token::kBIT_NOT:
@@ -3900,7 +3895,7 @@
__ shlq(temp, Immediate(1));
__ j(OVERFLOW, &do_call, Assembler::kNearJump);
__ SmiTag(result);
- Emit54BitOverflowCheck(compiler, &do_call, result);
+ EmitJavascriptOverflowCheck(compiler, &do_call, result);
__ jmp(&done);
__ Bind(&do_call);
ASSERT(instance_call()->HasICData());
@@ -3946,7 +3941,7 @@
__ shlq(temp, Immediate(1));
__ j(OVERFLOW, deopt);
__ SmiTag(result);
- Emit54BitOverflowCheck(compiler, deopt, result);
+ EmitJavascriptOverflowCheck(compiler, deopt, result);
}
« no previous file with comments | « runtime/lib/integers.dart ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698