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

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

Issue 15743017: Adds a flag to the standalone vm to throw an exception on 53-bit integer overflow. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 10380 matching lines...) Expand 10 before | Expand all | Expand 10 after
10391 return 0.0; 10391 return 0.0;
10392 } 10392 }
10393 10393
10394 10394
10395 int64_t Integer::AsInt64Value() const { 10395 int64_t Integer::AsInt64Value() const {
10396 UNIMPLEMENTED(); 10396 UNIMPLEMENTED();
10397 return 0; 10397 return 0;
10398 } 10398 }
10399 10399
10400 10400
10401 bool Integer::FitsIn53Bits() const {
10402 UNIMPLEMENTED();
10403 return false;
10404 }
10405
10406
10401 int Integer::CompareWith(const Integer& other) const { 10407 int Integer::CompareWith(const Integer& other) const {
10402 UNIMPLEMENTED(); 10408 UNIMPLEMENTED();
10403 return 0; 10409 return 0;
10404 } 10410 }
10405 10411
10406 10412
10407 RawInteger* Integer::AsValidInteger() const { 10413 RawInteger* Integer::AsValidInteger() const {
10408 if (IsSmi()) return raw(); 10414 if (IsSmi()) return raw();
10409 if (IsMint()) { 10415 if (IsMint()) {
10410 Mint& mint = Mint::Handle(); 10416 Mint& mint = Mint::Handle();
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
10765 double Mint::AsDoubleValue() const { 10771 double Mint::AsDoubleValue() const {
10766 return static_cast<double>(this->value()); 10772 return static_cast<double>(this->value());
10767 } 10773 }
10768 10774
10769 10775
10770 int64_t Mint::AsInt64Value() const { 10776 int64_t Mint::AsInt64Value() const {
10771 return this->value(); 10777 return this->value();
10772 } 10778 }
10773 10779
10774 10780
10781 bool Mint::FitsIn53Bits() const {
10782 int64_t v = AsInt64Value();
10783 return Utils::IsInt(53, v);
10784 }
10785
10786
10775 int Mint::CompareWith(const Integer& other) const { 10787 int Mint::CompareWith(const Integer& other) const {
10776 ASSERT(!FitsIntoSmi(*this)); 10788 ASSERT(!FitsIntoSmi(*this));
10777 if (other.IsMint() || other.IsSmi()) { 10789 if (other.IsMint() || other.IsSmi()) {
10778 int64_t a = AsInt64Value(); 10790 int64_t a = AsInt64Value();
10779 int64_t b = other.AsInt64Value(); 10791 int64_t b = other.AsInt64Value();
10780 if (a < b) { 10792 if (a < b) {
10781 return -1; 10793 return -1;
10782 } else if (a > b) { 10794 } else if (a > b) {
10783 return 1; 10795 return 1;
10784 } else { 10796 } else {
(...skipping 2482 matching lines...) Expand 10 before | Expand all | Expand 10 after
13267 } 13279 }
13268 return result.raw(); 13280 return result.raw();
13269 } 13281 }
13270 13282
13271 13283
13272 const char* WeakProperty::ToCString() const { 13284 const char* WeakProperty::ToCString() const {
13273 return "_WeakProperty"; 13285 return "_WeakProperty";
13274 } 13286 }
13275 13287
13276 } // namespace dart 13288 } // namespace dart
OLDNEW
« runtime/lib/typed_data.cc ('K') | « runtime/vm/object.h ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698