Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(211)

Side by Side Diff: vm/native_arguments.h

Issue 10907012: Use SetReturnUnsafe in dart_api_impl.cc. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \ 32 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \
33 } 33 }
34 #endif 34 #endif
35 35
36 #else 36 #else
37 37
38 #define CHECK_STACK_ALIGNMENT { } 38 #define CHECK_STACK_ALIGNMENT { }
39 39
40 #endif 40 #endif
41 41
42 DART_EXTERN_C {
43 void Dart_SetReturnValue(Dart_NativeArguments, Dart_Handle);
44 }
42 45
43 // Class NativeArguments is used to access arguments passed in from 46 // Class NativeArguments is used to access arguments passed in from
44 // generated dart code to a runtime function or a dart library native 47 // generated dart code to a runtime function or a dart library native
45 // function. It is also used to set the return value if any at the slot 48 // function. It is also used to set the return value if any at the slot
46 // reserved for return values. 49 // reserved for return values.
47 // All runtime function/dart library native functions have the 50 // All runtime function/dart library native functions have the
48 // following signature: 51 // following signature:
49 // void function_name(NativeArguments arguments); 52 // void function_name(NativeArguments arguments);
50 // Inside the function, arguments are accessed as follows: 53 // Inside the function, arguments are accessed as follows:
51 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0)); 54 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0));
(...skipping 19 matching lines...) Expand all
71 return OFFSET_OF(NativeArguments, isolate_); 74 return OFFSET_OF(NativeArguments, isolate_);
72 } 75 }
73 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } 76 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); }
74 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } 77 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); }
75 static intptr_t retval_offset() { 78 static intptr_t retval_offset() {
76 return OFFSET_OF(NativeArguments, retval_); 79 return OFFSET_OF(NativeArguments, retval_);
77 } 80 }
78 81
79 private: 82 private:
80 friend class BootstrapNatives; 83 friend class BootstrapNatives;
84 friend void Dart_SetReturnValue(Dart_NativeArguments, Dart_Handle);
81 85
82 // Since this function is passed a RawObject directly, we need to be 86 // Since this function is passed a RawObject directly, we need to be
83 // exceedingly careful when we use it. If there are any other side 87 // exceedingly careful when we use it. If there are any other side
84 // effects in the statement that may cause GC, it could lead to 88 // effects in the statement that may cause GC, it could lead to
85 // bugs. 89 // bugs.
86 void SetReturnUnsafe(RawObject* value) const; 90 void SetReturnUnsafe(RawObject* value) const;
87 91
88 Isolate* isolate_; // Current isolate pointer. 92 Isolate* isolate_; // Current isolate pointer.
89 int argc_; // Number of arguments passed to the runtime call. 93 int argc_; // Number of arguments passed to the runtime call.
90 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. 94 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call.
91 RawObject** retval_; // Pointer to the return value area. 95 RawObject** retval_; // Pointer to the return value area.
92 }; 96 };
93 97
94 } // namespace dart 98 } // namespace dart
95 99
96 #endif // VM_NATIVE_ARGUMENTS_H_ 100 #endif // VM_NATIVE_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « vm/dart_api_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698