| 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 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 16810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16821 UNREACHABLE(); | 16821 UNREACHABLE(); |
| 16822 } | 16822 } |
| 16823 const int64_t bit_len = used * kBitsPerDigit; | 16823 const int64_t bit_len = used * kBitsPerDigit; |
| 16824 const int64_t dec_len = (bit_len * kLog2Dividend / kLog2Divisor) + 1; | 16824 const int64_t dec_len = (bit_len * kLog2Dividend / kLog2Divisor) + 1; |
| 16825 // Add one byte for the minus sign and for the trailing \0 character. | 16825 // Add one byte for the minus sign and for the trailing \0 character. |
| 16826 const int64_t len = (Neg() ? 1 : 0) + dec_len + 1; | 16826 const int64_t len = (Neg() ? 1 : 0) + dec_len + 1; |
| 16827 char* chars = reinterpret_cast<char*>(allocator(len)); | 16827 char* chars = reinterpret_cast<char*>(allocator(len)); |
| 16828 intptr_t pos = 0; | 16828 intptr_t pos = 0; |
| 16829 const intptr_t kDivisor = 100000000; | 16829 const intptr_t kDivisor = 100000000; |
| 16830 const intptr_t kDigits = 8; | 16830 const intptr_t kDigits = 8; |
| 16831 // TODO(regis): Fix Windows error reported for ambiguous call to 'pow'. | 16831 ASSERT(pow(10.0, 1.0 * kDigits) == kDivisor); |
| 16832 // ASSERT(pow(10.0, kDigits) == kDivisor); | |
| 16833 ASSERT(kDivisor < kDigitBase); | 16832 ASSERT(kDivisor < kDigitBase); |
| 16834 ASSERT(Smi::IsValid(kDivisor)); | 16833 ASSERT(Smi::IsValid(kDivisor)); |
| 16835 // Allocate a copy of the digits. | 16834 // Allocate a copy of the digits. |
| 16836 const TypedData& rest_digits = TypedData::Handle( | 16835 const TypedData& rest_digits = TypedData::Handle( |
| 16837 TypedData::New(kTypedDataUint32ArrayCid, used)); | 16836 TypedData::New(kTypedDataUint32ArrayCid, used)); |
| 16838 for (intptr_t i = 0; i < used; i++) { | 16837 for (intptr_t i = 0; i < used; i++) { |
| 16839 rest_digits.SetUint32(i << 2, DigitAt(i)); | 16838 rest_digits.SetUint32(i << 2, DigitAt(i)); |
| 16840 } | 16839 } |
| 16841 if (used == 0) { | 16840 if (used == 0) { |
| 16842 chars[pos++] = '0'; | 16841 chars[pos++] = '0'; |
| (...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20363 return tag_label.ToCString(); | 20362 return tag_label.ToCString(); |
| 20364 } | 20363 } |
| 20365 | 20364 |
| 20366 | 20365 |
| 20367 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20366 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20368 Instance::PrintJSONImpl(stream, ref); | 20367 Instance::PrintJSONImpl(stream, ref); |
| 20369 } | 20368 } |
| 20370 | 20369 |
| 20371 | 20370 |
| 20372 } // namespace dart | 20371 } // namespace dart |
| OLD | NEW |