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

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

Issue 1644223006: Fix some more shorten-64-to-32 warnings: (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments. Created 4 years, 10 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') | runtime/vm/profiler.h » ('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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 17976 matching lines...) Expand 10 before | Expand all | Expand 10 after
17987 return Smi::New(static_cast<intptr_t>(value)); 17987 return Smi::New(static_cast<intptr_t>(value));
17988 } 17988 }
17989 return Mint::NewCanonical(value); 17989 return Mint::NewCanonical(value);
17990 } 17990 }
17991 17991
17992 17992
17993 RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) { 17993 RawInteger* Integer::New(int64_t value, Heap::Space space, const bool silent) {
17994 const bool is_smi = Smi::IsValid(value); 17994 const bool is_smi = Smi::IsValid(value);
17995 if (!silent && 17995 if (!silent &&
17996 FLAG_throw_on_javascript_int_overflow && 17996 FLAG_throw_on_javascript_int_overflow &&
17997 !Utils::IsJavascriptInt64(value)) { 17997 !Utils::IsJavascriptInt(value)) {
17998 const Integer& i = is_smi ? 17998 const Integer& i = is_smi ?
17999 Integer::Handle(Smi::New(static_cast<intptr_t>(value))) : 17999 Integer::Handle(Smi::New(static_cast<intptr_t>(value))) :
18000 Integer::Handle(Mint::New(value, space)); 18000 Integer::Handle(Mint::New(value, space));
18001 ThrowJavascriptIntegerOverflow(i); 18001 ThrowJavascriptIntegerOverflow(i);
18002 } 18002 }
18003 if (is_smi) { 18003 if (is_smi) {
18004 return Smi::New(static_cast<intptr_t>(value)); 18004 return Smi::New(static_cast<intptr_t>(value));
18005 } 18005 }
18006 return Mint::New(value, space); 18006 return Mint::New(value, space);
18007 } 18007 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
18085 value = AsInt64Value(); 18085 value = AsInt64Value();
18086 } else if (IsMint()) { 18086 } else if (IsMint()) {
18087 Mint& mint = Mint::Handle(); 18087 Mint& mint = Mint::Handle();
18088 mint ^= raw(); 18088 mint ^= raw();
18089 value = mint.value(); 18089 value = mint.value();
18090 } else { 18090 } else {
18091 if (Bigint::Cast(*this).FitsIntoInt64()) { 18091 if (Bigint::Cast(*this).FitsIntoInt64()) {
18092 value = AsInt64Value(); 18092 value = AsInt64Value();
18093 } 18093 }
18094 } 18094 }
18095 return !Utils::IsJavascriptInt64(value); 18095 return !Utils::IsJavascriptInt(value);
18096 } 18096 }
18097 18097
18098 18098
18099 RawInteger* Integer::AsValidInteger() const { 18099 RawInteger* Integer::AsValidInteger() const {
18100 if (FLAG_throw_on_javascript_int_overflow && 18100 if (FLAG_throw_on_javascript_int_overflow &&
18101 CheckJavascriptIntegerOverflow()) { 18101 CheckJavascriptIntegerOverflow()) {
18102 ThrowJavascriptIntegerOverflow(*this); 18102 ThrowJavascriptIntegerOverflow(*this);
18103 } 18103 }
18104 if (IsSmi()) return raw(); 18104 if (IsSmi()) return raw();
18105 if (IsMint()) { 18105 if (IsMint()) {
18106 Mint& mint = Mint::Handle(); 18106 Mint& mint = Mint::Handle();
18107 mint ^= raw(); 18107 mint ^= raw();
18108 if (Smi::IsValid(mint.value())) { 18108 if (Smi::IsValid(mint.value())) {
18109 return Smi::New(static_cast<intptr_t>(mint.value())); 18109 return Smi::New(static_cast<intptr_t>(mint.value()));
18110 } else { 18110 } else {
18111 return raw(); 18111 return raw();
18112 } 18112 }
18113 } 18113 }
18114 if (Bigint::Cast(*this).FitsIntoInt64()) { 18114 if (Bigint::Cast(*this).FitsIntoInt64()) {
18115 const int64_t value = AsInt64Value(); 18115 const int64_t value = AsInt64Value();
18116 if (Smi::IsValid(value)) { 18116 if (Smi::IsValid(value)) {
18117 return Smi::New(value); 18117 // This cast is safe because Smi::IsValid verifies that value will fit.
18118 intptr_t val = static_cast<intptr_t>(value);
18119 return Smi::New(val);
18118 } 18120 }
18119 return Mint::New(value); 18121 return Mint::New(value);
18120 } 18122 }
18121 return raw(); 18123 return raw();
18122 } 18124 }
18123 18125
18124 18126
18125 RawInteger* Integer::ArithmeticOp(Token::Kind operation, 18127 RawInteger* Integer::ArithmeticOp(Token::Kind operation,
18126 const Integer& other, 18128 const Integer& other,
18127 Heap::Space space) const { 18129 Heap::Space space) const {
(...skipping 4735 matching lines...) Expand 10 before | Expand all | Expand 10 after
22863 return tag_label.ToCString(); 22865 return tag_label.ToCString();
22864 } 22866 }
22865 22867
22866 22868
22867 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 22869 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
22868 Instance::PrintJSONImpl(stream, ref); 22870 Instance::PrintJSONImpl(stream, ref);
22869 } 22871 }
22870 22872
22871 22873
22872 } // namespace dart 22874 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698