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

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

Issue 2992013002: [vm] Change TypedData_getUint64 native method to silently cast values (Closed)
Patch Set: Loop test to verify optimized mode too 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') | tests/corelib_2/corelib_2.status » ('j') | 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 18137 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 18161 }
18162 } else { 18162 return Integer::New(static_cast<int64_t>(value), space);
18163 return Bigint::NewFromUint64(value, space); 18163 }
18164 } 18164
18165 bool Integer::IsValidUint64(uint64_t value) {
18166 if (FLAG_limit_ints_to_64_bits) {
18167 return (value <= static_cast<uint64_t>(Mint::kMaxValue));
18165 } else { 18168 } else {
18166 return Integer::New(value, space); 18169 return true;
siva 2017/07/31 21:46:08 why is it not ok to just change this to return
alexmarkov 2017/07/31 23:58:12 Integer::NewFromUint64 is called from 2 places: Da
18167 } 18170 }
18168 } 18171 }
18169 18172
18170 bool Integer::Equals(const Instance& other) const { 18173 bool Integer::Equals(const Instance& other) const {
18171 // Integer is an abstract class. 18174 // Integer is an abstract class.
18172 UNREACHABLE(); 18175 UNREACHABLE();
18173 return false; 18176 return false;
18174 } 18177 }
18175 18178
18176 bool Integer::IsZero() const { 18179 bool Integer::IsZero() const {
(...skipping 4356 matching lines...) Expand 10 before | Expand all | Expand 10 after
22533 } 22536 }
22534 return UserTag::null(); 22537 return UserTag::null();
22535 } 22538 }
22536 22539
22537 const char* UserTag::ToCString() const { 22540 const char* UserTag::ToCString() const {
22538 const String& tag_label = String::Handle(label()); 22541 const String& tag_label = String::Handle(label());
22539 return tag_label.ToCString(); 22542 return tag_label.ToCString();
22540 } 22543 }
22541 22544
22542 } // namespace dart 22545 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | tests/corelib_2/corelib_2.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698