| OLD | NEW |
| 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/stub_code.h" | 10 #include "vm/stub_code.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \ | 32 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \ |
| 33 } | 33 } |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #else | 36 #else |
| 37 | 37 |
| 38 #define CHECK_STACK_ALIGNMENT { } | 38 #define CHECK_STACK_ALIGNMENT { } |
| 39 | 39 |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 DART_EXTERN_C { | 42 void SetReturnValueHelper(Dart_NativeArguments, Dart_Handle); |
| 43 void Dart_SetReturnValue(Dart_NativeArguments, Dart_Handle); | |
| 44 } | |
| 45 | 43 |
| 46 // Class NativeArguments is used to access arguments passed in from | 44 // Class NativeArguments is used to access arguments passed in from |
| 47 // generated dart code to a runtime function or a dart library native | 45 // generated dart code to a runtime function or a dart library native |
| 48 // function. It is also used to set the return value if any at the slot | 46 // function. It is also used to set the return value if any at the slot |
| 49 // reserved for return values. | 47 // reserved for return values. |
| 50 // All runtime function/dart library native functions have the | 48 // All runtime function/dart library native functions have the |
| 51 // following signature: | 49 // following signature: |
| 52 // void function_name(NativeArguments arguments); | 50 // void function_name(NativeArguments arguments); |
| 53 // Inside the function, arguments are accessed as follows: | 51 // Inside the function, arguments are accessed as follows: |
| 54 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0)); | 52 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0)); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 return OFFSET_OF(NativeArguments, isolate_); | 72 return OFFSET_OF(NativeArguments, isolate_); |
| 75 } | 73 } |
| 76 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } | 74 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } |
| 77 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } | 75 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } |
| 78 static intptr_t retval_offset() { | 76 static intptr_t retval_offset() { |
| 79 return OFFSET_OF(NativeArguments, retval_); | 77 return OFFSET_OF(NativeArguments, retval_); |
| 80 } | 78 } |
| 81 | 79 |
| 82 private: | 80 private: |
| 83 friend class BootstrapNatives; | 81 friend class BootstrapNatives; |
| 84 friend void Dart_SetReturnValue(Dart_NativeArguments, Dart_Handle); | 82 friend void SetReturnValueHelper(Dart_NativeArguments, Dart_Handle); |
| 85 | 83 |
| 86 // Since this function is passed a RawObject directly, we need to be | 84 // Since this function is passed a RawObject directly, we need to be |
| 87 // exceedingly careful when we use it. If there are any other side | 85 // exceedingly careful when we use it. If there are any other side |
| 88 // effects in the statement that may cause GC, it could lead to | 86 // effects in the statement that may cause GC, it could lead to |
| 89 // bugs. | 87 // bugs. |
| 90 void SetReturnUnsafe(RawObject* value) const; | 88 void SetReturnUnsafe(RawObject* value) const; |
| 91 | 89 |
| 92 Isolate* isolate_; // Current isolate pointer. | 90 Isolate* isolate_; // Current isolate pointer. |
| 93 int argc_; // Number of arguments passed to the runtime call. | 91 int argc_; // Number of arguments passed to the runtime call. |
| 94 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. | 92 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. |
| 95 RawObject** retval_; // Pointer to the return value area. | 93 RawObject** retval_; // Pointer to the return value area. |
| 96 }; | 94 }; |
| 97 | 95 |
| 98 } // namespace dart | 96 } // namespace dart |
| 99 | 97 |
| 100 #endif // VM_NATIVE_ARGUMENTS_H_ | 98 #endif // VM_NATIVE_ARGUMENTS_H_ |
| OLD | NEW |