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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 int ArgCount() const { return ArgcBits::decode(argc_tag_); } | 89 int ArgCount() const { return ArgcBits::decode(argc_tag_); } |
90 | 90 |
91 RawObject* ArgAt(int index) const { | 91 RawObject* ArgAt(int index) const { |
92 ASSERT((index >= 0) && (index < ArgCount())); | 92 ASSERT((index >= 0) && (index < ArgCount())); |
93 RawObject** arg_ptr = &((*argv_)[-index]); | 93 RawObject** arg_ptr = &((*argv_)[-index]); |
94 // Tell MemorySanitizer the RawObject* was initialized (by generated code). | 94 // Tell MemorySanitizer the RawObject* was initialized (by generated code). |
95 MSAN_UNPOISON(arg_ptr, kWordSize); | 95 MSAN_UNPOISON(arg_ptr, kWordSize); |
96 return *arg_ptr; | 96 return *arg_ptr; |
97 } | 97 } |
98 | 98 |
| 99 bool IsNativeAutoSetupScope() const { |
| 100 return AutoSetupScopeBits::decode(argc_tag_); |
| 101 } |
| 102 |
99 int NativeArgCount() const { | 103 int NativeArgCount() const { |
100 int function_bits = FunctionBits::decode(argc_tag_); | 104 int function_bits = FunctionBits::decode(argc_tag_); |
101 return ArgCount() - NumHiddenArgs(function_bits); | 105 return ArgCount() - NumHiddenArgs(function_bits); |
102 } | 106 } |
103 | 107 |
104 RawObject* NativeArg0() const { | 108 RawObject* NativeArg0() const { |
105 int function_bits = FunctionBits::decode(argc_tag_); | 109 int function_bits = FunctionBits::decode(argc_tag_); |
106 if (function_bits == (kClosureFunctionBit | kInstanceFunctionBit)) { | 110 if (function_bits == (kClosureFunctionBit | kInstanceFunctionBit)) { |
107 // Retrieve the receiver from the context. | 111 // Retrieve the receiver from the context. |
108 const Object& closure = Object::Handle(ArgAt(0)); | 112 const Object& closure = Object::Handle(ArgAt(0)); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 227 |
224 Thread* thread_; // Current thread pointer. | 228 Thread* thread_; // Current thread pointer. |
225 int argc_tag_; // Encodes argument count and invoked native call type. | 229 int argc_tag_; // Encodes argument count and invoked native call type. |
226 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. | 230 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. |
227 RawObject** retval_; // Pointer to the return value area. | 231 RawObject** retval_; // Pointer to the return value area. |
228 }; | 232 }; |
229 | 233 |
230 } // namespace dart | 234 } // namespace dart |
231 | 235 |
232 #endif // VM_NATIVE_ARGUMENTS_H_ | 236 #endif // VM_NATIVE_ARGUMENTS_H_ |
OLD | NEW |