| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 15885 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15896 intptr_t result = 0; | 15896 intptr_t result = 0; |
| 15897 const intptr_t left_value = Value(); | 15897 const intptr_t left_value = Value(); |
| 15898 const intptr_t right_value = other.Value(); | 15898 const intptr_t right_value = other.Value(); |
| 15899 ASSERT(right_value >= 0); | 15899 ASSERT(right_value >= 0); |
| 15900 switch (kind) { | 15900 switch (kind) { |
| 15901 case Token::kSHL: { | 15901 case Token::kSHL: { |
| 15902 if ((left_value == 0) || (right_value == 0)) { | 15902 if ((left_value == 0) || (right_value == 0)) { |
| 15903 return raw(); | 15903 return raw(); |
| 15904 } | 15904 } |
| 15905 { // Check for overflow. | 15905 { // Check for overflow. |
| 15906 int cnt = Utils::HighestBit(left_value); | 15906 int cnt = Utils::BitLength(left_value); |
| 15907 if ((cnt + right_value) >= Smi::kBits) { | 15907 if ((cnt + right_value) > Smi::kBits) { |
| 15908 if ((cnt + right_value) >= Mint::kBits) { | 15908 if ((cnt + right_value) > Mint::kBits) { |
| 15909 return Bigint::NewFromShiftedInt64(left_value, right_value); | 15909 return Bigint::NewFromShiftedInt64(left_value, right_value); |
| 15910 } else { | 15910 } else { |
| 15911 int64_t left_64 = left_value; | 15911 int64_t left_64 = left_value; |
| 15912 return Integer::New(left_64 << right_value, Heap::kNew, silent); | 15912 return Integer::New(left_64 << right_value, Heap::kNew, silent); |
| 15913 } | 15913 } |
| 15914 } | 15914 } |
| 15915 } | 15915 } |
| 15916 result = left_value << right_value; | 15916 result = left_value << right_value; |
| 15917 break; | 15917 break; |
| 15918 } | 15918 } |
| (...skipping 4497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20416 return tag_label.ToCString(); | 20416 return tag_label.ToCString(); |
| 20417 } | 20417 } |
| 20418 | 20418 |
| 20419 | 20419 |
| 20420 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20420 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20421 Instance::PrintJSONImpl(stream, ref); | 20421 Instance::PrintJSONImpl(stream, ref); |
| 20422 } | 20422 } |
| 20423 | 20423 |
| 20424 | 20424 |
| 20425 } // namespace dart | 20425 } // namespace dart |
| OLD | NEW |