Chromium Code Reviews| 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 6443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6454 virtual uint32_t AsTruncatedUint32Value() const; | 6454 virtual uint32_t AsTruncatedUint32Value() const; |
| 6455 | 6455 |
| 6456 virtual bool FitsIntoSmi() const; | 6456 virtual bool FitsIntoSmi() const; |
| 6457 | 6457 |
| 6458 // Returns 0, -1 or 1. | 6458 // Returns 0, -1 or 1. |
| 6459 virtual int CompareWith(const Integer& other) const; | 6459 virtual int CompareWith(const Integer& other) const; |
| 6460 | 6460 |
| 6461 // Return the most compact presentation of an integer. | 6461 // Return the most compact presentation of an integer. |
| 6462 RawInteger* AsValidInteger() const; | 6462 RawInteger* AsValidInteger() const; |
| 6463 | 6463 |
| 6464 // Converts integer to hex string. | |
| 6465 virtual const char* ToHexCString(Zone* zone) const; | |
|
siva
2017/07/31 22:03:51
Club this with virtual methods listed above.
Also
alexmarkov
2017/08/01 15:42:28
Done.
| |
| 6466 | |
| 6464 // Returns null to indicate that a bigint operation is required. | 6467 // Returns null to indicate that a bigint operation is required. |
| 6465 RawInteger* ArithmeticOp(Token::Kind operation, | 6468 RawInteger* ArithmeticOp(Token::Kind operation, |
| 6466 const Integer& other, | 6469 const Integer& other, |
| 6467 Heap::Space space = Heap::kNew) const; | 6470 Heap::Space space = Heap::kNew) const; |
| 6468 RawInteger* BitOp(Token::Kind operation, | 6471 RawInteger* BitOp(Token::Kind operation, |
| 6469 const Integer& other, | 6472 const Integer& other, |
| 6470 Heap::Space space = Heap::kNew) const; | 6473 Heap::Space space = Heap::kNew) const; |
| 6471 | 6474 |
| 6472 private: | 6475 private: |
| 6473 OBJECT_IMPLEMENTATION(Integer, Number); | 6476 OBJECT_IMPLEMENTATION(Integer, Number); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6636 RawBool* neg() const { return raw_ptr()->neg_; } | 6639 RawBool* neg() const { return raw_ptr()->neg_; } |
| 6637 RawSmi* used() const { return raw_ptr()->used_; } | 6640 RawSmi* used() const { return raw_ptr()->used_; } |
| 6638 RawTypedData* digits() const { return raw_ptr()->digits_; } | 6641 RawTypedData* digits() const { return raw_ptr()->digits_; } |
| 6639 | 6642 |
| 6640 // Accessors used by runtime calls from C++. | 6643 // Accessors used by runtime calls from C++. |
| 6641 bool Neg() const; | 6644 bool Neg() const; |
| 6642 intptr_t Used() const; | 6645 intptr_t Used() const; |
| 6643 uint32_t DigitAt(intptr_t index) const; | 6646 uint32_t DigitAt(intptr_t index) const; |
| 6644 | 6647 |
| 6645 const char* ToDecCString(Zone* zone) const; | 6648 const char* ToDecCString(Zone* zone) const; |
| 6646 const char* ToHexCString(Zone* zone) const; | 6649 virtual const char* ToHexCString(Zone* zone) const; |
|
siva
2017/07/31 22:03:51
Club this with all virtual methods declared above.
alexmarkov
2017/08/01 15:42:28
Done.
| |
| 6647 | 6650 |
| 6648 static const intptr_t kBitsPerDigit = 32; // Same as _Bigint._DIGIT_BITS | 6651 static const intptr_t kBitsPerDigit = 32; // Same as _Bigint._DIGIT_BITS |
| 6649 static const intptr_t kBytesPerDigit = 4; | 6652 static const intptr_t kBytesPerDigit = 4; |
| 6650 static const int64_t kDigitBase = 1LL << kBitsPerDigit; | 6653 static const int64_t kDigitBase = 1LL << kBitsPerDigit; |
| 6651 static const int64_t kDigitMask = kDigitBase - 1; | 6654 static const int64_t kDigitMask = kDigitBase - 1; |
| 6652 | 6655 |
| 6653 static RawBigint* New(Heap::Space space = Heap::kNew); // For snapshots. | 6656 static RawBigint* New(Heap::Space space = Heap::kNew); // For snapshots. |
| 6654 | 6657 |
| 6655 static RawBigint* New(bool neg, | 6658 static RawBigint* New(bool neg, |
| 6656 intptr_t used, | 6659 intptr_t used, |
| (...skipping 2328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8985 | 8988 |
| 8986 inline void TypeArguments::SetHash(intptr_t value) const { | 8989 inline void TypeArguments::SetHash(intptr_t value) const { |
| 8987 // This is only safe because we create a new Smi, which does not cause | 8990 // This is only safe because we create a new Smi, which does not cause |
| 8988 // heap allocation. | 8991 // heap allocation. |
| 8989 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); | 8992 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); |
| 8990 } | 8993 } |
| 8991 | 8994 |
| 8992 } // namespace dart | 8995 } // namespace dart |
| 8993 | 8996 |
| 8994 #endif // RUNTIME_VM_OBJECT_H_ | 8997 #endif // RUNTIME_VM_OBJECT_H_ |
| OLD | NEW |