OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #ifndef RUNTIME_VM_OBJECT_H_ | 5 #ifndef RUNTIME_VM_OBJECT_H_ |
6 #define RUNTIME_VM_OBJECT_H_ | 6 #define RUNTIME_VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 6341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6352 friend class Class; | 6352 friend class Class; |
6353 }; | 6353 }; |
6354 | 6354 |
6355 class Integer : public Number { | 6355 class Integer : public Number { |
6356 public: | 6356 public: |
6357 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); | 6357 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); |
6358 static RawInteger* NewFromUint64(uint64_t value, | 6358 static RawInteger* NewFromUint64(uint64_t value, |
6359 Heap::Space space = Heap::kNew); | 6359 Heap::Space space = Heap::kNew); |
6360 | 6360 |
6361 // Returns a canonical Integer object allocated in the old gen space. | 6361 // Returns a canonical Integer object allocated in the old gen space. |
6362 // Returns null if integer is out of range (in --limit-ints-to-64-bits mode). | |
6363 static RawInteger* NewCanonical(const String& str); | 6362 static RawInteger* NewCanonical(const String& str); |
6364 | 6363 |
6365 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); | 6364 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); |
6366 | 6365 |
6367 virtual bool OperatorEquals(const Instance& other) const { | 6366 virtual bool OperatorEquals(const Instance& other) const { |
6368 return Equals(other); | 6367 return Equals(other); |
6369 } | 6368 } |
6370 virtual bool CanonicalizeEquals(const Instance& other) const { | 6369 virtual bool CanonicalizeEquals(const Instance& other) const { |
6371 return Equals(other); | 6370 return Equals(other); |
6372 } | 6371 } |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6598 static RawBigint* NewFromShiftedInt64(int64_t value, | 6597 static RawBigint* NewFromShiftedInt64(int64_t value, |
6599 intptr_t shift, | 6598 intptr_t shift, |
6600 Heap::Space space = Heap::kNew); | 6599 Heap::Space space = Heap::kNew); |
6601 | 6600 |
6602 static RawBigint* NewFromCString(const char* str, | 6601 static RawBigint* NewFromCString(const char* str, |
6603 Heap::Space space = Heap::kNew); | 6602 Heap::Space space = Heap::kNew); |
6604 | 6603 |
6605 // Returns a canonical Bigint object allocated in the old gen space. | 6604 // Returns a canonical Bigint object allocated in the old gen space. |
6606 static RawBigint* NewCanonical(const String& str); | 6605 static RawBigint* NewCanonical(const String& str); |
6607 | 6606 |
6608 // Returns true if Bigint can't be instantiated. | |
6609 static bool IsDisabled() { return FLAG_limit_ints_to_64_bits; } | |
6610 | |
6611 private: | 6607 private: |
6612 void SetNeg(bool value) const; | 6608 void SetNeg(bool value) const; |
6613 void SetUsed(intptr_t value) const; | 6609 void SetUsed(intptr_t value) const; |
6614 void set_digits(const TypedData& value) const; | 6610 void set_digits(const TypedData& value) const; |
6615 | 6611 |
6616 // Convenience helpers. | 6612 // Convenience helpers. |
6617 static RawTypedData* NewDigits(intptr_t length, | 6613 static RawTypedData* NewDigits(intptr_t length, |
6618 Heap::Space space = Heap::kNew); | 6614 Heap::Space space = Heap::kNew); |
6619 static uint32_t DigitAt(const TypedData& digits, intptr_t index); | 6615 static uint32_t DigitAt(const TypedData& digits, intptr_t index); |
6620 static void SetDigitAt(const TypedData& digits, | 6616 static void SetDigitAt(const TypedData& digits, |
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8913 | 8909 |
8914 inline void TypeArguments::SetHash(intptr_t value) const { | 8910 inline void TypeArguments::SetHash(intptr_t value) const { |
8915 // This is only safe because we create a new Smi, which does not cause | 8911 // This is only safe because we create a new Smi, which does not cause |
8916 // heap allocation. | 8912 // heap allocation. |
8917 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8913 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
8918 } | 8914 } |
8919 | 8915 |
8920 } // namespace dart | 8916 } // namespace dart |
8921 | 8917 |
8922 #endif // RUNTIME_VM_OBJECT_H_ | 8918 #endif // RUNTIME_VM_OBJECT_H_ |
OLD | NEW |