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

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

Issue 2992733003: Revert "[vm] Revise Dart_IntegerToHexCString to avoid dependency on Bigint" (Closed)
Patch Set: Created 3 years, 4 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
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | 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 #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 18223 matching lines...) Expand 10 before | Expand all | Expand 10 after
18234 if (Smi::IsValid(value)) { 18234 if (Smi::IsValid(value)) {
18235 // This cast is safe because Smi::IsValid verifies that value will fit. 18235 // This cast is safe because Smi::IsValid verifies that value will fit.
18236 intptr_t val = static_cast<intptr_t>(value); 18236 intptr_t val = static_cast<intptr_t>(value);
18237 return Smi::New(val); 18237 return Smi::New(val);
18238 } 18238 }
18239 return Mint::New(value); 18239 return Mint::New(value);
18240 } 18240 }
18241 return raw(); 18241 return raw();
18242 } 18242 }
18243 18243
18244 const char* Integer::ToHexCString(Zone* zone) const {
18245 ASSERT(IsSmi() || IsMint()); // Bigint has its own implementation.
18246 int64_t value = AsInt64Value();
18247 if (value < 0) {
18248 return OS::SCreate(zone, "-0x%" PRIX64, static_cast<uint64_t>(-value));
18249 } else {
18250 return OS::SCreate(zone, "0x%" PRIX64, static_cast<uint64_t>(value));
18251 }
18252 }
18253
18254 RawInteger* Integer::ArithmeticOp(Token::Kind operation, 18244 RawInteger* Integer::ArithmeticOp(Token::Kind operation,
18255 const Integer& other, 18245 const Integer& other,
18256 Heap::Space space) const { 18246 Heap::Space space) const {
18257 // In 32-bit mode, the result of any operation between two Smis will fit in a 18247 // In 32-bit mode, the result of any operation between two Smis will fit in a
18258 // 32-bit signed result, except the product of two Smis, which will be 64-bit. 18248 // 32-bit signed result, except the product of two Smis, which will be 64-bit.
18259 // In 64-bit mode, the result of any operation between two Smis will fit in a 18249 // In 64-bit mode, the result of any operation between two Smis will fit in a
18260 // 64-bit signed result, except the product of two Smis (see below). 18250 // 64-bit signed result, except the product of two Smis (see below).
18261 if (IsSmi() && other.IsSmi()) { 18251 if (IsSmi() && other.IsSmi()) {
18262 const intptr_t left_value = Smi::Value(Smi::RawCast(raw())); 18252 const intptr_t left_value = Smi::Value(Smi::RawCast(raw()));
18263 const intptr_t right_value = Smi::Value(Smi::RawCast(other.raw())); 18253 const intptr_t right_value = Smi::Value(Smi::RawCast(other.raw()));
(...skipping 4282 matching lines...) Expand 10 before | Expand all | Expand 10 after
22546 } 22536 }
22547 return UserTag::null(); 22537 return UserTag::null();
22548 } 22538 }
22549 22539
22550 const char* UserTag::ToCString() const { 22540 const char* UserTag::ToCString() const {
22551 const String& tag_label = String::Handle(label()); 22541 const String& tag_label = String::Handle(label());
22552 return tag_label.ToCString(); 22542 return tag_label.ToCString();
22553 } 22543 }
22554 22544
22555 } // namespace dart 22545 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698