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

Side by Side Diff: runtime/vm/object.h

Issue 2982823002: Option to truncate integers to 64 bits, part 2 (Closed)
Patch Set: Fixes for review comments Created 3 years, 5 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 unified diff | Download patch
OLDNEW
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
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).
6362 static RawInteger* NewCanonical(const String& str); 6363 static RawInteger* NewCanonical(const String& str);
6363 6364
6364 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew); 6365 static RawInteger* New(int64_t value, Heap::Space space = Heap::kNew);
6365 6366
6366 virtual bool OperatorEquals(const Instance& other) const { 6367 virtual bool OperatorEquals(const Instance& other) const {
6367 return Equals(other); 6368 return Equals(other);
6368 } 6369 }
6369 virtual bool CanonicalizeEquals(const Instance& other) const { 6370 virtual bool CanonicalizeEquals(const Instance& other) const {
6370 return Equals(other); 6371 return Equals(other);
6371 } 6372 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
6597 static RawBigint* NewFromShiftedInt64(int64_t value, 6598 static RawBigint* NewFromShiftedInt64(int64_t value,
6598 intptr_t shift, 6599 intptr_t shift,
6599 Heap::Space space = Heap::kNew); 6600 Heap::Space space = Heap::kNew);
6600 6601
6601 static RawBigint* NewFromCString(const char* str, 6602 static RawBigint* NewFromCString(const char* str,
6602 Heap::Space space = Heap::kNew); 6603 Heap::Space space = Heap::kNew);
6603 6604
6604 // Returns a canonical Bigint object allocated in the old gen space. 6605 // Returns a canonical Bigint object allocated in the old gen space.
6605 static RawBigint* NewCanonical(const String& str); 6606 static RawBigint* NewCanonical(const String& str);
6606 6607
6608 // Returns true if Bigint can't be instantiated.
6609 static bool IsDisabled() { return FLAG_limit_ints_to_64_bits; }
6610
6607 private: 6611 private:
6608 void SetNeg(bool value) const; 6612 void SetNeg(bool value) const;
6609 void SetUsed(intptr_t value) const; 6613 void SetUsed(intptr_t value) const;
6610 void set_digits(const TypedData& value) const; 6614 void set_digits(const TypedData& value) const;
6611 6615
6612 // Convenience helpers. 6616 // Convenience helpers.
6613 static RawTypedData* NewDigits(intptr_t length, 6617 static RawTypedData* NewDigits(intptr_t length,
6614 Heap::Space space = Heap::kNew); 6618 Heap::Space space = Heap::kNew);
6615 static uint32_t DigitAt(const TypedData& digits, intptr_t index); 6619 static uint32_t DigitAt(const TypedData& digits, intptr_t index);
6616 static void SetDigitAt(const TypedData& digits, 6620 static void SetDigitAt(const TypedData& digits,
(...skipping 2292 matching lines...) Expand 10 before | Expand all | Expand 10 after
8909 8913
8910 inline void TypeArguments::SetHash(intptr_t value) const { 8914 inline void TypeArguments::SetHash(intptr_t value) const {
8911 // This is only safe because we create a new Smi, which does not cause 8915 // This is only safe because we create a new Smi, which does not cause
8912 // heap allocation. 8916 // heap allocation.
8913 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 8917 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
8914 } 8918 }
8915 8919
8916 } // namespace dart 8920 } // namespace dart
8917 8921
8918 #endif // RUNTIME_VM_OBJECT_H_ 8922 #endif // RUNTIME_VM_OBJECT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698