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/bootstrap_natives.h" | 5 #include "vm/bootstrap_natives.h" |
6 | 6 |
7 #include "vm/bigint_operations.h" | 7 #include "vm/bigint_operations.h" |
8 #include "vm/exceptions.h" | 8 #include "vm/exceptions.h" |
9 #include "vm/native_entry.h" | 9 #include "vm/native_entry.h" |
10 #include "vm/object.h" | 10 #include "vm/object.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 RangeCheck(array, index.Value(), sizeof(uint64_t)); \ | 111 RangeCheck(array, index.Value(), sizeof(uint64_t)); \ |
112 uint64_t value; \ | 112 uint64_t value; \ |
113 ByteArray::Copy(&value, array, index.Value(), sizeof(uint64_t)); \ | 113 ByteArray::Copy(&value, array, index.Value(), sizeof(uint64_t)); \ |
114 Integer& result = Integer::Handle(); \ | 114 Integer& result = Integer::Handle(); \ |
115 UINT64_TO_INTEGER(value, result); \ | 115 UINT64_TO_INTEGER(value, result); \ |
116 return result.raw(); | 116 return result.raw(); |
117 | 117 |
118 | 118 |
119 #define INTEGER_TO_UINT64(integer, uint64) \ | 119 #define INTEGER_TO_UINT64(integer, uint64) \ |
120 if (integer.IsBigint()) { \ | 120 if (integer.IsBigint()) { \ |
121 Bigint& bigint = Bigint::Handle(); \ | 121 const Bigint& bigint = Bigint::Cast(integer); \ |
122 bigint |= integer.raw(); \ | |
123 ASSERT(BigintOperations::FitsIntoUint64(bigint)); \ | 122 ASSERT(BigintOperations::FitsIntoUint64(bigint)); \ |
124 value = BigintOperations::AbsToUint64(bigint); \ | 123 value = BigintOperations::AbsToUint64(bigint); \ |
125 } else { \ | 124 } else { \ |
126 ASSERT(integer.IsMint() || integer.IsSmi()); \ | 125 ASSERT(integer.IsMint() || integer.IsSmi()); \ |
127 value = integer.AsInt64Value(); \ | 126 value = integer.AsInt64Value(); \ |
128 } \ | 127 } \ |
129 | 128 |
130 | 129 |
131 #define SETTER_UINT64(ArrayT) \ | 130 #define SETTER_UINT64(ArrayT) \ |
132 SETTER_ARGUMENTS(ArrayT, Integer, uint64_t); \ | 131 SETTER_ARGUMENTS(ArrayT, Integer, uint64_t); \ |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { | 774 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_getIndexed, 2) { |
776 GETTER(ExternalFloat64Array, Double, double); | 775 GETTER(ExternalFloat64Array, Double, double); |
777 } | 776 } |
778 | 777 |
779 | 778 |
780 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { | 779 DEFINE_NATIVE_ENTRY(ExternalFloat64Array_setIndexed, 3) { |
781 SETTER(ExternalFloat64Array, Double, value, double); | 780 SETTER(ExternalFloat64Array, Double, value, double); |
782 } | 781 } |
783 | 782 |
784 } // namespace dart | 783 } // namespace dart |
OLD | NEW |