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

Side by Side Diff: src/mips/frames-mips.h

Issue 543161: Added support for MIPS in architecture independent files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 10 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
(Empty)
1 // Copyright 2006-2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
28
29
30 #ifndef V8_MIPS_FRAMES_MIPS_H_
31 #define V8_MIPS_FRAMES_MIPS_H_
32
33
34 namespace v8 {
35 namespace internal {
36
37 // Register lists
38 // Note that the bit values must match those used in actual instruction encoding
39 static const int kNumRegs = 32;
40
41 static const RegList kJSCallerSaved =
42 1 << 4 | // a0
43 1 << 5 | // a1
44 1 << 6 | // a2
45 1 << 7; // a3
46
47 static const int kNumJSCallerSaved = 4;
48
49
50 // Return the code of the n-th caller-saved register available to JavaScript
51 // e.g. JSCallerSavedReg(0) returns r0.code() == 0
52 int JSCallerSavedCode(int n);
53
54
55 // Callee-saved registers preserved when switching from C to JavaScript
56 static const RegList kCalleeSaved =
57 // Saved temporaries
58 1 << 16 | 1 << 17 | 1 << 18 | 1 << 19 |
59 1 << 20 | 1 << 21 | 1 << 22 | 1 << 23 |
60 // gp, sp, fp
61 1 << 28 | 1 << 29 | 1 << 30;
62
63 static const int kNumCalleeSaved = 11;
64
65
66 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
67
68
69 // ----------------------------------------------------
70
71 class StackHandlerConstants : public AllStatic {
72 public:
73 static const int kNextOffset = 0 * kPointerSize;
74 static const int kStateOffset = 1 * kPointerSize;
75 static const int kFPOffset = 2 * kPointerSize;
76 static const int kPCOffset = 3 * kPointerSize;
77
78 static const int kSize = kPCOffset + kPointerSize;
79 };
80
81
82 class EntryFrameConstants : public AllStatic {
83 public:
84 static const int kCallerFPOffset = -3 * kPointerSize;
85 };
86
87
88 class ExitFrameConstants : public AllStatic {
89 public:
90 // Exit frames have a debug marker on the stack.
91 static const int kSPDisplacement = -1 * kPointerSize;
92
93 // The debug marker is just above the frame pointer.
94 static const int kDebugMarkOffset = -1 * kPointerSize;
95 // Must be the same as kDebugMarkOffset. Alias introduced when upgrading.
96 static const int kCodeOffset = -1 * kPointerSize;
97
98 static const int kSavedRegistersOffset = 0 * kPointerSize;
99
100 // The caller fields are below the frame pointer on the stack.
101 static const int kCallerFPOffset = +0 * kPointerSize;
102 // The calling JS function is between FP and PC.
103 static const int kCallerPCOffset = +1 * kPointerSize;
104
105 // FP-relative displacement of the caller's SP.
106 static const int kCallerSPDisplacement = +4 * kPointerSize;
107 };
108
109
110 class StandardFrameConstants : public AllStatic {
111 public:
112 static const int kExpressionsOffset = -3 * kPointerSize;
113 static const int kMarkerOffset = -2 * kPointerSize;
114 static const int kContextOffset = -1 * kPointerSize;
115 static const int kCallerFPOffset = 0 * kPointerSize;
116 static const int kCallerPCOffset = +1 * kPointerSize;
117 static const int kCallerSPOffset = +2 * kPointerSize;
118
119 // Size of the MIPS 4 32-bit argument slots.
120 // This is just an alias with a shorter name. Use it from now on.
121 static const int kRArgsSlotsSize = 4 * kPointerSize;
122 static const int kRegularArgsSlotsSize = kRArgsSlotsSize;
123
124 // C/C++ argument slots size
125 static const int kCArgsSlotsSize = 4 * kPointerSize;
126 // JS argument slots size
127 static const int kJSArgsSlotsSize = 0 * kPointerSize;
128 };
129
130
131 class JavaScriptFrameConstants : public AllStatic {
132 public:
133 // FP-relative.
134 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
135 static const int kSavedRegistersOffset = +2 * kPointerSize;
136 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
137
138 // Caller SP-relative.
139 static const int kParam0Offset = -2 * kPointerSize;
140 static const int kReceiverOffset = -1 * kPointerSize;
141 };
142
143
144 class ArgumentsAdaptorFrameConstants : public AllStatic {
145 public:
146 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
147 };
148
149
150 class InternalFrameConstants : public AllStatic {
151 public:
152 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
153 };
154
155
156 inline Object* JavaScriptFrame::function_slot_object() const {
157 const int offset = JavaScriptFrameConstants::kFunctionOffset;
158 return Memory::Object_at(fp() + offset);
159 }
160
161 } } // namespace v8::internal
162
163 #endif
164
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698