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

Side by Side Diff: vm/native_arguments.h

Issue 10664004: Fix issue 1968, replace usage of inline 'asm' constructs in 'stack alignment', 'jump to exception h… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 5 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/exceptions.cc ('k') | vm/os.h » ('j') | 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 11
11 namespace dart { 12 namespace dart {
12 13
13 // Forward declarations. 14 // Forward declarations.
14 class Isolate; 15 class Isolate;
15 class Object; 16 class Object;
16 class RawObject; 17 class RawObject;
17 18
18 19
20 #if defined(TESTING) || defined(DEBUG)
21
22 #if defined(TARGET_OS_WINDOWS)
23 // The compiler may dynamically align the stack on Windows, so do not check.
24 #define CHECK_STACK_ALIGNMENT { }
25 #else
26 #define CHECK_STACK_ALIGNMENT { \
27 uword (*func)() = \
28 reinterpret_cast<uword (*)()>(StubCode::GetStackPointerEntryPoint()); \
29 uword current_sp = func(); \
30 ASSERT((OS::ActivationFrameAlignment() == 0) || \
31 (Utils::IsAligned(current_sp, OS::ActivationFrameAlignment()))); \
32 }
33 #endif
34
35 #else
36
37 #define CHECK_STACK_ALIGNMENT { }
38
39 #endif
40
41
19 // Class NativeArguments is used to access arguments passed in from 42 // Class NativeArguments is used to access arguments passed in from
20 // generated dart code to a runtime function or a dart library native 43 // generated dart code to a runtime function or a dart library native
21 // function. It is also used to set the return value if any at the slot 44 // function. It is also used to set the return value if any at the slot
22 // reserved for return values. 45 // reserved for return values.
23 // All runtime function/dart library native functions have the 46 // All runtime function/dart library native functions have the
24 // following signature: 47 // following signature:
25 // void function_name(NativeArguments arguments); 48 // void function_name(NativeArguments arguments);
26 // Inside the function, arguments are accessed as follows: 49 // Inside the function, arguments are accessed as follows:
27 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0)); 50 // const Type& arg1 = Type::CheckedHandle(arguments.GetArgument(0));
28 // const Type& arg2 = Type::CheckedHandle(arguments.GetArgument(1)); 51 // const Type& arg2 = Type::CheckedHandle(arguments.GetArgument(1));
(...skipping 26 matching lines...) Expand all
55 private: 78 private:
56 Isolate* isolate_; // Current isolate pointer. 79 Isolate* isolate_; // Current isolate pointer.
57 int argc_; // Number of arguments passed to the runtime call. 80 int argc_; // Number of arguments passed to the runtime call.
58 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call. 81 RawObject*(*argv_)[]; // Pointer to an array of arguments to runtime call.
59 RawObject** retval_; // Pointer to the return value area. 82 RawObject** retval_; // Pointer to the return value area.
60 }; 83 };
61 84
62 } // namespace dart 85 } // namespace dart
63 86
64 #endif // VM_NATIVE_ARGUMENTS_H_ 87 #endif // VM_NATIVE_ARGUMENTS_H_
OLDNEW
« no previous file with comments | « vm/exceptions.cc ('k') | vm/os.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698