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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 static intptr_t argc_tag_offset() { | 144 static intptr_t argc_tag_offset() { |
145 return OFFSET_OF(NativeArguments, argc_tag_); | 145 return OFFSET_OF(NativeArguments, argc_tag_); |
146 } | 146 } |
147 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } | 147 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } |
148 static intptr_t retval_offset() { | 148 static intptr_t retval_offset() { |
149 return OFFSET_OF(NativeArguments, retval_); | 149 return OFFSET_OF(NativeArguments, retval_); |
150 } | 150 } |
151 | 151 |
152 static intptr_t ParameterCountForResolution(const Function& function) { | 152 static intptr_t ParameterCountForResolution(const Function& function) { |
153 ASSERT(function.is_native()); | 153 ASSERT(function.is_native()); |
| 154 ASSERT(!function.IsGeneric()); // Not supported. |
154 ASSERT(!function.IsGenerativeConstructor()); // Not supported. | 155 ASSERT(!function.IsGenerativeConstructor()); // Not supported. |
155 intptr_t count = function.NumParameters(); | 156 intptr_t count = function.NumParameters(); |
156 if (function.is_static() && function.IsClosureFunction()) { | 157 if (function.is_static() && function.IsClosureFunction()) { |
157 // The closure object is hidden and not accessible from native code. | 158 // The closure object is hidden and not accessible from native code. |
158 // However, if the function is an instance closure function, the captured | 159 // However, if the function is an instance closure function, the captured |
159 // receiver located in the context is made accessible in native code at | 160 // receiver located in the context is made accessible in native code at |
160 // index 0, thereby hidding the closure object at index 0. | 161 // index 0, thereby hidding the closure object at index 0. |
161 count--; | 162 count--; |
162 } | 163 } |
163 return count; | 164 return count; |
164 } | 165 } |
165 | 166 |
166 static int ComputeArgcTag(const Function& function) { | 167 static int ComputeArgcTag(const Function& function) { |
167 ASSERT(function.is_native()); | 168 ASSERT(function.is_native()); |
| 169 ASSERT(!function.IsGeneric()); // Not supported. |
168 ASSERT(!function.IsGenerativeConstructor()); // Not supported. | 170 ASSERT(!function.IsGenerativeConstructor()); // Not supported. |
169 int tag = ArgcBits::encode(function.NumParameters()); | 171 int tag = ArgcBits::encode(function.NumParameters()); |
170 int function_bits = 0; | 172 int function_bits = 0; |
171 if (!function.is_static()) { | 173 if (!function.is_static()) { |
172 function_bits |= kInstanceFunctionBit; | 174 function_bits |= kInstanceFunctionBit; |
173 } | 175 } |
174 if (function.IsClosureFunction()) { | 176 if (function.IsClosureFunction()) { |
175 function_bits |= kClosureFunctionBit; | 177 function_bits |= kClosureFunctionBit; |
176 } | 178 } |
177 tag = FunctionBits::update(function_bits, tag); | 179 tag = FunctionBits::update(function_bits, tag); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 236 |
235 Thread* thread_; // Current thread pointer. | 237 Thread* thread_; // Current thread pointer. |
236 intptr_t argc_tag_; // Encodes argument count and invoked native call type. | 238 intptr_t argc_tag_; // Encodes argument count and invoked native call type. |
237 RawObject** argv_; // Pointer to an array of arguments to runtime call. | 239 RawObject** argv_; // Pointer to an array of arguments to runtime call. |
238 RawObject** retval_; // Pointer to the return value area. | 240 RawObject** retval_; // Pointer to the return value area. |
239 }; | 241 }; |
240 | 242 |
241 } // namespace dart | 243 } // namespace dart |
242 | 244 |
243 #endif // RUNTIME_VM_NATIVE_ARGUMENTS_H_ | 245 #endif // RUNTIME_VM_NATIVE_ARGUMENTS_H_ |
OLD | NEW |