Chromium Code Reviews| 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/become.h" | 10 #include "vm/become.h" |
| (...skipping 18220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18231 if (Smi::IsValid(value)) { | 18231 if (Smi::IsValid(value)) { |
| 18232 // This cast is safe because Smi::IsValid verifies that value will fit. | 18232 // This cast is safe because Smi::IsValid verifies that value will fit. |
| 18233 intptr_t val = static_cast<intptr_t>(value); | 18233 intptr_t val = static_cast<intptr_t>(value); |
| 18234 return Smi::New(val); | 18234 return Smi::New(val); |
| 18235 } | 18235 } |
| 18236 return Mint::New(value); | 18236 return Mint::New(value); |
| 18237 } | 18237 } |
| 18238 return raw(); | 18238 return raw(); |
| 18239 } | 18239 } |
| 18240 | 18240 |
| 18241 const char* Integer::ToHexCString(Zone* zone) const { | |
| 18242 ASSERT(IsSmi() || IsMint()); // Bigint has its own implementation. | |
| 18243 int64_t value = AsInt64Value(); | |
| 18244 if (value < 0) { | |
| 18245 return OS::SCreate(zone, "-0x%" PRIX64, static_cast<uint64_t>(-value)); | |
|
zra
2017/08/01 16:21:57
We have some abbreviations for these here:
https:
alexmarkov
2017/08/01 17:40:11
Introduced new short form specifier PX64, see
http
| |
| 18246 } else { | |
| 18247 return OS::SCreate(zone, "0x%" PRIX64, static_cast<uint64_t>(value)); | |
| 18248 } | |
| 18249 } | |
| 18250 | |
| 18241 RawInteger* Integer::ArithmeticOp(Token::Kind operation, | 18251 RawInteger* Integer::ArithmeticOp(Token::Kind operation, |
| 18242 const Integer& other, | 18252 const Integer& other, |
| 18243 Heap::Space space) const { | 18253 Heap::Space space) const { |
| 18244 // In 32-bit mode, the result of any operation between two Smis will fit in a | 18254 // In 32-bit mode, the result of any operation between two Smis will fit in a |
| 18245 // 32-bit signed result, except the product of two Smis, which will be 64-bit. | 18255 // 32-bit signed result, except the product of two Smis, which will be 64-bit. |
| 18246 // In 64-bit mode, the result of any operation between two Smis will fit in a | 18256 // In 64-bit mode, the result of any operation between two Smis will fit in a |
| 18247 // 64-bit signed result, except the product of two Smis (see below). | 18257 // 64-bit signed result, except the product of two Smis (see below). |
| 18248 if (IsSmi() && other.IsSmi()) { | 18258 if (IsSmi() && other.IsSmi()) { |
| 18249 const intptr_t left_value = Smi::Value(Smi::RawCast(raw())); | 18259 const intptr_t left_value = Smi::Value(Smi::RawCast(raw())); |
| 18250 const intptr_t right_value = Smi::Value(Smi::RawCast(other.raw())); | 18260 const intptr_t right_value = Smi::Value(Smi::RawCast(other.raw())); |
| (...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22533 } | 22543 } |
| 22534 return UserTag::null(); | 22544 return UserTag::null(); |
| 22535 } | 22545 } |
| 22536 | 22546 |
| 22537 const char* UserTag::ToCString() const { | 22547 const char* UserTag::ToCString() const { |
| 22538 const String& tag_label = String::Handle(label()); | 22548 const String& tag_label = String::Handle(label()); |
| 22539 return tag_label.ToCString(); | 22549 return tag_label.ToCString(); |
| 22540 } | 22550 } |
| 22541 | 22551 |
| 22542 } // namespace dart | 22552 } // namespace dart |
| OLD | NEW |