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

Unified Diff: runtime/vm/object.h

Issue 14962008: Fix issue 5275: The VM must always generate the most compact form of an integer (Smi, Mint or Bigin… (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/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 22813)
+++ runtime/vm/object.h (working copy)
@@ -3931,12 +3931,14 @@
// Return the most compact presentation of an integer.
RawInteger* AsValidInteger() const;
- // Return an integer in the form of a RawBigint.
- RawBigint* AsBigint() const;
RawInteger* ArithmeticOp(Token::Kind operation, const Integer& other) const;
RawInteger* BitOp(Token::Kind operation, const Integer& other) const;
+ private:
+ // Return an integer in the form of a RawBigint.
+ RawBigint* AsBigint() const;
+
OBJECT_IMPLEMENTATION(Integer, Number);
friend class Class;
};
@@ -4046,13 +4048,18 @@
virtual int CompareWith(const Integer& other) const;
- static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
- static RawMint* NewCanonical(int64_t value);
-
static intptr_t InstanceSize() {
return RoundedAllocationSize(sizeof(RawMint));
}
+ protected:
+ // Only Integer::NewXXX is allowed to call Mint::NewXXX directly.
+ friend class Integer;
+
+ static RawMint* New(int64_t value, Heap::Space space = Heap::kNew);
+
+ static RawMint* NewCanonical(int64_t value);
+
private:
void set_value(int64_t value) const;
@@ -4088,13 +4095,17 @@
return RoundedAllocationSize(sizeof(RawBigint) + (len * kBytesPerElement));
}
+ RawBigint* ArithmeticOp(Token::Kind operation, const Bigint& other) const;
Ivan Posva 2013/05/16 21:46:53 Shouldn't this return a RawInteger*?
srdjan 2013/05/16 21:53:46 Leaving it as Bigint, but rename and hide. Next CL
+
+ protected:
+ // Only Integer::NewXXX is allowed to call Bigint::NewXXX directly.
+ friend class Integer;
+
static RawBigint* New(const String& str, Heap::Space space = Heap::kNew);
// Returns a canonical Bigint object allocated in the old gen space.
static RawBigint* NewCanonical(const String& str);
- RawBigint* ArithmeticOp(Token::Kind operation, const Bigint& other) const;
-
private:
Chunk GetChunkAt(intptr_t i) const {
return *ChunkAddr(i);
« runtime/lib/double.cc ('K') | « runtime/vm/isolate.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698