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

Side by Side Diff: vm/native_arguments.h

Issue 10874072: Use the return value of vm native methods to set the return value, (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
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"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // Forward declarations. 14 // Forward declarations.
15 class BootstrapNatives;
15 class Isolate; 16 class Isolate;
16 class Object; 17 class Object;
17 class RawObject; 18 class RawObject;
18 19
19 20
20 #if defined(TESTING) || defined(DEBUG) 21 #if defined(TESTING) || defined(DEBUG)
21 22
22 #if defined(TARGET_OS_WINDOWS) 23 #if defined(TARGET_OS_WINDOWS)
23 // The compiler may dynamically align the stack on Windows, so do not check. 24 // The compiler may dynamically align the stack on Windows, so do not check.
24 #define CHECK_STACK_ALIGNMENT { } 25 #define CHECK_STACK_ALIGNMENT { }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 static intptr_t isolate_offset() { 70 static intptr_t isolate_offset() {
70 return OFFSET_OF(NativeArguments, isolate_); 71 return OFFSET_OF(NativeArguments, isolate_);
71 } 72 }
72 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); } 73 static intptr_t argc_offset() { return OFFSET_OF(NativeArguments, argc_); }
73 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); } 74 static intptr_t argv_offset() { return OFFSET_OF(NativeArguments, argv_); }
74 static intptr_t retval_offset() { 75 static intptr_t retval_offset() {
75 return OFFSET_OF(NativeArguments, retval_); 76 return OFFSET_OF(NativeArguments, retval_);
76 } 77 }
77 78
78 private: 79 private:
80 friend class BootstrapNatives;
81
82 // 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
84 // effects in the statement that may cause GC, it could lead to
85 // bugs.
86 void SetReturnUnsafe(RawObject* value) const;
87
79 Isolate* isolate_; // Current isolate pointer. 88 Isolate* isolate_; // Current isolate pointer.
80 int argc_; // Number of arguments passed to the runtime call. 89 int argc_; // Number of arguments passed to the runtime call.
81 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. 90 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call.
82 RawObject** retval_; // Pointer to the return value area. 91 RawObject** retval_; // Pointer to the return value area.
83 }; 92 };
84 93
85 } // namespace dart 94 } // namespace dart
86 95
87 #endif // VM_NATIVE_ARGUMENTS_H_ 96 #endif // VM_NATIVE_ARGUMENTS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698