| 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 RUNTIME_VM_NATIVE_ARGUMENTS_H_ | 5 #ifndef RUNTIME_VM_NATIVE_ARGUMENTS_H_ |
| 6 #define RUNTIME_VM_NATIVE_ARGUMENTS_H_ | 6 #define RUNTIME_VM_NATIVE_ARGUMENTS_H_ |
| 7 | 7 |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "platform/memory_sanitizer.h" | 9 #include "platform/memory_sanitizer.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 | 62 |
| 63 #define CHECK_STACK_ALIGNMENT \ | 63 #define CHECK_STACK_ALIGNMENT \ |
| 64 {} | 64 {} |
| 65 #define VERIFY_ON_TRANSITION \ | 65 #define VERIFY_ON_TRANSITION \ |
| 66 {} | 66 {} |
| 67 #define DEOPTIMIZE_ALOT \ | 67 #define DEOPTIMIZE_ALOT \ |
| 68 {} | 68 {} |
| 69 | 69 |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 #ifndef PRODUCT | |
| 73 #define TRACE_NATIVE_CALL(format, name) \ | |
| 74 if (FLAG_trace_natives) { \ | |
| 75 OS::Print("Calling native: " format "\n", name); \ | |
| 76 } | |
| 77 #else | |
| 78 #define TRACE_NATIVE_CALL(format, name) \ | |
| 79 do { \ | |
| 80 } while (0) | |
| 81 #endif | |
| 82 | |
| 83 // Class NativeArguments is used to access arguments passed in from | 72 // Class NativeArguments is used to access arguments passed in from |
| 84 // generated dart code to a runtime function or a dart library native | 73 // generated dart code to a runtime function or a dart library native |
| 85 // function. It is also used to set the return value if any at the slot | 74 // function. It is also used to set the return value if any at the slot |
| 86 // reserved for return values. | 75 // reserved for return values. |
| 87 // All runtime function/dart library native functions have the | 76 // All runtime function/dart library native functions have the |
| 88 // following signature: | 77 // following signature: |
| 89 // void function_name(NativeArguments arguments); | 78 // void function_name(NativeArguments arguments); |
| 90 // Inside the function, arguments are accessed as follows: | 79 // Inside the function, arguments are accessed as follows: |
| 91 // const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0)); | 80 // const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0)); |
| 92 // const Smi& arg1 = Smi::CheckedHandle(arguments.ArgAt(1)); | 81 // const Smi& arg1 = Smi::CheckedHandle(arguments.ArgAt(1)); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 | 234 |
| 246 Thread* thread_; // Current thread pointer. | 235 Thread* thread_; // Current thread pointer. |
| 247 intptr_t argc_tag_; // Encodes argument count and invoked native call type. | 236 intptr_t argc_tag_; // Encodes argument count and invoked native call type. |
| 248 RawObject** argv_; // Pointer to an array of arguments to runtime call. | 237 RawObject** argv_; // Pointer to an array of arguments to runtime call. |
| 249 RawObject** retval_; // Pointer to the return value area. | 238 RawObject** retval_; // Pointer to the return value area. |
| 250 }; | 239 }; |
| 251 | 240 |
| 252 } // namespace dart | 241 } // namespace dart |
| 253 | 242 |
| 254 #endif // RUNTIME_VM_NATIVE_ARGUMENTS_H_ | 243 #endif // RUNTIME_VM_NATIVE_ARGUMENTS_H_ |
| OLD | NEW |