OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
11 #include "src/codegen.h" | 11 #include "src/codegen.h" |
12 #include "src/regexp-macro-assembler.h" | 12 #include "src/regexp-macro-assembler.h" |
13 #include "src/stub-cache.h" | 13 #include "src/stub-cache.h" |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 | 18 |
19 void FastNewClosureStub::InitializeInterfaceDescriptor( | 19 void FastNewClosureStub::InitializeInterfaceDescriptor( |
20 CodeStubInterfaceDescriptor* descriptor) { | 20 CodeStubInterfaceDescriptor* descriptor) { |
21 Register registers[] = { cp, a2 }; | 21 Register registers[] = { cp, a2 }; |
22 descriptor->Initialize( | 22 descriptor->Initialize( |
23 ARRAY_SIZE(registers), registers, | 23 MajorKey(), ARRAY_SIZE(registers), registers, |
24 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); | 24 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); |
25 } | 25 } |
26 | 26 |
27 | 27 |
28 void FastNewContextStub::InitializeInterfaceDescriptor( | 28 void FastNewContextStub::InitializeInterfaceDescriptor( |
29 CodeStubInterfaceDescriptor* descriptor) { | 29 CodeStubInterfaceDescriptor* descriptor) { |
30 Register registers[] = { cp, a1 }; | 30 Register registers[] = { cp, a1 }; |
31 descriptor->Initialize(ARRAY_SIZE(registers), registers); | 31 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
32 } | 32 } |
33 | 33 |
34 | 34 |
35 void ToNumberStub::InitializeInterfaceDescriptor( | 35 void ToNumberStub::InitializeInterfaceDescriptor( |
36 CodeStubInterfaceDescriptor* descriptor) { | 36 CodeStubInterfaceDescriptor* descriptor) { |
37 Register registers[] = { cp, a0 }; | 37 Register registers[] = { cp, a0 }; |
38 descriptor->Initialize(ARRAY_SIZE(registers), registers); | 38 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
39 } | 39 } |
40 | 40 |
41 | 41 |
42 void NumberToStringStub::InitializeInterfaceDescriptor( | 42 void NumberToStringStub::InitializeInterfaceDescriptor( |
43 CodeStubInterfaceDescriptor* descriptor) { | 43 CodeStubInterfaceDescriptor* descriptor) { |
44 Register registers[] = { cp, a0 }; | 44 Register registers[] = { cp, a0 }; |
45 descriptor->Initialize( | 45 descriptor->Initialize( |
46 ARRAY_SIZE(registers), registers, | 46 MajorKey(), ARRAY_SIZE(registers), registers, |
47 Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry); | 47 Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | 51 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( |
52 CodeStubInterfaceDescriptor* descriptor) { | 52 CodeStubInterfaceDescriptor* descriptor) { |
53 Register registers[] = { cp, a3, a2, a1 }; | 53 Register registers[] = { cp, a3, a2, a1 }; |
54 Representation representations[] = { | 54 Representation representations[] = { |
55 Representation::Tagged(), | 55 Representation::Tagged(), |
56 Representation::Tagged(), | 56 Representation::Tagged(), |
57 Representation::Smi(), | 57 Representation::Smi(), |
58 Representation::Tagged() }; | 58 Representation::Tagged() }; |
59 descriptor->Initialize( | 59 descriptor->Initialize( |
60 ARRAY_SIZE(registers), registers, | 60 MajorKey(), ARRAY_SIZE(registers), registers, |
61 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry, | 61 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry, |
62 representations); | 62 representations); |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( | 66 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( |
67 CodeStubInterfaceDescriptor* descriptor) { | 67 CodeStubInterfaceDescriptor* descriptor) { |
68 Register registers[] = { cp, a3, a2, a1, a0 }; | 68 Register registers[] = { cp, a3, a2, a1, a0 }; |
69 descriptor->Initialize( | 69 descriptor->Initialize( |
70 ARRAY_SIZE(registers), registers, | 70 MajorKey(), ARRAY_SIZE(registers), registers, |
71 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); | 71 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); |
72 } | 72 } |
73 | 73 |
74 | 74 |
75 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | 75 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( |
76 CodeStubInterfaceDescriptor* descriptor) { | 76 CodeStubInterfaceDescriptor* descriptor) { |
77 Register registers[] = { cp, a2, a3 }; | 77 Register registers[] = { cp, a2, a3 }; |
78 descriptor->Initialize(ARRAY_SIZE(registers), registers); | 78 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers); |
79 } | 79 } |
80 | 80 |
81 | 81 |
| 82 void InstanceofStub::InitializeInterfaceDescriptor( |
| 83 Isolate* isolate, |
| 84 CodeStubInterfaceDescriptor* descriptor) { |
| 85 UNIMPLEMENTED(); |
| 86 } |
| 87 |
| 88 |
| 89 void CallFunctionStub::InitializeInterfaceDescriptor( |
| 90 Isolate* isolate, |
| 91 CodeStubInterfaceDescriptor* descriptor) { |
| 92 UNIMPLEMENTED(); |
| 93 } |
| 94 |
| 95 |
| 96 void CallConstructStub::InitializeInterfaceDescriptor( |
| 97 Isolate* isolate, |
| 98 CodeStubInterfaceDescriptor* descriptor) { |
| 99 UNIMPLEMENTED(); |
| 100 } |
| 101 |
| 102 |
82 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | 103 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
83 CodeStubInterfaceDescriptor* descriptor) { | 104 CodeStubInterfaceDescriptor* descriptor) { |
84 Register registers[] = { cp, a2, a1, a0 }; | 105 Register registers[] = { cp, a2, a1, a0 }; |
85 descriptor->Initialize( | 106 descriptor->Initialize( |
86 ARRAY_SIZE(registers), registers, | 107 MajorKey(), ARRAY_SIZE(registers), registers, |
87 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | 108 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); |
88 } | 109 } |
89 | 110 |
90 | 111 |
91 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | 112 void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
92 CodeStubInterfaceDescriptor* descriptor) { | 113 CodeStubInterfaceDescriptor* descriptor) { |
93 Register registers[] = { cp, a0, a1 }; | 114 Register registers[] = { cp, a0, a1 }; |
94 Address entry = | 115 Address entry = |
95 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | 116 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
96 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 117 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
97 FUNCTION_ADDR(entry)); | 118 FUNCTION_ADDR(entry)); |
98 } | 119 } |
99 | 120 |
100 | 121 |
101 void CompareNilICStub::InitializeInterfaceDescriptor( | 122 void CompareNilICStub::InitializeInterfaceDescriptor( |
102 CodeStubInterfaceDescriptor* descriptor) { | 123 CodeStubInterfaceDescriptor* descriptor) { |
103 Register registers[] = { cp, a0 }; | 124 Register registers[] = { cp, a0 }; |
104 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 125 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
105 FUNCTION_ADDR(CompareNilIC_Miss)); | 126 FUNCTION_ADDR(CompareNilIC_Miss)); |
106 descriptor->SetMissHandler( | 127 descriptor->SetMissHandler( |
107 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | 128 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); |
108 } | 129 } |
109 | 130 |
110 | 131 |
111 const Register InterfaceDescriptor::ContextRegister() { return cp; } | 132 const Register InterfaceDescriptor::ContextRegister() { return cp; } |
112 | 133 |
113 | 134 |
114 static void InitializeArrayConstructorDescriptor( | 135 static void InitializeArrayConstructorDescriptor( |
115 CodeStubInterfaceDescriptor* descriptor, | 136 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
116 int constant_stack_parameter_count) { | 137 int constant_stack_parameter_count) { |
117 // register state | 138 // register state |
118 // cp -- context | 139 // cp -- context |
119 // a0 -- number of arguments | 140 // a0 -- number of arguments |
120 // a1 -- function | 141 // a1 -- function |
121 // a2 -- allocation site with elements kind | 142 // a2 -- allocation site with elements kind |
122 Address deopt_handler = Runtime::FunctionForId( | 143 Address deopt_handler = Runtime::FunctionForId( |
123 Runtime::kArrayConstructor)->entry; | 144 Runtime::kArrayConstructor)->entry; |
124 | 145 |
125 if (constant_stack_parameter_count == 0) { | 146 if (constant_stack_parameter_count == 0) { |
126 Register registers[] = { cp, a1, a2 }; | 147 Register registers[] = { cp, a1, a2 }; |
127 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 148 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, |
128 deopt_handler, | 149 deopt_handler, NULL, constant_stack_parameter_count, |
129 NULL, | |
130 constant_stack_parameter_count, | |
131 JS_FUNCTION_STUB_MODE); | 150 JS_FUNCTION_STUB_MODE); |
132 } else { | 151 } else { |
133 // stack param count needs (constructor pointer, and single argument) | 152 // stack param count needs (constructor pointer, and single argument) |
134 Register registers[] = { cp, a1, a2, a0 }; | 153 Register registers[] = { cp, a1, a2, a0 }; |
135 Representation representations[] = { | 154 Representation representations[] = { |
136 Representation::Tagged(), | 155 Representation::Tagged(), |
137 Representation::Tagged(), | 156 Representation::Tagged(), |
138 Representation::Tagged(), | 157 Representation::Tagged(), |
139 Representation::Integer32() }; | 158 Representation::Integer32() }; |
140 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 159 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0, |
141 a0, | 160 deopt_handler, representations, |
142 deopt_handler, | |
143 representations, | |
144 constant_stack_parameter_count, | 161 constant_stack_parameter_count, |
145 JS_FUNCTION_STUB_MODE, | 162 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
146 PASS_ARGUMENTS); | |
147 } | 163 } |
148 } | 164 } |
149 | 165 |
150 | 166 |
151 static void InitializeInternalArrayConstructorDescriptor( | 167 static void InitializeInternalArrayConstructorDescriptor( |
152 CodeStubInterfaceDescriptor* descriptor, | 168 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
153 int constant_stack_parameter_count) { | 169 int constant_stack_parameter_count) { |
154 // register state | 170 // register state |
155 // cp -- context | 171 // cp -- context |
156 // a0 -- number of arguments | 172 // a0 -- number of arguments |
157 // a1 -- constructor function | 173 // a1 -- constructor function |
158 Address deopt_handler = Runtime::FunctionForId( | 174 Address deopt_handler = Runtime::FunctionForId( |
159 Runtime::kInternalArrayConstructor)->entry; | 175 Runtime::kInternalArrayConstructor)->entry; |
160 | 176 |
161 if (constant_stack_parameter_count == 0) { | 177 if (constant_stack_parameter_count == 0) { |
162 Register registers[] = { cp, a1 }; | 178 Register registers[] = { cp, a1 }; |
163 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 179 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, |
164 deopt_handler, | 180 deopt_handler, NULL, constant_stack_parameter_count, |
165 NULL, | |
166 constant_stack_parameter_count, | |
167 JS_FUNCTION_STUB_MODE); | 181 JS_FUNCTION_STUB_MODE); |
168 } else { | 182 } else { |
169 // stack param count needs (constructor pointer, and single argument) | 183 // stack param count needs (constructor pointer, and single argument) |
170 Register registers[] = { cp, a1, a0 }; | 184 Register registers[] = { cp, a1, a0 }; |
171 Representation representations[] = { | 185 Representation representations[] = { |
172 Representation::Tagged(), | 186 Representation::Tagged(), |
173 Representation::Tagged(), | 187 Representation::Tagged(), |
174 Representation::Integer32() }; | 188 Representation::Integer32() }; |
175 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 189 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0, |
176 a0, | 190 deopt_handler, representations, |
177 deopt_handler, | |
178 representations, | |
179 constant_stack_parameter_count, | 191 constant_stack_parameter_count, |
180 JS_FUNCTION_STUB_MODE, | 192 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
181 PASS_ARGUMENTS); | |
182 } | 193 } |
183 } | 194 } |
184 | 195 |
185 | 196 |
186 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 197 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
187 CodeStubInterfaceDescriptor* descriptor) { | 198 CodeStubInterfaceDescriptor* descriptor) { |
188 InitializeArrayConstructorDescriptor(descriptor, 0); | 199 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
189 } | 200 } |
190 | 201 |
191 | 202 |
192 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 203 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
193 CodeStubInterfaceDescriptor* descriptor) { | 204 CodeStubInterfaceDescriptor* descriptor) { |
194 InitializeArrayConstructorDescriptor(descriptor, 1); | 205 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
195 } | 206 } |
196 | 207 |
197 | 208 |
198 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 209 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
199 CodeStubInterfaceDescriptor* descriptor) { | 210 CodeStubInterfaceDescriptor* descriptor) { |
200 InitializeArrayConstructorDescriptor(descriptor, -1); | 211 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
201 } | 212 } |
202 | 213 |
203 | 214 |
204 void ToBooleanStub::InitializeInterfaceDescriptor( | 215 void ToBooleanStub::InitializeInterfaceDescriptor( |
205 CodeStubInterfaceDescriptor* descriptor) { | 216 CodeStubInterfaceDescriptor* descriptor) { |
206 Register registers[] = { cp, a0 }; | 217 Register registers[] = { cp, a0 }; |
207 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 218 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
208 FUNCTION_ADDR(ToBooleanIC_Miss)); | 219 FUNCTION_ADDR(ToBooleanIC_Miss)); |
209 descriptor->SetMissHandler( | 220 descriptor->SetMissHandler( |
210 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | 221 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); |
211 } | 222 } |
212 | 223 |
213 | 224 |
214 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 225 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
215 CodeStubInterfaceDescriptor* descriptor) { | 226 CodeStubInterfaceDescriptor* descriptor) { |
216 InitializeInternalArrayConstructorDescriptor(descriptor, 0); | 227 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
217 } | 228 } |
218 | 229 |
219 | 230 |
220 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 231 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
221 CodeStubInterfaceDescriptor* descriptor) { | 232 CodeStubInterfaceDescriptor* descriptor) { |
222 InitializeInternalArrayConstructorDescriptor(descriptor, 1); | 233 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
223 } | 234 } |
224 | 235 |
225 | 236 |
226 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 237 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
227 CodeStubInterfaceDescriptor* descriptor) { | 238 CodeStubInterfaceDescriptor* descriptor) { |
228 InitializeInternalArrayConstructorDescriptor(descriptor, -1); | 239 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
229 } | 240 } |
230 | 241 |
231 | 242 |
232 void BinaryOpICStub::InitializeInterfaceDescriptor( | 243 void BinaryOpICStub::InitializeInterfaceDescriptor( |
233 CodeStubInterfaceDescriptor* descriptor) { | 244 CodeStubInterfaceDescriptor* descriptor) { |
234 Register registers[] = { cp, a1, a0 }; | 245 Register registers[] = { cp, a1, a0 }; |
235 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 246 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
236 FUNCTION_ADDR(BinaryOpIC_Miss)); | 247 FUNCTION_ADDR(BinaryOpIC_Miss)); |
237 descriptor->SetMissHandler( | 248 descriptor->SetMissHandler( |
238 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | 249 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); |
239 } | 250 } |
240 | 251 |
241 | 252 |
242 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | 253 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
243 CodeStubInterfaceDescriptor* descriptor) { | 254 CodeStubInterfaceDescriptor* descriptor) { |
244 Register registers[] = { cp, a2, a1, a0 }; | 255 Register registers[] = { cp, a2, a1, a0 }; |
245 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 256 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
246 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); | 257 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); |
247 } | 258 } |
248 | 259 |
249 | 260 |
250 void StringAddStub::InitializeInterfaceDescriptor( | 261 void StringAddStub::InitializeInterfaceDescriptor( |
251 CodeStubInterfaceDescriptor* descriptor) { | 262 CodeStubInterfaceDescriptor* descriptor) { |
252 Register registers[] = { cp, a1, a0 }; | 263 Register registers[] = { cp, a1, a0 }; |
253 descriptor->Initialize( | 264 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
254 ARRAY_SIZE(registers), registers, | 265 Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
255 Runtime::FunctionForId(Runtime::kStringAdd)->entry); | |
256 } | 266 } |
257 | 267 |
258 | 268 |
259 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 269 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
260 { | 270 { |
261 CallInterfaceDescriptor* descriptor = | 271 CallInterfaceDescriptor* descriptor = |
262 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); | 272 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
263 Register registers[] = { cp, // context, | 273 Register registers[] = { cp, // context, |
264 a1, // JSFunction | 274 a1, // JSFunction |
265 a0, // actual number of arguments | 275 a0, // actual number of arguments |
(...skipping 5004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5270 MemOperand(fp, 6 * kPointerSize), | 5280 MemOperand(fp, 6 * kPointerSize), |
5271 NULL); | 5281 NULL); |
5272 } | 5282 } |
5273 | 5283 |
5274 | 5284 |
5275 #undef __ | 5285 #undef __ |
5276 | 5286 |
5277 } } // namespace v8::internal | 5287 } } // namespace v8::internal |
5278 | 5288 |
5279 #endif // V8_TARGET_ARCH_MIPS | 5289 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |