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 "vm/globals.h" | 9 #include "vm/globals.h" |
10 #include "vm/stub_code.h" | 10 #include "vm/stub_code.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 Isolate* isolate() const { return isolate_; } | 59 Isolate* isolate() const { return isolate_; } |
60 int Count() const { return argc_; } | 60 int Count() const { return argc_; } |
61 | 61 |
62 RawObject* At(int index) const { | 62 RawObject* At(int index) const { |
63 ASSERT(index >=0 && index < argc_); | 63 ASSERT(index >=0 && index < argc_); |
64 return (*argv_)[-index]; | 64 return (*argv_)[-index]; |
65 } | 65 } |
66 | 66 |
67 void SetReturn(const Object& value) const; | 67 void SetReturn(const Object& value) const; |
68 | 68 |
69 // If this function is misused, it could cause corruption. You may | |
70 // only use this if Siva says it is ok. | |
71 void SetReturnUnsafe(RawObject* value) const; | |
Ivan Posva
2012/08/27 18:20:37
Can we make this a private and do some friend magi
turnidge
2012/08/28 18:08:21
I tried it but it got a little bit involved.
In o
turnidge
2012/08/29 20:36:49
As you suggested offline, I've created a Bootstrap
| |
72 | |
69 static intptr_t isolate_offset() { | 73 static intptr_t isolate_offset() { |
70 return OFFSET_OF(NativeArguments, isolate_); | 74 return OFFSET_OF(NativeArguments, isolate_); |
71 } | 75 } |
72 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } | 76 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } |
73 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } | 77 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } |
74 static intptr_t retval_offset() { | 78 static intptr_t retval_offset() { |
75 return OFFSET_OF(NativeArguments, retval_); | 79 return OFFSET_OF(NativeArguments, retval_); |
76 } | 80 } |
77 | 81 |
78 private: | 82 private: |
79 Isolate* isolate_; // Current isolate pointer. | 83 Isolate* isolate_; // Current isolate pointer. |
80 int argc_; // Number of arguments passed to the runtime call. | 84 int argc_; // Number of arguments passed to the runtime call. |
81 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. | 85 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. |
82 RawObject** retval_; // Pointer to the return value area. | 86 RawObject** retval_; // Pointer to the return value area. |
83 }; | 87 }; |
84 | 88 |
85 } // namespace dart | 89 } // namespace dart |
86 | 90 |
87 #endif // VM_NATIVE_ARGUMENTS_H_ | 91 #endif // VM_NATIVE_ARGUMENTS_H_ |
OLD | NEW |