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

Side by Side Diff: runtime/vm/native_arguments.h

Issue 11442010: Introduce a class encapsulating arguments descriptor arrays. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Incorporated review comments. Created 8 years 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
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 43
44 44
45 // Class NativeArguments is used to access arguments passed in from 45 // Class NativeArguments is used to access arguments passed in from
46 // generated dart code to a runtime function or a dart library native 46 // generated dart code to a runtime function or a dart library native
47 // function. It is also used to set the return value if any at the slot 47 // function. It is also used to set the return value if any at the slot
48 // reserved for return values. 48 // reserved for return values.
49 // All runtime function/dart library native functions have the 49 // All runtime function/dart library native functions have the
50 // following signature: 50 // following signature:
51 // void function_name(NativeArguments arguments); 51 // void function_name(NativeArguments arguments);
52 // Inside the function, arguments are accessed as follows: 52 // Inside the function, arguments are accessed as follows:
53 // const Instance& arg0 = Instance::CheckedHandle(arguments.At(0)); 53 // const Instance& arg0 = Instance::CheckedHandle(arguments.ArgAt(0));
54 // const Smi& arg1 = Smi::CheckedHandle(arguments.At(1)); 54 // const Smi& arg1 = Smi::CheckedHandle(arguments.ArgAt(1));
55 // The return value is set as follows: 55 // The return value is set as follows:
56 // arguments.SetReturn(result); 56 // arguments.SetReturn(result);
57 // NOTE: Since we pass 'this' as a pass-by-value argument in the stubs we don't 57 // NOTE: Since we pass 'this' as a pass-by-value argument in the stubs we don't
58 // have DISALLOW_COPY_AND_ASSIGN in the class definition and do not make it a 58 // have DISALLOW_COPY_AND_ASSIGN in the class definition and do not make it a
59 // subclass of ValueObject. 59 // subclass of ValueObject.
60 class NativeArguments { 60 class NativeArguments {
61 public: 61 public:
62 Isolate* isolate() const { return isolate_; } 62 Isolate* isolate() const { return isolate_; }
63 int ArgCount() const { return ArgcBits::decode(argc_tag_); } 63 int ArgCount() const { return ArgcBits::decode(argc_tag_); }
64 64
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 161
162 Isolate* isolate_; // Current isolate pointer. 162 Isolate* isolate_; // Current isolate pointer.
163 int argc_tag_; // Encodes argument count and invoked native call type. 163 int argc_tag_; // Encodes argument count and invoked native call type.
164 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. 164 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call.
165 RawObject** retval_; // Pointer to the return value area. 165 RawObject** retval_; // Pointer to the return value area.
166 }; 166 };
167 167
168 } // namespace dart 168 } // namespace dart
169 169
170 #endif // VM_NATIVE_ARGUMENTS_H_ 170 #endif // VM_NATIVE_ARGUMENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698