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

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

Issue 549079: Support for MIPS in architecture independent files.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 11 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-2008 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 | 1 << 20 | 1 << 21 | 1 << 22 | 1 << 23 |
59 // gp, sp, fp
60 1 << 28 | 1 << 29 | 1 << 30;
61
62 static const int kNumCalleeSaved = 11;
63
64
65 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved];
66
67
68 // ----------------------------------------------------
69
70 class StackHandlerConstants : public AllStatic {
71 public:
72 static const int kNextOffset = 0 * kPointerSize;
73 static const int kStateOffset = 1 * kPointerSize;
74 static const int kFPOffset = 2 * kPointerSize;
75 static const int kPCOffset = 3 * kPointerSize;
76
77 static const int kSize = kPCOffset + kPointerSize;
78 };
79
80
81 class EntryFrameConstants : public AllStatic {
82 public:
83 static const int kCallerFPOffset = -3 * kPointerSize;
84 };
85
86
87 class ExitFrameConstants : public AllStatic {
88 public:
89 // Exit frames have a debug marker on the stack.
90 static const int kSPDisplacement = -1 * kPointerSize;
91
92 // The debug marker is just above the frame pointer.
93 static const int kDebugMarkOffset = -1 * kPointerSize;
94 // Must be the same as kDebugMarkOffset. Alias introduced when upgrading.
95 static const int kCodeOffset = -1 * kPointerSize;
96
97 static const int kSavedRegistersOffset = 0 * kPointerSize;
98
99 // The caller fields are below the frame pointer on the stack.
100 static const int kCallerFPOffset = +0 * kPointerSize;
101 // The calling JS function is between FP and PC.
102 static const int kCallerPCOffset = +1 * kPointerSize;
103
104 // FP-relative displacement of the caller's SP.
105 static const int kCallerSPDisplacement = +4 * kPointerSize;
106 };
107
108
109 class StandardFrameConstants : public AllStatic {
110 public:
111 static const int kExpressionsOffset = -3 * kPointerSize;
112 static const int kMarkerOffset = -2 * kPointerSize;
113 static const int kContextOffset = -1 * kPointerSize;
114 static const int kCallerFPOffset = 0 * kPointerSize;
115 static const int kCallerPCOffset = +1 * kPointerSize;
116 static const int kCallerSPOffset = +2 * kPointerSize;
117
118 // Size of the MIPS 4 32-bit argument slots.
119 // This is just an alias with a shorter name. Use it from now on.
120 static const int kRArgsSlotsSize = 4 * kPointerSize;
121 static const int kRegularArgsSlotsSize = kRArgsSlotsSize;
122
123 // C/C++ argument slots size
124 static const int kCArgsSlotsSize = 4 * kPointerSize;
125 // JS argument slots size
126 static const int kJSArgsSlotsSize = 0 * kPointerSize;
127 };
128
129
130 class JavaScriptFrameConstants : public AllStatic {
131 public:
132 // FP-relative.
133 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset;
134 static const int kSavedRegistersOffset = +2 * kPointerSize;
135 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset;
136
137 // Caller SP-relative.
138 static const int kParam0Offset = -2 * kPointerSize;
139 static const int kReceiverOffset = -1 * kPointerSize;
140 };
141
142
143 class ArgumentsAdaptorFrameConstants : public AllStatic {
144 public:
145 static const int kLengthOffset = StandardFrameConstants::kExpressionsOffset;
146 };
147
148
149 class InternalFrameConstants : public AllStatic {
150 public:
151 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset;
152 };
153
154
155 inline Object* JavaScriptFrame::function_slot_object() const {
156 const int offset = JavaScriptFrameConstants::kFunctionOffset;
157 return Memory::Object_at(fp() + offset);
158 }
159
160 } } // namespace v8::internal
161
162 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698