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

Unified Diff: runtime/lib/integers.cc

Issue 15741019: Ensures that Bigints returned to Dart are all checked by Integer::AsValidInteger. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
Index: runtime/lib/integers.cc
===================================================================
--- runtime/lib/integers.cc (revision 23089)
+++ runtime/lib/integers.cc (working copy)
@@ -256,10 +256,16 @@
big_value = Bigint::Cast(value).raw();
}
switch (kind) {
- case Token::kSHL:
- return BigintOperations::ShiftLeft(big_value, amount.Value());
- case Token::kSHR:
- return BigintOperations::ShiftRight(big_value, amount.Value());
+ case Token::kSHL: {
+ const Bigint& big = Bigint::Handle(
+ BigintOperations::ShiftLeft(big_value, amount.Value()));
+ return big.AsValidInteger();
Ivan Posva 2013/05/23 21:37:54 Aren't these here redundant as the result will be
zra 2013/05/23 22:14:38 You're right. I've removed the changes here.
+ }
+ case Token::kSHR: {
+ const Bigint& big = Bigint::Handle(
+ BigintOperations::ShiftRight(big_value, amount.Value()));
+ return big.AsValidInteger();
+ }
default:
UNIMPLEMENTED();
}
@@ -304,6 +310,7 @@
return Smi::New(result);
}
+
Ivan Posva 2013/05/23 21:37:54 Two lines!
zra 2013/05/23 22:14:38 There are two lines between the bottom of the func
// Mint natives.
DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) {
@@ -316,6 +323,7 @@
return Integer::New(result);
}
+
// Bigint natives.
DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) {
« no previous file with comments | « runtime/lib/double.cc ('k') | runtime/lib/typed_data.cc » ('j') | runtime/lib/typed_data.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698