| 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 "platform/memory_sanitizer.h" | 9 #include "platform/memory_sanitizer.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } | 136 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } |
| 137 static intptr_t retval_offset() { | 137 static intptr_t retval_offset() { |
| 138 return OFFSET_OF(NativeArguments, retval_); | 138 return OFFSET_OF(NativeArguments, retval_); |
| 139 } | 139 } |
| 140 static intptr_t AutoSetupScopeMask() { | 140 static intptr_t AutoSetupScopeMask() { |
| 141 return AutoSetupScopeBits::mask_in_place(); | 141 return AutoSetupScopeBits::mask_in_place(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 static intptr_t ParameterCountForResolution(const Function& function) { | 144 static intptr_t ParameterCountForResolution(const Function& function) { |
| 145 ASSERT(function.is_native()); | 145 ASSERT(function.is_native()); |
| 146 ASSERT(!function.IsConstructor()); // Not supported. | 146 ASSERT(!function.IsGenerativeConstructor()); // Not supported. |
| 147 intptr_t count = function.NumParameters(); | 147 intptr_t count = function.NumParameters(); |
| 148 if (function.is_static() && function.IsClosureFunction()) { | 148 if (function.is_static() && function.IsClosureFunction()) { |
| 149 // The closure object is hidden and not accessible from native code. | 149 // The closure object is hidden and not accessible from native code. |
| 150 // However, if the function is an instance closure function, the captured | 150 // However, if the function is an instance closure function, the captured |
| 151 // receiver located in the context is made accessible in native code at | 151 // receiver located in the context is made accessible in native code at |
| 152 // index 0, thereby hidding the closure object at index 0. | 152 // index 0, thereby hidding the closure object at index 0. |
| 153 count--; | 153 count--; |
| 154 } | 154 } |
| 155 return count; | 155 return count; |
| 156 } | 156 } |
| 157 | 157 |
| 158 static int ComputeArgcTag(const Function& function) { | 158 static int ComputeArgcTag(const Function& function) { |
| 159 ASSERT(function.is_native()); | 159 ASSERT(function.is_native()); |
| 160 ASSERT(!function.IsConstructor()); // Not supported. | 160 ASSERT(!function.IsGenerativeConstructor()); // Not supported. |
| 161 int tag = ArgcBits::encode(function.NumParameters()); | 161 int tag = ArgcBits::encode(function.NumParameters()); |
| 162 int function_bits = 0; | 162 int function_bits = 0; |
| 163 if (!function.is_static()) { | 163 if (!function.is_static()) { |
| 164 function_bits |= kInstanceFunctionBit; | 164 function_bits |= kInstanceFunctionBit; |
| 165 } | 165 } |
| 166 if (function.IsClosureFunction()) { | 166 if (function.IsClosureFunction()) { |
| 167 function_bits |= kClosureFunctionBit; | 167 function_bits |= kClosureFunctionBit; |
| 168 } | 168 } |
| 169 tag = FunctionBits::update(function_bits, tag); | 169 tag = FunctionBits::update(function_bits, tag); |
| 170 if (function.IsNativeAutoSetupScope()) { | 170 if (function.IsNativeAutoSetupScope()) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 | 223 |
| 224 Isolate* isolate_; // Current isolate pointer. | 224 Isolate* isolate_; // Current isolate pointer. |
| 225 int argc_tag_; // Encodes argument count and invoked native call type. | 225 int argc_tag_; // Encodes argument count and invoked native call type. |
| 226 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. | 226 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. |
| 227 RawObject** retval_; // Pointer to the return value area. | 227 RawObject** retval_; // Pointer to the return value area. |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 } // namespace dart | 230 } // namespace dart |
| 231 | 231 |
| 232 #endif // VM_NATIVE_ARGUMENTS_H_ | 232 #endif // VM_NATIVE_ARGUMENTS_H_ |
| OLD | NEW |