| 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 VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define 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 3227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3238 public: | 3238 public: |
| 3239 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); | 3239 static RawInteger* New(const String& str, Heap::Space space = Heap::kNew); |
| 3240 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); | 3240 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); |
| 3241 | 3241 |
| 3242 virtual double AsDoubleValue() const; | 3242 virtual double AsDoubleValue() const; |
| 3243 virtual int64_t AsInt64Value() const; | 3243 virtual int64_t AsInt64Value() const; |
| 3244 | 3244 |
| 3245 // Returns 0, -1 or 1. | 3245 // Returns 0, -1 or 1. |
| 3246 virtual int CompareWith(const Integer& other) const; | 3246 virtual int CompareWith(const Integer& other) const; |
| 3247 | 3247 |
| 3248 static RawInteger* AsInteger(const Integer& value); |
| 3249 static RawInteger* BinaryOp(Token::Kind operation, |
| 3250 const Integer& left, |
| 3251 const Integer& right); |
| 3252 |
| 3248 OBJECT_IMPLEMENTATION(Integer, Number); | 3253 OBJECT_IMPLEMENTATION(Integer, Number); |
| 3249 friend class Class; | 3254 friend class Class; |
| 3250 }; | 3255 }; |
| 3251 | 3256 |
| 3252 | 3257 |
| 3253 class Smi : public Integer { | 3258 class Smi : public Integer { |
| 3254 public: | 3259 public: |
| 3255 static const intptr_t kBits = kSmiBits; | 3260 static const intptr_t kBits = kSmiBits; |
| 3256 static const intptr_t kMaxValue = kSmiMax; | 3261 static const intptr_t kMaxValue = kSmiMax; |
| 3257 static const intptr_t kMinValue = kSmiMin; | 3262 static const intptr_t kMinValue = kSmiMin; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3379 static intptr_t InstanceSize() { return 0; } | 3384 static intptr_t InstanceSize() { return 0; } |
| 3380 | 3385 |
| 3381 static intptr_t InstanceSize(intptr_t len) { | 3386 static intptr_t InstanceSize(intptr_t len) { |
| 3382 ASSERT(0 <= len && len <= kMaxElements); | 3387 ASSERT(0 <= len && len <= kMaxElements); |
| 3383 return RoundedAllocationSize(sizeof(RawBigint) + (len * kBytesPerElement)); | 3388 return RoundedAllocationSize(sizeof(RawBigint) + (len * kBytesPerElement)); |
| 3384 } | 3389 } |
| 3385 | 3390 |
| 3386 static RawBigint* New(const String& str, Heap::Space space = Heap::kNew); | 3391 static RawBigint* New(const String& str, Heap::Space space = Heap::kNew); |
| 3387 static RawBigint* New(int64_t value, Heap::Space space = Heap::kNew); | 3392 static RawBigint* New(int64_t value, Heap::Space space = Heap::kNew); |
| 3388 | 3393 |
| 3394 static RawBigint* AsBigint(const Integer& value); |
| 3395 static RawBigint* BinaryOp(Token::Kind operation, |
| 3396 const Bigint& left, |
| 3397 const Bigint& right); |
| 3398 |
| 3389 private: | 3399 private: |
| 3390 Chunk GetChunkAt(intptr_t i) const { | 3400 Chunk GetChunkAt(intptr_t i) const { |
| 3391 return *ChunkAddr(i); | 3401 return *ChunkAddr(i); |
| 3392 } | 3402 } |
| 3393 | 3403 |
| 3394 void SetChunkAt(intptr_t i, Chunk newValue) const { | 3404 void SetChunkAt(intptr_t i, Chunk newValue) const { |
| 3395 *ChunkAddr(i) = newValue; | 3405 *ChunkAddr(i) = newValue; |
| 3396 } | 3406 } |
| 3397 | 3407 |
| 3398 // Returns the number of chunks in use. | 3408 // Returns the number of chunks in use. |
| (...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5618 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5628 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
| 5619 return false; | 5629 return false; |
| 5620 } | 5630 } |
| 5621 } | 5631 } |
| 5622 return true; | 5632 return true; |
| 5623 } | 5633 } |
| 5624 | 5634 |
| 5625 } // namespace dart | 5635 } // namespace dart |
| 5626 | 5636 |
| 5627 #endif // VM_OBJECT_H_ | 5637 #endif // VM_OBJECT_H_ |
| OLD | NEW |