| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 // Overflow in shift, use Bigints | 278 // Overflow in shift, use Bigints |
| 279 return Integer::null(); | 279 return Integer::null(); |
| 280 } | 280 } |
| 281 } else { | 281 } else { |
| 282 ASSERT(value.IsBigint()); | 282 ASSERT(value.IsBigint()); |
| 283 } | 283 } |
| 284 return Integer::null(); | 284 return Integer::null(); |
| 285 } | 285 } |
| 286 | 286 |
| 287 | 287 |
| 288 DEFINE_NATIVE_ENTRY(Smi_bitAndFromSmi, 2) { |
| 289 const Smi& left = Smi::CheckedHandle(arguments->NativeArgAt(0)); |
| 290 GET_NON_NULL_NATIVE_ARGUMENT(Smi, right, arguments->NativeArgAt(1)); |
| 291 if (FLAG_trace_intrinsified_natives) { |
| 292 OS::Print("Smi_bitAndFromSmi %s & %s\n", |
| 293 left.ToCString(), right.ToCString()); |
| 294 } |
| 295 const Smi& left_value = Smi::Cast(left); |
| 296 const Smi& right_value = Smi::Cast(right); |
| 297 return Smi::New(left_value.Value() & right_value.Value()); |
| 298 } |
| 299 |
| 300 |
| 288 DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { | 301 DEFINE_NATIVE_ENTRY(Smi_shrFromInt, 2) { |
| 289 const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); | 302 const Smi& amount = Smi::CheckedHandle(arguments->NativeArgAt(0)); |
| 290 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); | 303 GET_NON_NULL_NATIVE_ARGUMENT(Integer, value, arguments->NativeArgAt(1)); |
| 291 ASSERT(CheckInteger(amount)); | 304 ASSERT(CheckInteger(amount)); |
| 292 ASSERT(CheckInteger(value)); | 305 ASSERT(CheckInteger(value)); |
| 293 const Integer& result = Integer::Handle( | 306 const Integer& result = Integer::Handle( |
| 294 ShiftOperationHelper(Token::kSHR, value, amount)); | 307 ShiftOperationHelper(Token::kSHR, value, amount)); |
| 295 // A null result indicates that a bigint operation is required. | 308 // A null result indicates that a bigint operation is required. |
| 296 return result.IsNull() ? result.raw() : result.AsValidInteger(); | 309 return result.IsNull() ? result.raw() : result.AsValidInteger(); |
| 297 } | 310 } |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { | 410 DEFINE_NATIVE_ENTRY(Bigint_allocate, 4) { |
| 398 // First arg is null type arguments, since class Bigint is not parameterized. | 411 // First arg is null type arguments, since class Bigint is not parameterized. |
| 399 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); | 412 const Bool& neg = Bool::CheckedHandle(arguments->NativeArgAt(1)); |
| 400 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); | 413 const Smi& used = Smi::CheckedHandle(arguments->NativeArgAt(2)); |
| 401 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); | 414 const TypedData& digits = TypedData::CheckedHandle(arguments->NativeArgAt(3)); |
| 402 ASSERT(!digits.IsNull()); | 415 ASSERT(!digits.IsNull()); |
| 403 return Bigint::New(neg.value(), used.Value(), digits); | 416 return Bigint::New(neg.value(), used.Value(), digits); |
| 404 } | 417 } |
| 405 | 418 |
| 406 } // namespace dart | 419 } // namespace dart |
| OLD | NEW |