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