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

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

Issue 2974633003: Option to truncate integers to 64 bits, part 1 (core VM changes) (Closed)
Patch Set: Created 3 years, 5 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 case Token::kDIV: 1811 case Token::kDIV:
1812 break; 1812 break;
1813 default: 1813 default:
1814 UNREACHABLE(); 1814 UNREACHABLE();
1815 } 1815 }
1816 1816
1817 if (!result.IsNull()) { 1817 if (!result.IsNull()) {
1818 if (is_truncating()) { 1818 if (is_truncating()) {
1819 int64_t truncated = result.AsTruncatedInt64Value(); 1819 int64_t truncated = result.AsTruncatedInt64Value();
1820 truncated &= RepresentationMask(representation()); 1820 truncated &= RepresentationMask(representation());
1821 result = Integer::New(truncated); 1821 result = Integer::New(truncated, Heap::kOld);
1822 ASSERT(IsRepresentable(result, representation())); 1822 ASSERT(IsRepresentable(result, representation()));
1823 } else if (!IsRepresentable(result, representation())) { 1823 } else if (!IsRepresentable(result, representation())) {
1824 // If this operation is not truncating it would deoptimize on overflow. 1824 // If this operation is not truncating it would deoptimize on overflow.
1825 // Check that we match this behavior and don't produce a value that is 1825 // Check that we match this behavior and don't produce a value that is
1826 // larger than something this operation can produce. We could have 1826 // larger than something this operation can produce. We could have
1827 // specialized instructions that use this value under this assumption. 1827 // specialized instructions that use this value under this assumption.
1828 return Integer::null(); 1828 return Integer::null();
1829 } 1829 }
1830 result ^= result.CheckAndCanonicalize(thread, NULL); 1830 result ^= result.CheckAndCanonicalize(thread, NULL);
1831 } 1831 }
(...skipping 2569 matching lines...) Expand 10 before | Expand all | Expand 10 after
4401 "native function '%s' (%" Pd " arguments) cannot be found", 4401 "native function '%s' (%" Pd " arguments) cannot be found",
4402 native_name().ToCString(), function().NumParameters()); 4402 native_name().ToCString(), function().NumParameters());
4403 } 4403 }
4404 set_is_auto_scope(auto_setup_scope); 4404 set_is_auto_scope(auto_setup_scope);
4405 set_native_c_function(native_function); 4405 set_native_c_function(native_function);
4406 } 4406 }
4407 4407
4408 #undef __ 4408 #undef __
4409 4409
4410 } // namespace dart 4410 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698