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 18137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18148 | 18148 |
| 18149 RawInteger* Integer::New(int64_t value, Heap::Space space) { | 18149 RawInteger* Integer::New(int64_t value, Heap::Space space) { |
| 18150 const bool is_smi = Smi::IsValid(value); | 18150 const bool is_smi = Smi::IsValid(value); |
| 18151 if (is_smi) { | 18151 if (is_smi) { |
| 18152 return Smi::New(static_cast<intptr_t>(value)); | 18152 return Smi::New(static_cast<intptr_t>(value)); |
| 18153 } | 18153 } |
| 18154 return Mint::New(value, space); | 18154 return Mint::New(value, space); |
| 18155 } | 18155 } |
| 18156 | 18156 |
| 18157 RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { | 18157 RawInteger* Integer::NewFromUint64(uint64_t value, Heap::Space space) { |
| 18158 if (value > static_cast<uint64_t>(Mint::kMaxValue)) { | 18158 if (!FLAG_limit_ints_to_64_bits && |
| 18159 if (FLAG_limit_ints_to_64_bits) { | 18159 (value > static_cast<uint64_t>(Mint::kMaxValue))) { |
| 18160 // Out of range. | 18160 return Bigint::NewFromUint64(value, space); |
| 18161 return Integer::null(); | |
| 18162 } else { | |
| 18163 return Bigint::NewFromUint64(value, space); | |
| 18164 } | |
| 18165 } else { | 18161 } else { |
|
zra
2017/07/28 21:47:46
The else is unnecessary.
alexmarkov
2017/07/28 23:09:29
Done.
| |
| 18166 return Integer::New(value, space); | 18162 return Integer::New(static_cast<int64_t>(value), space); |
| 18167 } | 18163 } |
| 18168 } | 18164 } |
| 18169 | 18165 |
| 18166 bool Integer::IsValidUint64(uint64_t value) { | |
| 18167 if (FLAG_limit_ints_to_64_bits) { | |
| 18168 return (value <= static_cast<uint64_t>(Mint::kMaxValue)); | |
| 18169 } else { | |
|
zra
2017/07/28 21:47:46
ditto
alexmarkov
2017/07/28 23:09:29
In this particular case I think 'else' adds readab
| |
| 18170 return true; | |
| 18171 } | |
| 18172 } | |
| 18173 | |
| 18170 bool Integer::Equals(const Instance& other) const { | 18174 bool Integer::Equals(const Instance& other) const { |
| 18171 // Integer is an abstract class. | 18175 // Integer is an abstract class. |
| 18172 UNREACHABLE(); | 18176 UNREACHABLE(); |
| 18173 return false; | 18177 return false; |
| 18174 } | 18178 } |
| 18175 | 18179 |
| 18176 bool Integer::IsZero() const { | 18180 bool Integer::IsZero() const { |
| 18177 // Integer is an abstract class. | 18181 // Integer is an abstract class. |
| 18178 UNREACHABLE(); | 18182 UNREACHABLE(); |
| 18179 return false; | 18183 return false; |
| (...skipping 4353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 22533 } | 22537 } |
| 22534 return UserTag::null(); | 22538 return UserTag::null(); |
| 22535 } | 22539 } |
| 22536 | 22540 |
| 22537 const char* UserTag::ToCString() const { | 22541 const char* UserTag::ToCString() const { |
| 22538 const String& tag_label = String::Handle(label()); | 22542 const String& tag_label = String::Handle(label()); |
| 22539 return tag_label.ToCString(); | 22543 return tag_label.ToCString(); |
| 22540 } | 22544 } |
| 22541 | 22545 |
| 22542 } // namespace dart | 22546 } // namespace dart |
| OLD | NEW |