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

Side by Side Diff: vm/runtime_entry.h

Issue 10542123: Add support for leaf runtime calls (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 6 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 | « no previous file | vm/runtime_entry_ia32.cc » ('j') | vm/stub_code_ia32.cc » ('J')
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, int argument_count) 25 RuntimeEntry(const char* name, RuntimeFunction function,
26 int argument_count, bool is_leaf)
26 : name_(name), 27 : name_(name),
27 function_(function), 28 function_(function),
28 argument_count_(argument_count) { } 29 argument_count_(argument_count),
30 is_leaf_(is_leaf) { }
29 ~RuntimeEntry() {} 31 ~RuntimeEntry() {}
30 32
31 const char* name() const { return name_; } 33 const char* name() const { return name_; }
32 RuntimeFunction function() const { return function_; } 34 RuntimeFunction function() const { return function_; }
33 int argument_count() const { return argument_count_; } 35 int argument_count() const { return argument_count_; }
36 bool is_leaf() const { return is_leaf_; }
34 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); } 37 uword GetEntryPoint() const { return reinterpret_cast<uword>(function()); }
35 38
36 // Generate code to call the runtime entry. 39 // Generate code to call the runtime entry.
37 void Call(Assembler* assembler) const; 40 void Call(Assembler* assembler) const;
38 41
39 private: 42 private:
40 const char* name_; 43 const char* name_;
41 RuntimeFunction function_; 44 RuntimeFunction function_;
42 int argument_count_; 45 int argument_count_;
srdjan 2012/06/12 20:10:41 const
siva 2012/06/12 21:18:04 Done.
46 bool is_leaf_;
srdjan 2012/06/12 20:10:41 const
siva 2012/06/12 21:18:04 Done.
43 47
44 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry); 48 DISALLOW_COPY_AND_ASSIGN(RuntimeEntry);
45 }; 49 };
46 50
47 51
48 // Helper macros for declaring and defining runtime entries. 52 // Helper macros for declaring and defining runtime entries.
49 53
50 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \ 54 #define DEFINE_RUNTIME_ENTRY(name, argument_count) \
51 extern void DRT_##name(NativeArguments arguments); \ 55 extern void DRT_##name(NativeArguments arguments); \
52 extern const RuntimeEntry k##name##RuntimeEntry( \ 56 extern const RuntimeEntry k##name##RuntimeEntry( \
53 "DRT_"#name, &DRT_##name, argument_count); \ 57 "DRT_"#name, &DRT_##name, argument_count, false); \
54 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \ 58 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments); \
55 void DRT_##name(NativeArguments arguments) { \ 59 void DRT_##name(NativeArguments arguments) { \
56 CHECK_STACK_ALIGNMENT; \ 60 CHECK_STACK_ALIGNMENT; \
57 VERIFY_ON_TRANSITION; \ 61 VERIFY_ON_TRANSITION; \
58 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \ 62 if (FLAG_trace_runtime_calls) OS::Print("Runtime call: %s\n", ""#name); \
59 { \ 63 { \
60 Zone zone(arguments.isolate()); \ 64 Zone zone(arguments.isolate()); \
61 HANDLESCOPE(arguments.isolate()); \ 65 HANDLESCOPE(arguments.isolate()); \
62 DRT_Helper##name(arguments.isolate(), arguments); \ 66 DRT_Helper##name(arguments.isolate(), arguments); \
63 } \ 67 } \
64 VERIFY_ON_TRANSITION; \ 68 VERIFY_ON_TRANSITION; \
65 } \ 69 } \
66 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments) 70 static void DRT_Helper##name(Isolate* isolate, NativeArguments arguments)
67 71
68 #define DECLARE_RUNTIME_ENTRY(name) \ 72 #define DECLARE_RUNTIME_ENTRY(name) \
69 extern const RuntimeEntry k##name##RuntimeEntry 73 extern const RuntimeEntry k##name##RuntimeEntry
70 74
75 #define DEFINE_LEAF_RUNTIME_ENTRY(name, argument_count) \
76 extern RawObject* DLRT_##name(NativeArguments arguments); \
77 extern const RuntimeEntry k##name##RuntimeEntry( \
78 "DLRT_"#name, reinterpret_cast<RuntimeFunction>(&DLRT_##name), \
79 argument_count, true); \
80 static RawObject* DLRT_Helper##name(Isolate* isolate, NativeArguments args); \
81 RawObject* DLRT_##name(NativeArguments arguments) { \
82 CHECK_STACK_ALIGNMENT; \
83 { \
84 NoGCScope no_gc_scope; \
85 return DLRT_Helper##name(arguments.isolate(), arguments); \
86 } \
87 } \
88 static RawObject* DLRT_Helper##name(Isolate* isolate, NativeArguments args)
89
90 #define DECLARE_LEAF_RUNTIME_ENTRY(name) \
91 extern const RuntimeEntry k##name##RuntimeEntry
92
71 } // namespace dart 93 } // namespace dart
72 94
73 #endif // VM_RUNTIME_ENTRY_H_ 95 #endif // VM_RUNTIME_ENTRY_H_
OLDNEW
« no previous file with comments | « no previous file | vm/runtime_entry_ia32.cc » ('j') | vm/stub_code_ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698