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

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

Issue 227433004: Add runtime and native entry tags (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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/raw_object.h ('k') | runtime/vm/stack_frame.h » ('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 #include "vm/tags.h"
12 13
13 namespace dart { 14 namespace dart {
14 15
15 DECLARE_FLAG(bool, trace_runtime_calls); 16 DECLARE_FLAG(bool, trace_runtime_calls);
16 17
17 typedef void (*RuntimeFunction)(NativeArguments arguments); 18 typedef void (*RuntimeFunction)(NativeArguments arguments);
18 19
19 20
20 // Class RuntimeEntry is used to encapsulate runtime functions, it includes 21 // Class RuntimeEntry is used to encapsulate runtime functions, it includes
21 // the entry point for the runtime function and the number of arguments expected 22 // the entry point for the runtime function and the number of arguments expected
22 // by the function. 23 // by the function.
23 class RuntimeEntry : public ValueObject { 24 class RuntimeEntry : public ValueObject {
24 public: 25 public:
25 RuntimeEntry(const char* name, RuntimeFunction function, 26 RuntimeEntry(const char* name, RuntimeFunction function,
26 intptr_t argument_count, bool is_leaf, bool is_float) 27 intptr_t argument_count, bool is_leaf, bool is_float)
27 : name_(name), 28 : name_(name),
28 function_(function), 29 function_(function),
29 argument_count_(argument_count), 30 argument_count_(argument_count),
30 is_leaf_(is_leaf), 31 is_leaf_(is_leaf),
31 is_float_(is_float) { } 32 is_float_(is_float),
33 next_(NULL) {
34 // Strip off const for registration.
35 VMTag::RegisterRuntimeEntry(const_cast<RuntimeEntry*>(this));
36 }
32 ~RuntimeEntry() {} 37 ~RuntimeEntry() {}
33 38
34 const char* name() const { return name_; } 39 const char* name() const { return name_; }
35 RuntimeFunction function() const { return function_; } 40 RuntimeFunction function() const { return function_; }
36 intptr_t argument_count() const { return argument_count_; } 41 intptr_t argument_count() const { return argument_count_; }
37 bool is_leaf() const { return is_leaf_; } 42 bool is_leaf() const { return is_leaf_; }
38 bool is_float() const { return is_float_; } 43 bool is_float() const { return is_float_; }
39 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); } 44 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); }
40 45
41 // Generate code to call the runtime entry. 46 // Generate code to call the runtime entry.
42 void Call(Assembler* assembler, intptr_t argument_count) const; 47 void Call(Assembler* assembler, intptr_t argument_count) const;
43 48
49 void set_next(const RuntimeEntry* next) { next_ = next; }
50 const RuntimeEntry* next() const { return next_; }
51
44 private: 52 private:
45 const char* name_; 53 const char* name_;
46 const RuntimeFunction function_; 54 const RuntimeFunction function_;
47 const intptr_t argument_count_; 55 const intptr_t argument_count_;
48 const bool is_leaf_; 56 const bool is_leaf_;
49 const bool is_float_; 57 const bool is_float_;
58 const RuntimeEntry* next_;
50 59
51 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); 60 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry);
52 }; 61 };
53 62
54 63
55 // Helper macros for declaring and defining runtime entries. 64 // Helper macros for declaring and defining runtime entries.
56 65
57 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ 66 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \
58 extern void DRT_##name(NativeArguments arguments); \ 67 extern void DRT_##name(NativeArguments arguments); \
59 extern const RuntimeEntry k##name##RuntimeEntry( \ 68 extern const RuntimeEntry k##name##RuntimeEntry( \
(...skipping 27 matching lines...) Expand all
87 96
88 #define END_LEAF_RUNTIME_ENTRY } 97 #define END_LEAF_RUNTIME_ENTRY }
89 98
90 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \ 99 #define DECLARE_LEAF_RUNTIME_ENTRY(type, name, ...) \
91 extern const RuntimeEntry k##name##RuntimeEntry; \ 100 extern const RuntimeEntry k##name##RuntimeEntry; \
92 extern "C" type DLRT_##name(__VA_ARGS__) 101 extern "C" type DLRT_##name(__VA_ARGS__)
93 102
94 } // namespace dart 103 } // namespace dart
95 104
96 #endif // VM_RUNTIME_ENTRY_H_ 105 #endif // VM_RUNTIME_ENTRY_H_
OLDNEW
« no previous file with comments | « runtime/vm/raw_object.h ('k') | runtime/vm/stack_frame.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698