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

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

Issue 10885039: Deoptimization can occur at Dart calls (includes native calls to C) but not at runtime calls. This … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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/object.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_NATIVE_ENTRY_H_ 5 #ifndef VM_NATIVE_ENTRY_H_
6 #define VM_NATIVE_ENTRY_H_ 6 #define VM_NATIVE_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/code_generator.h"
10 #include "vm/exceptions.h" 11 #include "vm/exceptions.h"
11 #include "vm/native_arguments.h" 12 #include "vm/native_arguments.h"
12 #include "vm/verifier.h" 13 #include "vm/verifier.h"
13 14
14 #include "include/dart_api.h" 15 #include "include/dart_api.h"
15 16
16 namespace dart { 17 namespace dart {
17 18
19 DECLARE_FLAG(bool, deoptimize_alot);
18 DECLARE_FLAG(bool, trace_natives); 20 DECLARE_FLAG(bool, trace_natives);
19 21
20 // Forward declarations. 22 // Forward declarations.
21 class Class; 23 class Class;
22 class String; 24 class String;
23 25
24 typedef void (*NativeFunction)(NativeArguments* arguments); 26 typedef void (*NativeFunction)(NativeArguments* arguments);
25 27
26 28
27 #define NATIVE_ENTRY_FUNCTION(name) DN_##name 29 #define NATIVE_ENTRY_FUNCTION(name) DN_##name
28 30
29 31
30 // Helper macros for declaring and defining native entries. 32 // Helper macros for declaring and defining native entries.
31 #define REGISTER_NATIVE_ENTRY(name, count) \ 33 #define REGISTER_NATIVE_ENTRY(name, count) \
32 { ""#name, NATIVE_ENTRY_FUNCTION(name), count }, 34 { ""#name, NATIVE_ENTRY_FUNCTION(name), count },
33 35
34 36
35 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ 37 #define DEFINE_NATIVE_ENTRY(name, argument_count) \
36 static void DN_Helper##name(Isolate* isolate, NativeArguments* arguments); \ 38 static void DN_Helper##name(Isolate* isolate, NativeArguments* arguments); \
37 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ 39 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \
38 CHECK_STACK_ALIGNMENT; \ 40 CHECK_STACK_ALIGNMENT; \
39 VERIFY_ON_TRANSITION; \ 41 VERIFY_ON_TRANSITION; \
40 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ 42 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \
41 ASSERT(arguments->Count() == argument_count); \ 43 ASSERT(arguments->Count() == argument_count); \
42 if (FLAG_trace_natives) OS::Print("Calling native: %s\n", ""#name); \ 44 if (FLAG_trace_natives) OS::Print("Calling native: %s\n", ""#name); \
43 { \ 45 { \
44 Zone zone(arguments->isolate()); \ 46 Zone zone(arguments->isolate()); \
45 HANDLESCOPE(arguments->isolate()); \ 47 HANDLESCOPE(arguments->isolate()); \
46 DN_Helper##name(arguments->isolate(), arguments); \ 48 DN_Helper##name(arguments->isolate(), arguments); \
49 if (FLAG_deoptimize_alot) DeoptimizeAll(); \
47 } \ 50 } \
48 VERIFY_ON_TRANSITION; \ 51 VERIFY_ON_TRANSITION; \
49 } \ 52 } \
50 static void DN_Helper##name(Isolate* isolate, NativeArguments* arguments) 53 static void DN_Helper##name(Isolate* isolate, NativeArguments* arguments)
51 54
52 55
53 #define DECLARE_NATIVE_ENTRY(name, argument_count) \ 56 #define DECLARE_NATIVE_ENTRY(name, argument_count) \
54 extern void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments arguments); 57 extern void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments arguments);
55 58
56 // Natives should throw an exception if an illegal argument is passed. 59 // Natives should throw an exception if an illegal argument is passed.
(...skipping 15 matching lines...) Expand all
72 public: 75 public:
73 // Resolve specified dart native function to the actual native entrypoint. 76 // Resolve specified dart native function to the actual native entrypoint.
74 static NativeFunction ResolveNative(const Class& cls, 77 static NativeFunction ResolveNative(const Class& cls,
75 const String& function_name, 78 const String& function_name,
76 int number_of_arguments); 79 int number_of_arguments);
77 }; 80 };
78 81
79 } // namespace dart 82 } // namespace dart
80 83
81 #endif // VM_NATIVE_ENTRY_H_ 84 #endif // VM_NATIVE_ENTRY_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_x64.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698