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

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

Issue 14962008: Fix issue 5275: The VM must always generate the most compact form of an integer (Smi, Mint or Bigin… (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 10572 matching lines...) Expand 10 before | Expand all | Expand 10 after
10583 switch (kind) { 10583 switch (kind) {
10584 case Token::kSHL: { 10584 case Token::kSHL: {
10585 if ((left_value == 0) || (right_value == 0)) { 10585 if ((left_value == 0) || (right_value == 0)) {
10586 return raw(); 10586 return raw();
10587 } 10587 }
10588 { // Check for overflow. 10588 { // Check for overflow.
10589 int cnt = Utils::HighestBit(left_value); 10589 int cnt = Utils::HighestBit(left_value);
10590 if ((cnt + right_value) >= Smi::kBits) { 10590 if ((cnt + right_value) >= Smi::kBits) {
10591 if ((cnt + right_value) >= Mint::kBits) { 10591 if ((cnt + right_value) >= Mint::kBits) {
10592 return BigintOperations::ShiftLeft( 10592 return BigintOperations::ShiftLeft(
10593 Bigint::Handle(AsBigint()), right_value); 10593 Bigint::Handle(BigintOperations::NewFromSmi(*this)),
10594 right_value);
10594 } else { 10595 } else {
10595 int64_t left_64 = left_value; 10596 int64_t left_64 = left_value;
10596 return Integer::New(left_64 << right_value); 10597 return Integer::New(left_64 << right_value);
10597 } 10598 }
10598 } 10599 }
10599 } 10600 }
10600 result = left_value << right_value; 10601 result = left_value << right_value;
10601 break; 10602 break;
10602 } 10603 }
10603 case Token::kSHR: { 10604 case Token::kSHR: {
(...skipping 2651 matching lines...) Expand 10 before | Expand all | Expand 10 after
13255 } 13256 }
13256 return result.raw(); 13257 return result.raw();
13257 } 13258 }
13258 13259
13259 13260
13260 const char* WeakProperty::ToCString() const { 13261 const char* WeakProperty::ToCString() const {
13261 return "_WeakProperty"; 13262 return "_WeakProperty";
13262 } 13263 }
13263 13264
13264 } // namespace dart 13265 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/object_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698