Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(524)

Side by Side Diff: runtime/vm/runtime_entry_test.cc

Issue 23621008: Move the assertion checking the number of arguments passed to a runtime entry (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/runtime_entry.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/symbols.h" 8 #include "vm/symbols.h"
9 #include "vm/verifier.h" 9 #include "vm/verifier.h"
10 10
(...skipping 18 matching lines...) Expand all
29 function.SetCode(code); 29 function.SetCode(code);
30 return function; 30 return function;
31 } 31 }
32 32
33 33
34 // A runtime call for test purposes. 34 // A runtime call for test purposes.
35 // Arg0: a smi. 35 // Arg0: a smi.
36 // Arg1: a smi. 36 // Arg1: a smi.
37 // Result: a smi representing arg0 - arg1. 37 // Result: a smi representing arg0 - arg1.
38 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) { 38 DEFINE_RUNTIME_ENTRY(TestSmiSub, 2) {
39 ASSERT(arguments.ArgCount() == kTestSmiSubRuntimeEntry.argument_count());
40 const Smi& left = Smi::CheckedHandle(arguments.ArgAt(0)); 39 const Smi& left = Smi::CheckedHandle(arguments.ArgAt(0));
41 const Smi& right = Smi::CheckedHandle(arguments.ArgAt(1)); 40 const Smi& right = Smi::CheckedHandle(arguments.ArgAt(1));
42 // Ignoring overflow in the calculation below. 41 // Ignoring overflow in the calculation below.
43 intptr_t result = left.Value() - right.Value(); 42 intptr_t result = left.Value() - right.Value();
44 arguments.SetReturn(Smi::Handle(Smi::New(result))); 43 arguments.SetReturn(Smi::Handle(Smi::New(result)));
45 } 44 }
46 45
47 46
48 // A leaf runtime call for test purposes. 47 // A leaf runtime call for test purposes.
49 // arg0: a smi. 48 // arg0: a smi.
50 // arg1: a smi. 49 // arg1: a smi.
51 // returns a smi representing arg0 + arg1. 50 // returns a smi representing arg0 + arg1.
52 DEFINE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, 2, 51 DEFINE_LEAF_RUNTIME_ENTRY(RawObject*, TestLeafSmiAdd, 2,
53 RawObject* arg0, RawObject* arg1) { 52 RawObject* arg0, RawObject* arg1) {
54 // Ignoring overflow in the calculation below and using the internal 53 // Ignoring overflow in the calculation below and using the internal
55 // representation of Smi directly without using any handlized code. 54 // representation of Smi directly without using any handlized code.
56 intptr_t result = reinterpret_cast<intptr_t>(arg0) + 55 intptr_t result = reinterpret_cast<intptr_t>(arg0) +
57 reinterpret_cast<intptr_t>(arg1); 56 reinterpret_cast<intptr_t>(arg1);
58 return reinterpret_cast<RawObject*>(result); 57 return reinterpret_cast<RawObject*>(result);
59 } 58 }
60 END_LEAF_RUNTIME_ENTRY 59 END_LEAF_RUNTIME_ENTRY
61 60
62 } // namespace dart 61 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/runtime_entry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698