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

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

Issue 982873004: Thread/Isolate refactoring: new(Isolate) -> new(Zone) (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 9 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 "platform/memory_sanitizer.h" 8 #include "platform/memory_sanitizer.h"
9 9
10 #include "vm/allocation.h" 10 #include "vm/allocation.h"
(...skipping 21 matching lines...) Expand all
32 RawObject* retval = value; \ 32 RawObject* retval = value; \
33 ASSERT(retval->IsDartInstance()); \ 33 ASSERT(retval->IsDartInstance()); \
34 arguments->SetReturnUnsafe(retval); 34 arguments->SetReturnUnsafe(retval);
35 #else 35 #else
36 #define SET_NATIVE_RETVAL(arguments, value) \ 36 #define SET_NATIVE_RETVAL(arguments, value) \
37 arguments->SetReturnUnsafe(value); 37 arguments->SetReturnUnsafe(value);
38 #endif 38 #endif
39 39
40 #define DEFINE_NATIVE_ENTRY(name, argument_count) \ 40 #define DEFINE_NATIVE_ENTRY(name, argument_count) \
41 static RawObject* DN_Helper##name(Isolate* isolate, \ 41 static RawObject* DN_Helper##name(Isolate* isolate, \
42 Thread* thread, \
43 Zone* zone, \
42 NativeArguments* arguments); \ 44 NativeArguments* arguments); \
43 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \ 45 void NATIVE_ENTRY_FUNCTION(name)(Dart_NativeArguments args) { \
44 CHECK_STACK_ALIGNMENT; \ 46 CHECK_STACK_ALIGNMENT; \
45 VERIFY_ON_TRANSITION; \ 47 VERIFY_ON_TRANSITION; \
46 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \ 48 NativeArguments* arguments = reinterpret_cast<NativeArguments*>(args); \
47 /* Tell MemorySanitizer 'arguments' is initialized by generated code. */ \ 49 /* Tell MemorySanitizer 'arguments' is initialized by generated code. */ \
48 MSAN_UNPOISON(arguments, sizeof(*arguments)); \ 50 MSAN_UNPOISON(arguments, sizeof(*arguments)); \
49 ASSERT(arguments->NativeArgCount() == argument_count); \ 51 ASSERT(arguments->NativeArgCount() == argument_count); \
50 TRACE_NATIVE_CALL("%s", ""#name); \ 52 TRACE_NATIVE_CALL("%s", ""#name); \
51 { \ 53 { \
52 StackZone zone(arguments->isolate()); \ 54 Isolate* isolate = arguments->isolate(); \
55 /* TODO(koda): Pivot from Isolate to Thread in NativeArguments. */ \
56 Thread* thread = Thread::CurrentFromCurrentIsolate(isolate); \
57 StackZone zone(isolate); \
53 SET_NATIVE_RETVAL(arguments, \ 58 SET_NATIVE_RETVAL(arguments, \
54 DN_Helper##name(arguments->isolate(), arguments)); \ 59 DN_Helper##name(isolate, \
60 thread, \
61 zone.GetZone(), \
62 arguments)); \
55 DEOPTIMIZE_ALOT; \ 63 DEOPTIMIZE_ALOT; \
56 } \ 64 } \
57 VERIFY_ON_TRANSITION; \ 65 VERIFY_ON_TRANSITION; \
58 } \ 66 } \
59 static RawObject* DN_Helper##name(Isolate* isolate, \ 67 static RawObject* DN_Helper##name(Isolate* isolate, \
68 Thread* thread, \
69 Zone* zone, \
60 NativeArguments* arguments) 70 NativeArguments* arguments)
61 71
62 72
63 // Natives should throw an exception if an illegal argument or null is passed. 73 // Natives should throw an exception if an illegal argument or null is passed.
64 // type name = value. 74 // type name = value.
65 #define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value) \ 75 #define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value) \
66 const Instance& __##name##_instance__ = \ 76 const Instance& __##name##_instance__ = \
67 Instance::CheckedHandle(isolate, value); \ 77 Instance::CheckedHandle(isolate, value); \
68 if (!__##name##_instance__.Is##type()) { \ 78 if (!__##name##_instance__.Is##type()) { \
69 const Array& __args__ = Array::Handle(Array::New(1)); \ 79 const Array& __args__ = Array::Handle(Array::New(1)); \
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 uword pc); 113 uword pc);
104 static const uint8_t* ResolveSymbol(uword pc); 114 static const uint8_t* ResolveSymbol(uword pc);
105 static void NativeCallWrapper(Dart_NativeArguments args, 115 static void NativeCallWrapper(Dart_NativeArguments args,
106 Dart_NativeFunction func); 116 Dart_NativeFunction func);
107 static const ExternalLabel& NativeCallWrapperLabel(); 117 static const ExternalLabel& NativeCallWrapperLabel();
108 }; 118 };
109 119
110 } // namespace dart 120 } // namespace dart
111 121
112 #endif // VM_NATIVE_ENTRY_H_ 122 #endif // VM_NATIVE_ENTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698