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

Unified Diff: runtime/lib/integers.cc

Issue 842033005: Make Bigint instances immutable by removing all setters. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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 43482)
+++ runtime/lib/integers.cc (working copy)
@@ -409,14 +409,6 @@
}
-DEFINE_NATIVE_ENTRY(Bigint_setNeg, 2) {
- const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
- const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1));
- bigint.set_neg(neg);
- return Object::null();
-}
-
-
DEFINE_NATIVE_ENTRY(Bigint_getUsed, 1) {
const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
return bigint.used();
@@ -423,14 +415,6 @@
}
-DEFINE_NATIVE_ENTRY(Bigint_setUsed, 2) {
- const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
- const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(1));
- bigint.set_used(used);
- return Object::null();
-}
-
-
DEFINE_NATIVE_ENTRY(Bigint_getDigits, 1) {
const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
return bigint.digits();
@@ -437,18 +421,13 @@
}
-DEFINE_NATIVE_ENTRY(Bigint_setDigits, 2) {
- const Bigint& bigint = Bigint::CheckedHandle(arguments->NativeArgAt(0));
- const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(1));
+DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) {
+ // First arg is null type arguments, since class Bigint is not parameterized.
+ const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1));
+ const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2));
+ const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3));
ASSERT(!digits.IsNull());
- bigint.set_digits(digits);
- return Object::null();
+ return Bigint::New(neg.value(), used.Value(), digits);
}
-
-DEFINE_NATIVE_ENTRY(Bigint_allocate, 1) {
- // Argument is null type arguments, since class Bigint is not parameterized.
- return Bigint::New();
-}
-
} // namespace dart

Powered by Google App Engine
This is Rietveld 408576698