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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "vm/dart_entry.h" | 8 #include "vm/dart_entry.h" |
9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 Integer::Handle(left_int.ArithmeticOp(Token::kTRUNCDIV, right_int)); | 139 Integer::Handle(left_int.ArithmeticOp(Token::kTRUNCDIV, right_int)); |
140 // A null result indicates that a bigint operation is required. | 140 // A null result indicates that a bigint operation is required. |
141 return result.IsNull() ? result.raw() : result.AsValidInteger(); | 141 return result.IsNull() ? result.raw() : result.AsValidInteger(); |
142 } | 142 } |
143 | 143 |
144 | 144 |
145 DEFINE_NATIVE_ENTRY(Integer_moduloFromInteger, 2) { | 145 DEFINE_NATIVE_ENTRY(Integer_moduloFromInteger, 2) { |
146 const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); | 146 const Integer& right_int = Integer::CheckedHandle(arguments->NativeArgAt(0)); |
147 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); | 147 GET_NON_NULL_NATIVE_ARGUMENT(Integer, left_int, arguments->NativeArgAt(1)); |
148 ASSERT(CheckInteger(right_int)); | 148 ASSERT(CheckInteger(right_int)); |
149 ASSERT(CheckInteger(right_int)); | 149 ASSERT(CheckInteger(left_int)); |
150 if (FLAG_trace_intrinsified_natives) { | 150 if (FLAG_trace_intrinsified_natives) { |
151 OS::Print("Integer_moduloFromInteger %s mod %s\n", | 151 OS::Print("Integer_moduloFromInteger %s mod %s\n", |
152 left_int.ToCString(), right_int.ToCString()); | 152 left_int.ToCString(), right_int.ToCString()); |
153 } | 153 } |
154 if (right_int.IsZero()) { | 154 if (right_int.IsZero()) { |
155 // Should have been caught before calling into runtime. | 155 // Should have been caught before calling into runtime. |
156 UNIMPLEMENTED(); | 156 UNIMPLEMENTED(); |
157 } | 157 } |
158 const Integer& result = | 158 const Integer& result = |
159 Integer::Handle(left_int.ArithmeticOp(Token::kMOD, right_int)); | 159 Integer::Handle(left_int.ArithmeticOp(Token::kMOD, right_int)); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { | 397 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
398 // First arg is null type arguments, since class Bigint is not parameterized. | 398 // First arg is null type arguments, since class Bigint is not parameterized. |
399 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | 399 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
400 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); | 400 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
401 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); | 401 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
402 ASSERT(!digits.IsNull()); | 402 ASSERT(!digits.IsNull()); |
403 return Bigint::New(neg.value(), used.Value(), digits); | 403 return Bigint::New(neg.value(), used.Value(), digits); |
404 } | 404 } |
405 | 405 |
406 } // namespace dart | 406 } // namespace dart |
OLD | NEW |