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

Unified Diff: runtime/vm/bigint_operations.cc

Issue 11299173: Throw OutOfMemory instead of crashing when bigint multiply overflows. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bigint_operations.cc
===================================================================
--- runtime/vm/bigint_operations.cc (revision 15309)
+++ runtime/vm/bigint_operations.cc (working copy)
@@ -731,7 +731,13 @@
const DoubleChunk left_over_carry = kDoubleChunkMaxValue >> kDigitBitSize;
const intptr_t kMaxDigits = (kDoubleChunkMaxValue - left_over_carry) / square;
if (Utils::Minimum(a_length, b_length) > kMaxDigits) {
- UNIMPLEMENTED();
+ // Use the preallocated out of memory exception to avoid calling
+ // into dart code or allocating any code.
+ Isolate* isolate = Isolate::Current();
+ const Instance& exception =
+ Instance::Handle(isolate->object_store()->out_of_memory());
+ Exceptions::Throw(exception);
+ UNREACHABLE();
}
DoubleChunk accumulator = 0; // Accumulates the result of one column.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698