OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 21 matching lines...) Expand all Loading... |
33 | 33 |
34 namespace v8 { | 34 namespace v8 { |
35 namespace internal { | 35 namespace internal { |
36 | 36 |
37 // Register lists. | 37 // Register lists. |
38 // Note that the bit values must match those used in actual instruction | 38 // Note that the bit values must match those used in actual instruction |
39 // encoding. | 39 // encoding. |
40 static const int kNumRegs = 32; | 40 static const int kNumRegs = 32; |
41 | 41 |
42 static const RegList kJSCallerSaved = | 42 static const RegList kJSCallerSaved = |
| 43 1 << 2 | // v0 |
43 1 << 4 | // a0 | 44 1 << 4 | // a0 |
44 1 << 5 | // a1 | 45 1 << 5 | // a1 |
45 1 << 6 | // a2 | 46 1 << 6 | // a2 |
46 1 << 7; // a3 | 47 1 << 7; // a3 |
47 | 48 |
48 static const int kNumJSCallerSaved = 4; | 49 static const int kNumJSCallerSaved = 5; |
49 | 50 |
50 | 51 |
51 // Return the code of the n-th caller-saved register available to JavaScript | 52 // Return the code of the n-th caller-saved register available to JavaScript |
52 // e.g. JSCallerSavedReg(0) returns r0.code() == 0. | 53 // e.g. JSCallerSavedReg(0) returns a0.code() == 4. |
53 int JSCallerSavedCode(int n); | 54 int JSCallerSavedCode(int n); |
54 | 55 |
55 | 56 |
56 // Callee-saved registers preserved when switching from C to JavaScript. | 57 // Callee-saved registers preserved when switching from C to JavaScript. |
57 static const RegList kCalleeSaved = | 58 static const RegList kCalleeSaved = |
58 // Saved temporaries. | 59 // Saved temporaries. |
59 1 << 16 | 1 << 17 | 1 << 18 | 1 << 19 | | 60 1 << 16 | 1 << 17 | 1 << 18 | 1 << 19 | |
60 1 << 20 | 1 << 21 | 1 << 22 | 1 << 23 | | 61 1 << 20 | 1 << 21 | 1 << 22 | 1 << 23 | |
61 // gp, sp, fp | 62 // gp, sp, fp |
62 1 << 28 | 1 << 29 | 1 << 30; | 63 1 << 28 | 1 << 29 | 1 << 30; |
63 | 64 |
64 static const int kNumCalleeSaved = 11; | 65 static const int kNumCalleeSaved = 11; |
65 | 66 |
66 | 67 |
| 68 // Number of registers for which space is reserved in safepoints. Must be a |
| 69 // multiple of 8. |
| 70 // TODO(mips): Only 8 registers may actually be sufficient. Revisit. |
| 71 static const int kNumSafepointRegisters = 16; |
| 72 |
| 73 // Define the list of registers actually saved at safepoints. |
| 74 // Note that the number of saved registers may be smaller than the reserved |
| 75 // space, i.e. kNumSafepointSavedRegisters <= kNumSafepointRegisters. |
| 76 static const RegList kSafepointSavedRegisters = kJSCallerSaved | kCalleeSaved; |
| 77 static const int kNumSafepointSavedRegisters = |
| 78 kNumJSCallerSaved + kNumCalleeSaved; |
| 79 |
67 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; | 80 typedef Object* JSCallerSavedBuffer[kNumJSCallerSaved]; |
68 | 81 |
69 | 82 |
70 // ---------------------------------------------------- | 83 // ---------------------------------------------------- |
71 | 84 |
72 class StackHandlerConstants : public AllStatic { | 85 class StackHandlerConstants : public AllStatic { |
73 public: | 86 public: |
74 static const int kNextOffset = 0 * kPointerSize; | 87 static const int kNextOffset = 0 * kPointerSize; |
75 static const int kStateOffset = 1 * kPointerSize; | 88 static const int kStateOffset = 1 * kPointerSize; |
76 static const int kFPOffset = 2 * kPointerSize; | 89 static const int kFPOffset = 2 * kPointerSize; |
77 static const int kPCOffset = 3 * kPointerSize; | 90 static const int kPCOffset = 3 * kPointerSize; |
78 | 91 |
79 static const int kSize = kPCOffset + kPointerSize; | 92 static const int kSize = kPCOffset + kPointerSize; |
80 }; | 93 }; |
81 | 94 |
82 | 95 |
83 class EntryFrameConstants : public AllStatic { | 96 class EntryFrameConstants : public AllStatic { |
84 public: | 97 public: |
85 static const int kCallerFPOffset = -3 * kPointerSize; | 98 static const int kCallerFPOffset = -3 * kPointerSize; |
86 }; | 99 }; |
87 | 100 |
88 | 101 |
89 class ExitFrameConstants : public AllStatic { | 102 class ExitFrameConstants : public AllStatic { |
90 public: | 103 public: |
91 // Exit frames have a debug marker on the stack. | |
92 static const int kSPDisplacement = -1 * kPointerSize; | |
93 | |
94 // The debug marker is just above the frame pointer. | |
95 static const int kDebugMarkOffset = -1 * kPointerSize; | 104 static const int kDebugMarkOffset = -1 * kPointerSize; |
96 // Must be the same as kDebugMarkOffset. Alias introduced when upgrading. | 105 // Must be the same as kDebugMarkOffset. Alias introduced when upgrading. |
97 static const int kCodeOffset = -1 * kPointerSize; | 106 static const int kCodeOffset = -1 * kPointerSize; |
| 107 static const int kSPOffset = -1 * kPointerSize; |
98 | 108 |
99 static const int kSavedRegistersOffset = 0 * kPointerSize; | 109 // TODO(mips): Use a patched sp value on the stack instead. |
| 110 // A marker of 0 indicates that double registers are saved. |
| 111 static const int kMarkerOffset = -2 * kPointerSize; |
100 | 112 |
101 // The caller fields are below the frame pointer on the stack. | 113 // The caller fields are below the frame pointer on the stack. |
102 static const int kCallerFPOffset = +0 * kPointerSize; | 114 static const int kCallerFPOffset = +0 * kPointerSize; |
103 // The calling JS function is between FP and PC. | 115 // The calling JS function is between FP and PC. |
104 static const int kCallerPCOffset = +1 * kPointerSize; | 116 static const int kCallerPCOffset = +1 * kPointerSize; |
105 | 117 |
106 // FP-relative displacement of the caller's SP. | 118 // FP-relative displacement of the caller's SP. |
107 static const int kCallerSPDisplacement = +3 * kPointerSize; | 119 static const int kCallerSPDisplacement = +3 * kPointerSize; |
108 }; | 120 }; |
109 | 121 |
110 | 122 |
111 class StandardFrameConstants : public AllStatic { | 123 class StandardFrameConstants : public AllStatic { |
112 public: | 124 public: |
113 static const int kExpressionsOffset = -3 * kPointerSize; | 125 static const int kExpressionsOffset = -3 * kPointerSize; |
114 static const int kMarkerOffset = -2 * kPointerSize; | 126 static const int kMarkerOffset = -2 * kPointerSize; |
115 static const int kContextOffset = -1 * kPointerSize; | 127 static const int kContextOffset = -1 * kPointerSize; |
116 static const int kCallerFPOffset = 0 * kPointerSize; | 128 static const int kCallerFPOffset = 0 * kPointerSize; |
117 static const int kCallerPCOffset = +1 * kPointerSize; | 129 static const int kCallerPCOffset = +1 * kPointerSize; |
118 static const int kCallerSPOffset = +2 * kPointerSize; | 130 static const int kCallerSPOffset = +2 * kPointerSize; |
119 | 131 |
120 // Size of the MIPS 4 32-bit argument slots. | 132 // Size of the MIPS 4 32-bit argument slots. |
121 // This is just an alias with a shorter name. Use it from now on. | 133 // This is just an alias with a shorter name. Use it from now on. |
122 static const int kRArgsSlotsSize = 4 * kPointerSize; | 134 static const int kRArgsSlotsSize = 4 * kPointerSize; |
123 static const int kRegularArgsSlotsSize = kRArgsSlotsSize; | 135 static const int kRegularArgsSlotsSize = kRArgsSlotsSize; |
124 | 136 |
125 // C/C++ argument slots size. | 137 // C/C++ argument slots size. |
126 static const int kCArgsSlotsSize = 4 * kPointerSize; | 138 static const int kCArgsSlotsSize = 4 * kPointerSize; |
127 // JS argument slots size. | 139 // JS argument slots size. |
128 static const int kJSArgsSlotsSize = 0 * kPointerSize; | 140 static const int kJSArgsSlotsSize = 0 * kPointerSize; |
| 141 // Assembly builtins argument slots size. |
| 142 static const int kBArgsSlotsSize = 0 * kPointerSize; |
129 }; | 143 }; |
130 | 144 |
131 | 145 |
132 class JavaScriptFrameConstants : public AllStatic { | 146 class JavaScriptFrameConstants : public AllStatic { |
133 public: | 147 public: |
134 // FP-relative. | 148 // FP-relative. |
135 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; | 149 static const int kLocal0Offset = StandardFrameConstants::kExpressionsOffset; |
136 static const int kSavedRegistersOffset = +2 * kPointerSize; | 150 static const int kSavedRegistersOffset = +2 * kPointerSize; |
137 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; | 151 static const int kFunctionOffset = StandardFrameConstants::kMarkerOffset; |
138 | 152 |
(...skipping 13 matching lines...) Expand all Loading... |
152 public: | 166 public: |
153 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; | 167 static const int kCodeOffset = StandardFrameConstants::kExpressionsOffset; |
154 }; | 168 }; |
155 | 169 |
156 | 170 |
157 inline Object* JavaScriptFrame::function_slot_object() const { | 171 inline Object* JavaScriptFrame::function_slot_object() const { |
158 const int offset = JavaScriptFrameConstants::kFunctionOffset; | 172 const int offset = JavaScriptFrameConstants::kFunctionOffset; |
159 return Memory::Object_at(fp() + offset); | 173 return Memory::Object_at(fp() + offset); |
160 } | 174 } |
161 | 175 |
| 176 |
162 } } // namespace v8::internal | 177 } } // namespace v8::internal |
163 | 178 |
164 #endif | 179 #endif |
OLD | NEW |