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

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

Issue 21319002: - Add following additional methods to the API to make returning values (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_ARGUMENTS_H_ 5 #ifndef VM_NATIVE_ARGUMENTS_H_
6 #define VM_NATIVE_ARGUMENTS_H_ 6 #define VM_NATIVE_ARGUMENTS_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/simulator.h" 10 #include "vm/simulator.h"
(...skipping 29 matching lines...) Expand all
40 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \ 40 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \
41 } 41 }
42 #endif 42 #endif
43 43
44 #else 44 #else
45 45
46 #define CHECK_STACK_ALIGNMENT { } 46 #define CHECK_STACK_ALIGNMENT { }
47 47
48 #endif 48 #endif
49 49
50 void SetReturnValueHelper(Dart_NativeArguments, Dart_Handle);
51
52 50
53 // Class NativeArguments is used to access arguments passed in from 51 // Class NativeArguments is used to access arguments passed in from
54 // generated dart code to a runtime function or a dart library native 52 // generated dart code to a runtime function or a dart library native
55 // function. It is also used to set the return value if any at the slot 53 // function. It is also used to set the return value if any at the slot
56 // reserved for return values. 54 // reserved for return values.
57 // All runtime function/dart library native functions have the 55 // All runtime function/dart library native functions have the
58 // following signature: 56 // following signature:
59 // void function_name(NativeArguments arguments); 57 // void function_name(NativeArguments arguments);
60 // Inside the function, arguments are accessed as follows: 58 // Inside the function, arguments are accessed as follows:
61 // const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0)); 59 // const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0));
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 private: 149 private:
152 enum ArgcTagBits { 150 enum ArgcTagBits {
153 kArgcBit = 0, 151 kArgcBit = 0,
154 kArgcSize = 24, 152 kArgcSize = 24,
155 kInstanceFunctionBit = 24, 153 kInstanceFunctionBit = 24,
156 kClosureFunctionBit = 25, 154 kClosureFunctionBit = 25,
157 }; 155 };
158 class ArgcBits : public BitField<int, kArgcBit, kArgcSize> {}; 156 class ArgcBits : public BitField<int, kArgcBit, kArgcSize> {};
159 class InstanceFunctionBit : public BitField<bool, kInstanceFunctionBit, 1> {}; 157 class InstanceFunctionBit : public BitField<bool, kInstanceFunctionBit, 1> {};
160 class ClosureFunctionBit : public BitField<bool, kClosureFunctionBit, 1> {}; 158 class ClosureFunctionBit : public BitField<bool, kClosureFunctionBit, 1> {};
159 friend class Api;
161 friend class BootstrapNatives; 160 friend class BootstrapNatives;
162 friend class Simulator; 161 friend class Simulator;
163 friend void SetReturnValueHelper(Dart_NativeArguments, Dart_Handle);
164 162
165 // Since this function is passed a RawObject directly, we need to be 163 // Since this function is passed a RawObject directly, we need to be
166 // exceedingly careful when we use it. If there are any other side 164 // exceedingly careful when we use it. If there are any other side
167 // effects in the statement that may cause GC, it could lead to 165 // effects in the statement that may cause GC, it could lead to
168 // bugs. 166 // bugs.
169 void SetReturnUnsafe(RawObject* value) const; 167 void SetReturnUnsafe(RawObject* value) const;
170 168
171 Isolate* isolate_; // Current isolate pointer. 169 Isolate* isolate_; // Current isolate pointer.
172 int argc_tag_; // Encodes argument count and invoked native call type. 170 int argc_tag_; // Encodes argument count and invoked native call type.
173 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. 171 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call.
174 RawObject** retval_; // Pointer to the return value area. 172 RawObject** retval_; // Pointer to the return value area.
175 }; 173 };
176 174
177 } // namespace dart 175 } // namespace dart
178 176
179 #endif // VM_NATIVE_ARGUMENTS_H_ 177 #endif // VM_NATIVE_ARGUMENTS_H_
OLDNEW
« runtime/vm/dart_api_impl.cc ('K') | « runtime/vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698