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

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

Issue 2449013003: Don't allocate on the Dart heap during Bigint::ToCString(). (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 6619 matching lines...) Expand 10 before | Expand all | Expand 10 after
6630 // Accessors used by native calls from Dart. 6630 // Accessors used by native calls from Dart.
6631 RawBool* neg() const { return raw_ptr()->neg_; } 6631 RawBool* neg() const { return raw_ptr()->neg_; }
6632 RawSmi* used() const { return raw_ptr()->used_; } 6632 RawSmi* used() const { return raw_ptr()->used_; }
6633 RawTypedData* digits() const { return raw_ptr()->digits_; } 6633 RawTypedData* digits() const { return raw_ptr()->digits_; }
6634 6634
6635 // Accessors used by runtime calls from C++. 6635 // Accessors used by runtime calls from C++.
6636 bool Neg() const; 6636 bool Neg() const;
6637 intptr_t Used() const; 6637 intptr_t Used() const;
6638 uint32_t DigitAt(intptr_t index) const; 6638 uint32_t DigitAt(intptr_t index) const;
6639 6639
6640 const char* ToDecCString(uword (*allocator)(intptr_t size)) const; 6640 const char* ToDecCString(Zone* zone) const;
6641 const char* ToHexCString(uword (*allocator)(intptr_t size)) const; 6641 const char* ToHexCString(Zone* zone) const;
6642 6642
6643 static const intptr_t kBitsPerDigit = 32; // Same as _Bigint._DIGIT_BITS 6643 static const intptr_t kBitsPerDigit = 32; // Same as _Bigint._DIGIT_BITS
6644 static const intptr_t kBytesPerDigit = 4; 6644 static const intptr_t kBytesPerDigit = 4;
6645 static const int64_t kDigitBase = 1LL << kBitsPerDigit; 6645 static const int64_t kDigitBase = 1LL << kBitsPerDigit;
6646 static const int64_t kDigitMask = kDigitBase - 1; 6646 static const int64_t kDigitMask = kDigitBase - 1;
6647 6647
6648 static RawBigint* New(Heap::Space space = Heap::kNew); // For snapshots. 6648 static RawBigint* New(Heap::Space space = Heap::kNew); // For snapshots.
6649 6649
6650 static RawBigint* New(bool neg, intptr_t used, const TypedData& digits, 6650 static RawBigint* New(bool neg, intptr_t used, const TypedData& digits,
6651 Heap::Space space = Heap::kNew); 6651 Heap::Space space = Heap::kNew);
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after
9011 9011
9012 inline void TypeArguments::SetHash(intptr_t value) const { 9012 inline void TypeArguments::SetHash(intptr_t value) const {
9013 // This is only safe because we create a new Smi, which does not cause 9013 // This is only safe because we create a new Smi, which does not cause
9014 // heap allocation. 9014 // heap allocation.
9015 StoreSmi(&raw_ptr()->hash_, Smi::New(value)); 9015 StoreSmi(&raw_ptr()->hash_, Smi::New(value));
9016 } 9016 }
9017 9017
9018 } // namespace dart 9018 } // namespace dart
9019 9019
9020 #endif // VM_OBJECT_H_ 9020 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart_api_impl.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698