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

Unified Diff: runtime/vm/bigint_operations.cc

Issue 10786003: Ensure objects emitted in code are allocated in old space. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address review comments Created 8 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/vm/ast.h ('k') | runtime/vm/code_generator_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/bigint_operations.cc
diff --git a/runtime/vm/bigint_operations.cc b/runtime/vm/bigint_operations.cc
index d453a2a4d68041a129cf41cd5247abe9250baf88..d4c774373455326e6e5a3182026b5b11432fe731 100644
--- a/runtime/vm/bigint_operations.cc
+++ b/runtime/vm/bigint_operations.cc
@@ -114,7 +114,7 @@ RawBigint* BigintOperations::NewFromCString(const char* str,
ASSERT(IsClamped(result));
return result.raw();
} else {
- return FromDecimalCString(str);
+ return FromDecimalCString(str, space);
}
}
@@ -169,14 +169,14 @@ RawBigint* BigintOperations::FromDecimalCString(const char* str,
ASSERT(('0' <= c) && (c <= '9'));
digit = digit * 10 + c - '0';
}
- Bigint& result = Bigint::Handle(Bigint::Allocate(1, space));
+ Bigint& result = Bigint::Handle(Bigint::Allocate(1));
result.SetChunkAt(0, digit);
Clamp(result); // Multiplication requires the inputs to be clamped.
// Read kDigitsPerIteration at a time, and store it in 'increment'.
// Then multiply the temporary result by 10^kDigitsPerIteration and add
// 'increment' to the new result.
- const Bigint& increment = Bigint::Handle(Bigint::Allocate(1, space));
+ const Bigint& increment = Bigint::Handle(Bigint::Allocate(1));
while (str_pos < str_length - 1) {
Chunk digit = 0;
for (intptr_t i = 0; i < kDigitsPerIteration; i++) {
@@ -191,6 +191,9 @@ RawBigint* BigintOperations::FromDecimalCString(const char* str,
}
}
Clamp(result);
+ if ((space == Heap::kOld) && !result.IsOld()) {
+ result ^= Object::Clone(result, Heap::kOld);
+ }
return result.raw();
}
« no previous file with comments | « runtime/vm/ast.h ('k') | runtime/vm/code_generator_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698