| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/runtime_entry.h" | 5 #include "vm/runtime_entry.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 #include "vm/verifier.h" | 8 #include "vm/verifier.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // Result: a smi representing arg0 - arg1. | 34 // Result: a smi representing arg0 - arg1. |
| 35 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) { | 35 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) { |
| 36 ASSERT(arguments.Count() == kTestSmiSubRuntimeEntry.argument_count()); | 36 ASSERT(arguments.Count() == kTestSmiSubRuntimeEntry.argument_count()); |
| 37 const Smi& left = Smi::CheckedHandle(arguments.At(0)); | 37 const Smi& left = Smi::CheckedHandle(arguments.At(0)); |
| 38 const Smi& right = Smi::CheckedHandle(arguments.At(1)); | 38 const Smi& right = Smi::CheckedHandle(arguments.At(1)); |
| 39 // Ignoring overflow in the calculation below. | 39 // Ignoring overflow in the calculation below. |
| 40 intptr_t result = left.Value() - right.Value(); | 40 intptr_t result = left.Value() - right.Value(); |
| 41 arguments.SetReturn(Smi::Handle(Smi::New(result))); | 41 arguments.SetReturn(Smi::Handle(Smi::New(result))); |
| 42 } | 42 } |
| 43 | 43 |
| 44 |
| 45 // A leaf runtime call for test purposes. |
| 46 // Arg0: a smi. |
| 47 // Arg1: a smi. |
| 48 // returns a smi representing arg0 + arg1. |
| 49 DEFINE_LEAF_RUNTIME_ENTRY(TestLeafSmiAdd, 2) { |
| 50 ASSERT(args.Count() == kTestLeafSmiAddRuntimeEntry.argument_count()); |
| 51 // Ignoring overflow in the calculation below. |
| 52 intptr_t result = Smi::Value(reinterpret_cast<RawSmi*>(args.At(0))) + |
| 53 Smi::Value(reinterpret_cast<RawSmi*>(args.At(1))); |
| 54 return Smi::New(result); |
| 55 } |
| 56 |
| 44 } // namespace dart | 57 } // namespace dart |
| OLD | NEW |