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 "vm/globals.h" | 10 #include "vm/globals.h" |
10 #include "vm/handles_impl.h" | 11 #include "vm/handles_impl.h" |
11 #include "vm/simulator.h" | 12 #include "vm/simulator.h" |
12 #include "vm/stub_code.h" | 13 #include "vm/stub_code.h" |
13 | 14 |
14 namespace dart { | 15 namespace dart { |
15 | 16 |
16 DECLARE_FLAG(bool, deoptimize_alot); | 17 DECLARE_FLAG(bool, deoptimize_alot); |
17 DECLARE_FLAG(bool, trace_natives); | 18 DECLARE_FLAG(bool, trace_natives); |
18 DECLARE_FLAG(bool, verify_on_transition); | 19 DECLARE_FLAG(bool, verify_on_transition); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // NOTE: Since we pass 'this' as a pass-by-value argument in the stubs we don't | 83 // NOTE: Since we pass 'this' as a pass-by-value argument in the stubs we don't |
83 // have DISALLOW_COPY_AND_ASSIGN in the class definition and do not make it a | 84 // have DISALLOW_COPY_AND_ASSIGN in the class definition and do not make it a |
84 // subclass of ValueObject. | 85 // subclass of ValueObject. |
85 class NativeArguments { | 86 class NativeArguments { |
86 public: | 87 public: |
87 Isolate* isolate() const { return isolate_; } | 88 Isolate* isolate() const { return isolate_; } |
88 int ArgCount() const { return ArgcBits::decode(argc_tag_); } | 89 int ArgCount() const { return ArgcBits::decode(argc_tag_); } |
89 | 90 |
90 RawObject* ArgAt(int index) const { | 91 RawObject* ArgAt(int index) const { |
91 ASSERT((index >= 0) && (index < ArgCount())); | 92 ASSERT((index >= 0) && (index < ArgCount())); |
92 return (*argv_)[-index]; | 93 RawObject** arg_ptr = &((*argv_)[-index]); |
| 94 // Tell MemorySanitizer the RawObject* was initialized (by generated code). |
| 95 MSAN_UNPOISON(arg_ptr, kWordSize); |
| 96 return *arg_ptr; |
93 } | 97 } |
94 | 98 |
95 int NativeArgCount() const { | 99 int NativeArgCount() const { |
96 int function_bits = FunctionBits::decode(argc_tag_); | 100 int function_bits = FunctionBits::decode(argc_tag_); |
97 return ArgCount() - NumHiddenArgs(function_bits); | 101 return ArgCount() - NumHiddenArgs(function_bits); |
98 } | 102 } |
99 | 103 |
100 RawObject* NativeArg0() const { | 104 RawObject* NativeArg0() const { |
101 int function_bits = FunctionBits::decode(argc_tag_); | 105 int function_bits = FunctionBits::decode(argc_tag_); |
102 if (function_bits == (kClosureFunctionBit | kInstanceFunctionBit)) { | 106 if (function_bits == (kClosureFunctionBit | kInstanceFunctionBit)) { |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 | 223 |
220 Isolate* isolate_; // Current isolate pointer. | 224 Isolate* isolate_; // Current isolate pointer. |
221 int argc_tag_; // Encodes argument count and invoked native call type. | 225 int argc_tag_; // Encodes argument count and invoked native call type. |
222 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. | 226 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. |
223 RawObject** retval_; // Pointer to the return value area. | 227 RawObject** retval_; // Pointer to the return value area. |
224 }; | 228 }; |
225 | 229 |
226 } // namespace dart | 230 } // namespace dart |
227 | 231 |
228 #endif // VM_NATIVE_ARGUMENTS_H_ | 232 #endif // VM_NATIVE_ARGUMENTS_H_ |
OLD | NEW |