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

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
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/exceptions.h" 10 #include "vm/exceptions.h"
11 #include "vm/native_arguments.h" 11 #include "vm/native_arguments.h"
12 #include "vm/verifier.h" 12 #include "vm/verifier.h"
13 13
14 #include "include/dart_api.h" 14 #include "include/dart_api.h"
15 15
16 namespace dart { 16 namespace dart {
17 17
18 DECLARE_FLAG(bool, deoptimize_alot);
18 DECLARE_FLAG(bool, trace_natives); 19 DECLARE_FLAG(bool, trace_natives);
19 20
20 // Forward declarations. 21 // Forward declarations.
21 class Class; 22 class Class;
22 class String; 23 class String;
23 24
24 typedef void (*NativeFunction)(NativeArguments* arguments); 25 typedef void (*NativeFunction)(NativeArguments* arguments);
25 26
26 27
27 #define NATIVE_ENTRY_FUNCTION(name) DN_##name 28 #define NATIVE_ENTRY_FUNCTION(name) DN_##name
28 29
29 30
30 // Helper macros for declaring and defining native entries. 31 // Helper macros for declaring and defining native entries.
31 #define REGISTER_NATIVE_ENTRY(name, count) \ 32 #define REGISTER_NATIVE_ENTRY(name, count) \
32 { ""#name, NATIVE_ENTRY_FUNCTION(name), count }, 33 { ""#name, NATIVE_ENTRY_FUNCTION(name), count },
33 34
34 35
35 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ 36 #define DEFINE_NATIVE_ENTRY(name, argument_count) \
37 extern void DeoptimizeAll(); \
siva 2012/08/30 01:37:30 why not include "code_generator.h" in this file in
srdjan 2012/08/30 17:16:16 Done.
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

Powered by Google App Engine
This is Rietveld 408576698