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