| 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 16801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 16812 UNREACHABLE(); | 16812 UNREACHABLE(); |
| 16813 } | 16813 } |
| 16814 const int64_t bit_len = used * kBitsPerDigit; | 16814 const int64_t bit_len = used * kBitsPerDigit; |
| 16815 const int64_t dec_len = (bit_len * kLog2Dividend / kLog2Divisor) + 1; | 16815 const int64_t dec_len = (bit_len * kLog2Dividend / kLog2Divisor) + 1; |
| 16816 // Add one byte for the minus sign and for the trailing \0 character. | 16816 // Add one byte for the minus sign and for the trailing \0 character. |
| 16817 const int64_t len = (Neg() ? 1 : 0) + dec_len + 1; | 16817 const int64_t len = (Neg() ? 1 : 0) + dec_len + 1; |
| 16818 char* chars = reinterpret_cast<char*>(allocator(len)); | 16818 char* chars = reinterpret_cast<char*>(allocator(len)); |
| 16819 intptr_t pos = 0; | 16819 intptr_t pos = 0; |
| 16820 const intptr_t kDivisor = 100000000; | 16820 const intptr_t kDivisor = 100000000; |
| 16821 const intptr_t kDigits = 8; | 16821 const intptr_t kDigits = 8; |
| 16822 ASSERT(pow(10.0, kDigits) == kDivisor); | 16822 // TODO(regis): Fix Windows error reported for ambiguous call to 'pow'. |
| 16823 // ASSERT(pow(10.0, kDigits) == kDivisor); |
| 16823 ASSERT(kDivisor < kDigitBase); | 16824 ASSERT(kDivisor < kDigitBase); |
| 16824 ASSERT(Smi::IsValid(kDivisor)); | 16825 ASSERT(Smi::IsValid(kDivisor)); |
| 16825 // Allocate a copy of the digits. | 16826 // Allocate a copy of the digits. |
| 16826 const TypedData& rest_digits = TypedData::Handle( | 16827 const TypedData& rest_digits = TypedData::Handle( |
| 16827 TypedData::New(kTypedDataUint32ArrayCid, used)); | 16828 TypedData::New(kTypedDataUint32ArrayCid, used)); |
| 16828 for (intptr_t i = 0; i < used; i++) { | 16829 for (intptr_t i = 0; i < used; i++) { |
| 16829 rest_digits.SetUint32(i << 2, DigitAt(i)); | 16830 rest_digits.SetUint32(i << 2, DigitAt(i)); |
| 16830 } | 16831 } |
| 16831 if (used == 0) { | 16832 if (used == 0) { |
| 16832 chars[pos++] = '0'; | 16833 chars[pos++] = '0'; |
| (...skipping 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20353 return tag_label.ToCString(); | 20354 return tag_label.ToCString(); |
| 20354 } | 20355 } |
| 20355 | 20356 |
| 20356 | 20357 |
| 20357 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20358 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20358 Instance::PrintJSONImpl(stream, ref); | 20359 Instance::PrintJSONImpl(stream, ref); |
| 20359 } | 20360 } |
| 20360 | 20361 |
| 20361 | 20362 |
| 20362 } // namespace dart | 20363 } // namespace dart |
| OLD | NEW |