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 17280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
17291 const int64_t right_value = other.AsInt64Value(); | 17291 const int64_t right_value = other.AsInt64Value(); |
17292 switch (operation) { | 17292 switch (operation) { |
17293 case Token::kADD: { | 17293 case Token::kADD: { |
17294 if (((left_value < 0) != (right_value < 0)) || | 17294 if (((left_value < 0) != (right_value < 0)) || |
17295 ((left_value + right_value) < 0) == (left_value < 0)) { | 17295 ((left_value + right_value) < 0) == (left_value < 0)) { |
17296 return Integer::New(left_value + right_value, space); | 17296 return Integer::New(left_value + right_value, space); |
17297 } | 17297 } |
17298 break; | 17298 break; |
17299 } | 17299 } |
17300 case Token::kSUB: { | 17300 case Token::kSUB: { |
17301 if (((left_value < 0) == (right_value < 0)) || | 17301 // TODO(srdjan): Investigate why XCode 7 produces wrong code |
17302 ((left_value - right_value) < 0) == (left_value < 0)) { | 17302 // if the comparison is inlined as in above (Token::kADD). |
| 17303 const bool both_same_sign = (left_value < 0) == (right_value < 0); |
| 17304 const bool result_same_sign_as_left = |
| 17305 ((left_value - right_value) < 0) == (left_value < 0); |
| 17306 if (both_same_sign || result_same_sign_as_left) { |
17303 return Integer::New(left_value - right_value, space); | 17307 return Integer::New(left_value - right_value, space); |
17304 } | 17308 } |
17305 break; | 17309 break; |
17306 } | 17310 } |
17307 case Token::kMUL: { | 17311 case Token::kMUL: { |
17308 if ((Utils::HighestBit(left_value) + | 17312 if ((Utils::HighestBit(left_value) + |
17309 Utils::HighestBit(right_value)) < 62) { | 17313 Utils::HighestBit(right_value)) < 62) { |
17310 return Integer::New(left_value * right_value, space); | 17314 return Integer::New(left_value * right_value, space); |
17311 } | 17315 } |
17312 break; | 17316 break; |
(...skipping 4600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21913 return tag_label.ToCString(); | 21917 return tag_label.ToCString(); |
21914 } | 21918 } |
21915 | 21919 |
21916 | 21920 |
21917 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 21921 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
21918 Instance::PrintJSONImpl(stream, ref); | 21922 Instance::PrintJSONImpl(stream, ref); |
21919 } | 21923 } |
21920 | 21924 |
21921 | 21925 |
21922 } // namespace dart | 21926 } // namespace dart |
OLD | NEW |