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

Side by Side Diff: runtime/vm/runtime_entry.h

Issue 23672011: Fix the previously ineffective assert checking the number of arguments passed to (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/intermediate_language_x64.cc ('k') | runtime/vm/runtime_entry_arm.cc » ('j') | 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 #ifndef VM_RUNTIME_ENTRY_H_ 5 #ifndef VM_RUNTIME_ENTRY_H_
6 #define VM_RUNTIME_ENTRY_H_ 6 #define VM_RUNTIME_ENTRY_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/flags.h" 10 #include "vm/flags.h"
11 #include "vm/native_arguments.h" 11 #include "vm/native_arguments.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 DECLARE_FLAG(bool, trace_runtime_calls); 15 DECLARE_FLAG(bool, trace_runtime_calls);
16 16
17 typedef void (*RuntimeFunction)(NativeArguments arguments); 17 typedef void (*RuntimeFunction)(NativeArguments arguments);
18 18
19 19
20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes 20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes
21 // the entry point for the runtime function and the number of arguments expected 21 // the entry point for the runtime function and the number of arguments expected
22 // by the function. 22 // by the function.
23 class RuntimeEntry : public ValueObject { 23 class RuntimeEntry : public ValueObject {
24 public: 24 public:
25 RuntimeEntry(const char* name, RuntimeFunction function, 25 RuntimeEntry(const char* name, RuntimeFunction function,
26 int argument_count, bool is_leaf, bool is_float) 26 intptr_t argument_count, bool is_leaf, bool is_float)
27 : name_(name), 27 : name_(name),
28 function_(function), 28 function_(function),
29 argument_count_(argument_count), 29 argument_count_(argument_count),
30 is_leaf_(is_leaf), 30 is_leaf_(is_leaf),
31 is_float_(is_float) { } 31 is_float_(is_float) { }
32 ~RuntimeEntry() {} 32 ~RuntimeEntry() {}
33 33
34 const char* name() const { return name_; } 34 const char* name() const { return name_; }
35 RuntimeFunction function() const { return function_; } 35 RuntimeFunction function() const { return function_; }
36 int argument_count() const { return argument_count_; } 36 intptr_t argument_count() const { return argument_count_; }
37 bool is_leaf() const { return is_leaf_; } 37 bool is_leaf() const { return is_leaf_; }
38 bool is_float() const { return is_float_; } 38 bool is_float() const { return is_float_; }
39 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); } 39 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); }
40 40
41 // Generate code to call the runtime entry. 41 // Generate code to call the runtime entry.
42 void Call(Assembler* assembler) const; 42 void Call(Assembler* assembler, intptr_t argument_count) const;
43 43
44 private: 44 private:
45 const char* name_; 45 const char* name_;
46 const RuntimeFunction function_; 46 const RuntimeFunction function_;
47 const int argument_count_; 47 const intptr_t argument_count_;
48 const bool is_leaf_; 48 const bool is_leaf_;
49 const bool is_float_; 49 const bool is_float_;
50 50
51 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); 51 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry);
52 }; 52 };
53 53
54 54
55 // Helper macros for declaring and defining runtime entries. 55 // Helper macros for declaring and defining runtime entries.
56 56
57 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ 57 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \
(...skipping 28 matching lines...) Expand all
86 86
87 #define END_LEAF_RUNTIME_ENTRY } 87 #define END_LEAF_RUNTIME_ENTRY }
88 88
89 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ 89 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \
90 extern const RuntimeEntry k##name##RuntimeEntry; \ 90 extern const RuntimeEntry k##name##RuntimeEntry; \
91 extern "C" type DLRT_##name(__VA_ARGS__) 91 extern "C" type DLRT_##name(__VA_ARGS__)
92 92
93 } // namespace dart 93 } // namespace dart
94 94
95 #endif // VM_RUNTIME_ENTRY_H_ 95 #endif // VM_RUNTIME_ENTRY_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/runtime_entry_arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698