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