| 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/dart_entry.h" | 8 #include "vm/dart_entry.h" |
| 9 #include "vm/exceptions.h" | 9 #include "vm/exceptions.h" |
| 10 #include "vm/native_entry.h" | 10 #include "vm/native_entry.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) { | 297 DEFINE_NATIVE_ENTRY(Smi_bitNegate, 1) { |
| 298 const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0)); | 298 const Smi& operand = Smi::CheckedHandle(arguments->NativeArgAt(0)); |
| 299 if (FLAG_trace_intrinsified_natives) { | 299 if (FLAG_trace_intrinsified_natives) { |
| 300 OS::Print("Smi_bitNegate: %s\n", operand.ToCString()); | 300 OS::Print("Smi_bitNegate: %s\n", operand.ToCString()); |
| 301 } | 301 } |
| 302 intptr_t result = ~operand.Value(); | 302 intptr_t result = ~operand.Value(); |
| 303 ASSERT(Smi::IsValid(result)); | 303 ASSERT(Smi::IsValid(result)); |
| 304 return Smi::New(result); | 304 return Smi::New(result); |
| 305 } | 305 } |
| 306 | 306 |
| 307 |
| 307 // Mint natives. | 308 // Mint natives. |
| 308 | 309 |
| 309 DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) { | 310 DEFINE_NATIVE_ENTRY(Mint_bitNegate, 1) { |
| 310 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0)); | 311 const Mint& operand = Mint::CheckedHandle(arguments->NativeArgAt(0)); |
| 311 ASSERT(CheckInteger(operand)); | 312 ASSERT(CheckInteger(operand)); |
| 312 if (FLAG_trace_intrinsified_natives) { | 313 if (FLAG_trace_intrinsified_natives) { |
| 313 OS::Print("Mint_bitNegate: %s\n", operand.ToCString()); | 314 OS::Print("Mint_bitNegate: %s\n", operand.ToCString()); |
| 314 } | 315 } |
| 315 int64_t result = ~operand.value(); | 316 int64_t result = ~operand.value(); |
| 316 return Integer::New(result); | 317 return Integer::New(result); |
| 317 } | 318 } |
| 318 | 319 |
| 320 |
| 319 // Bigint natives. | 321 // Bigint natives. |
| 320 | 322 |
| 321 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { | 323 DEFINE_NATIVE_ENTRY(Bigint_bitNegate, 1) { |
| 322 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0)); | 324 const Bigint& value = Bigint::CheckedHandle(arguments->NativeArgAt(0)); |
| 323 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); | 325 const Bigint& result = Bigint::Handle(BigintOperations::BitNot(value)); |
| 324 ASSERT(CheckInteger(value)); | 326 ASSERT(CheckInteger(value)); |
| 325 ASSERT(CheckInteger(result)); | 327 ASSERT(CheckInteger(result)); |
| 326 return result.AsValidInteger(); | 328 return result.AsValidInteger(); |
| 327 } | 329 } |
| 328 | 330 |
| 329 } // namespace dart | 331 } // namespace dart |
| OLD | NEW |