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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
283 // Overflow in shift, use Bigints | 283 // Overflow in shift, use Bigints |
284 return Integer::null(); | 284 return Integer::null(); |
285 } | 285 } |
286 } else { | 286 } else { |
287 ASSERT(value.IsBigint()); | 287 ASSERT(value.IsBigint()); |
288 } | 288 } |
289 return Integer::null(); | 289 return Integer::null(); |
290 } | 290 } |
291 | 291 |
292 | 292 |
293 DEFINE_NATIVE_ENTRY(Smi_bitAndFromSmi, 2) { | |
294 const Smi& left = Smi::CheckedHandle(arguments->NativeArgAt(0)); | |
295 GET_NON_NULL_NATIVE_ARGUMENT(Smi, right, arguments->NativeArgAt(1)); | |
296 if (FLAG_trace_intrinsified_natives) { | |
297 OS::Print("Smi_bitAndFromSmi %s & %s\n", | |
298 left.ToCString(), right.ToCString()); | |
srdjan
2016/04/29 17:35:31
Please use THR_Print instead
| |
299 } | |
300 const Smi& left_value = Smi::Cast(left); | |
301 const Smi& right_value = Smi::Cast(right); | |
302 return Smi::New(left_value.Value() & right_value.Value()); | |
303 } | |
304 | |
305 | |
293 DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { | 306 DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { |
294 const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); | 307 const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); |
295 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); | 308 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); |
296 ASSERT(CheckInteger(amount)); | 309 ASSERT(CheckInteger(amount)); |
297 ASSERT(CheckInteger(value)); | 310 ASSERT(CheckInteger(value)); |
298 const Integer& result = Integer::Handle( | 311 const Integer& result = Integer::Handle( |
299 ShiftOperationHelper(Token::kSHR, value, amount)); | 312 ShiftOperationHelper(Token::kSHR, value, amount)); |
300 // A null result indicates that a bigint operation is required. | 313 // A null result indicates that a bigint operation is required. |
301 return result.IsNull() ? result.raw() : result.AsValidInteger(); | 314 return result.IsNull() ? result.raw() : result.AsValidInteger(); |
302 } | 315 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { | 415 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
403 // First arg is null type arguments, since class Bigint is not parameterized. | 416 // First arg is null type arguments, since class Bigint is not parameterized. |
404 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | 417 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
405 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); | 418 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
406 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); | 419 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
407 ASSERT(!digits.IsNull()); | 420 ASSERT(!digits.IsNull()); |
408 return Bigint::New(neg.value(), used.Value(), digits); | 421 return Bigint::New(neg.value(), used.Value(), digits); |
409 } | 422 } |
410 | 423 |
411 } // namespace dart | 424 } // namespace dart |
OLD | NEW |