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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
100 // architectures. | 100 // architectures. |
101 RawObject** arg_ptr = &(argv_[index]); | 101 RawObject** arg_ptr = &(argv_[index]); |
102 #else | 102 #else |
103 RawObject** arg_ptr = &(argv_[-index]); | 103 RawObject** arg_ptr = &(argv_[-index]); |
104 #endif | 104 #endif |
105 // Tell MemorySanitizer the RawObject* was initialized (by generated code). | 105 // Tell MemorySanitizer the RawObject* was initialized (by generated code). |
106 MSAN_UNPOISON(arg_ptr, kWordSize); | 106 MSAN_UNPOISON(arg_ptr, kWordSize); |
107 return *arg_ptr; | 107 return *arg_ptr; |
108 } | 108 } |
109 | 109 |
110 void SetArgAt(int index, const Object& value) const { | |
111 ASSERT((index >= 0) && (index < ArgCount())); | |
112 #if defined(TARGET_ARCH_DBC) | |
113 // On DBC stack is growing upwards, in reverse direction from all other | |
114 // architectures. | |
115 RawObject** arg_ptr = &(argv_[index]); | |
Florian Schneider
2016/08/10 02:32:14
Since this is not used on DBC, maybe rather make i
rmacnak
2016/08/11 00:17:49
Remove altogether after removing monomorphic case
| |
116 #else | |
117 RawObject** arg_ptr = &(argv_[-index]); | |
118 #endif | |
119 *arg_ptr = value.raw(); | |
120 } | |
121 | |
110 bool IsNativeAutoSetupScope() const { | 122 bool IsNativeAutoSetupScope() const { |
111 return AutoSetupScopeBits::decode(argc_tag_); | 123 return AutoSetupScopeBits::decode(argc_tag_); |
112 } | 124 } |
113 | 125 |
114 int NativeArgCount() const { | 126 int NativeArgCount() const { |
115 int function_bits = FunctionBits::decode(argc_tag_); | 127 int function_bits = FunctionBits::decode(argc_tag_); |
116 return ArgCount() - NumHiddenArgs(function_bits); | 128 return ArgCount() - NumHiddenArgs(function_bits); |
117 } | 129 } |
118 | 130 |
119 RawObject* NativeArg0() const { | 131 RawObject* NativeArg0() const { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 | 266 |
255 Thread* thread_; // Current thread pointer. | 267 Thread* thread_; // Current thread pointer. |
256 intptr_t argc_tag_; // Encodes argument count and invoked native call type. | 268 intptr_t argc_tag_; // Encodes argument count and invoked native call type. |
257 RawObject** argv_; // Pointer to an array of arguments to runtime call. | 269 RawObject** argv_; // Pointer to an array of arguments to runtime call. |
258 RawObject** retval_; // Pointer to the return value area. | 270 RawObject** retval_; // Pointer to the return value area. |
259 }; | 271 }; |
260 | 272 |
261 } // namespace dart | 273 } // namespace dart |
262 | 274 |
263 #endif // VM_NATIVE_ARGUMENTS_H_ | 275 #endif // VM_NATIVE_ARGUMENTS_H_ |
OLD | NEW |