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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
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 RegExpConstructResultStub::InitializeInterfaceDescriptor( | 82 void RegExpConstructResultStub::InitializeInterfaceDescriptor( |
83 CodeStubInterfaceDescriptor* descriptor) { | 83 CodeStubInterfaceDescriptor* descriptor) { |
84 Register registers[] = { cp, a2, a1, a0 }; | 84 Register registers[] = { cp, a2, a1, a0 }; |
85 descriptor->Initialize( | 85 descriptor->Initialize( |
86 ARRAY_SIZE(registers), registers, | 86 MajorKey(), ARRAY_SIZE(registers), registers, |
87 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | 87 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); |
88 } | 88 } |
89 | 89 |
90 | 90 |
91 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | 91 void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
92 CodeStubInterfaceDescriptor* descriptor) { | 92 CodeStubInterfaceDescriptor* descriptor) { |
93 Register registers[] = { cp, a0, a1 }; | 93 Register registers[] = { cp, a0, a1 }; |
94 Address entry = | 94 Address entry = |
95 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | 95 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; |
96 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 96 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
97 FUNCTION_ADDR(entry)); | 97 FUNCTION_ADDR(entry)); |
98 } | 98 } |
99 | 99 |
100 | 100 |
101 void CompareNilICStub::InitializeInterfaceDescriptor( | 101 void CompareNilICStub::InitializeInterfaceDescriptor( |
102 CodeStubInterfaceDescriptor* descriptor) { | 102 CodeStubInterfaceDescriptor* descriptor) { |
103 Register registers[] = { cp, a0 }; | 103 Register registers[] = { cp, a0 }; |
104 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 104 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
105 FUNCTION_ADDR(CompareNilIC_Miss)); | 105 FUNCTION_ADDR(CompareNilIC_Miss)); |
106 descriptor->SetMissHandler( | 106 descriptor->SetMissHandler( |
107 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | 107 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); |
108 } | 108 } |
109 | 109 |
110 | 110 |
111 const Register InterfaceDescriptor::ContextRegister() { return cp; } | 111 const Register InterfaceDescriptor::ContextRegister() { return cp; } |
112 | 112 |
113 | 113 |
114 static void InitializeArrayConstructorDescriptor( | 114 static void InitializeArrayConstructorDescriptor( |
115 CodeStubInterfaceDescriptor* descriptor, | 115 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
116 int constant_stack_parameter_count) { | 116 int constant_stack_parameter_count) { |
117 // register state | 117 // register state |
118 // cp -- context | 118 // cp -- context |
119 // a0 -- number of arguments | 119 // a0 -- number of arguments |
120 // a1 -- function | 120 // a1 -- function |
121 // a2 -- allocation site with elements kind | 121 // a2 -- allocation site with elements kind |
122 Address deopt_handler = Runtime::FunctionForId( | 122 Address deopt_handler = Runtime::FunctionForId( |
123 Runtime::kArrayConstructor)->entry; | 123 Runtime::kArrayConstructor)->entry; |
124 | 124 |
125 if (constant_stack_parameter_count == 0) { | 125 if (constant_stack_parameter_count == 0) { |
126 Register registers[] = { cp, a1, a2 }; | 126 Register registers[] = { cp, a1, a2 }; |
127 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 127 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, |
128 deopt_handler, | 128 deopt_handler, NULL, constant_stack_parameter_count, |
129 NULL, | |
130 constant_stack_parameter_count, | |
131 JS_FUNCTION_STUB_MODE); | 129 JS_FUNCTION_STUB_MODE); |
132 } else { | 130 } else { |
133 // stack param count needs (constructor pointer, and single argument) | 131 // stack param count needs (constructor pointer, and single argument) |
134 Register registers[] = { cp, a1, a2, a0 }; | 132 Register registers[] = { cp, a1, a2, a0 }; |
135 Representation representations[] = { | 133 Representation representations[] = { |
136 Representation::Tagged(), | 134 Representation::Tagged(), |
137 Representation::Tagged(), | 135 Representation::Tagged(), |
138 Representation::Tagged(), | 136 Representation::Tagged(), |
139 Representation::Integer32() }; | 137 Representation::Integer32() }; |
140 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 138 descriptor->Initialize(major, ARRAY_SIZE(registers), registers, a0, |
141 a0, | 139 deopt_handler, representations, |
142 deopt_handler, | |
143 representations, | |
144 constant_stack_parameter_count, | 140 constant_stack_parameter_count, |
145 JS_FUNCTION_STUB_MODE, | 141 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
146 PASS_ARGUMENTS); | |
147 } | 142 } |
148 } | 143 } |
149 | 144 |
150 | 145 |
151 static void InitializeInternalArrayConstructorDescriptor( | 146 static void InitializeInternalArrayConstructorDescriptor( |
152 CodeStubInterfaceDescriptor* descriptor, | 147 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, |
153 int constant_stack_parameter_count) { | 148 int constant_stack_parameter_count) { |
154 // register state | 149 // register state |
155 // cp -- context | 150 // cp -- context |
156 // a0 -- number of arguments | 151 // a0 -- number of arguments |
157 // a1 -- constructor function | 152 // a1 -- constructor function |
158 Address deopt_handler = Runtime::FunctionForId( | 153 Address deopt_handler = Runtime::FunctionForId( |
159 Runtime::kInternalArrayConstructor)->entry; | 154 Runtime::kInternalArrayConstructor)->entry; |
160 | 155 |
161 if (constant_stack_parameter_count == 0) { | 156 if (constant_stack_parameter_count == 0) { |
162 Register registers[] = { cp, a1 }; | 157 Register registers[] = { cp, a1 }; |
163 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 158 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
164 deopt_handler, | 159 deopt_handler, NULL, constant_stack_parameter_count, |
165 NULL, | |
166 constant_stack_parameter_count, | |
167 JS_FUNCTION_STUB_MODE); | 160 JS_FUNCTION_STUB_MODE); |
168 } else { | 161 } else { |
169 // stack param count needs (constructor pointer, and single argument) | 162 // stack param count needs (constructor pointer, and single argument) |
170 Register registers[] = { cp, a1, a0 }; | 163 Register registers[] = { cp, a1, a0 }; |
171 Representation representations[] = { | 164 Representation representations[] = { |
172 Representation::Tagged(), | 165 Representation::Tagged(), |
173 Representation::Tagged(), | 166 Representation::Tagged(), |
174 Representation::Integer32() }; | 167 Representation::Integer32() }; |
175 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 168 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, a0, |
176 a0, | 169 deopt_handler, representations, |
177 deopt_handler, | |
178 representations, | |
179 constant_stack_parameter_count, | 170 constant_stack_parameter_count, |
180 JS_FUNCTION_STUB_MODE, | 171 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
181 PASS_ARGUMENTS); | |
182 } | 172 } |
183 } | 173 } |
184 | 174 |
185 | 175 |
186 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 176 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
187 CodeStubInterfaceDescriptor* descriptor) { | 177 CodeStubInterfaceDescriptor* descriptor) { |
188 InitializeArrayConstructorDescriptor(descriptor, 0); | 178 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
189 } | 179 } |
190 | 180 |
191 | 181 |
192 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 182 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
193 CodeStubInterfaceDescriptor* descriptor) { | 183 CodeStubInterfaceDescriptor* descriptor) { |
194 InitializeArrayConstructorDescriptor(descriptor, 1); | 184 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
195 } | 185 } |
196 | 186 |
197 | 187 |
198 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 188 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
199 CodeStubInterfaceDescriptor* descriptor) { | 189 CodeStubInterfaceDescriptor* descriptor) { |
200 InitializeArrayConstructorDescriptor(descriptor, -1); | 190 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
201 } | 191 } |
202 | 192 |
203 | 193 |
204 void ToBooleanStub::InitializeInterfaceDescriptor( | 194 void ToBooleanStub::InitializeInterfaceDescriptor( |
205 CodeStubInterfaceDescriptor* descriptor) { | 195 CodeStubInterfaceDescriptor* descriptor) { |
206 Register registers[] = { cp, a0 }; | 196 Register registers[] = { cp, a0 }; |
207 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 197 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
208 FUNCTION_ADDR(ToBooleanIC_Miss)); | 198 FUNCTION_ADDR(ToBooleanIC_Miss)); |
209 descriptor->SetMissHandler( | 199 descriptor->SetMissHandler( |
210 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | 200 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); |
211 } | 201 } |
212 | 202 |
213 | 203 |
214 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 204 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
215 CodeStubInterfaceDescriptor* descriptor) { | 205 CodeStubInterfaceDescriptor* descriptor) { |
216 InitializeInternalArrayConstructorDescriptor(descriptor, 0); | 206 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); |
217 } | 207 } |
218 | 208 |
219 | 209 |
220 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 210 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
221 CodeStubInterfaceDescriptor* descriptor) { | 211 CodeStubInterfaceDescriptor* descriptor) { |
222 InitializeInternalArrayConstructorDescriptor(descriptor, 1); | 212 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); |
223 } | 213 } |
224 | 214 |
225 | 215 |
226 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 216 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
227 CodeStubInterfaceDescriptor* descriptor) { | 217 CodeStubInterfaceDescriptor* descriptor) { |
228 InitializeInternalArrayConstructorDescriptor(descriptor, -1); | 218 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); |
229 } | 219 } |
230 | 220 |
231 | 221 |
232 void BinaryOpICStub::InitializeInterfaceDescriptor( | 222 void BinaryOpICStub::InitializeInterfaceDescriptor( |
233 CodeStubInterfaceDescriptor* descriptor) { | 223 CodeStubInterfaceDescriptor* descriptor) { |
234 Register registers[] = { cp, a1, a0 }; | 224 Register registers[] = { cp, a1, a0 }; |
235 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 225 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
236 FUNCTION_ADDR(BinaryOpIC_Miss)); | 226 FUNCTION_ADDR(BinaryOpIC_Miss)); |
237 descriptor->SetMissHandler( | 227 descriptor->SetMissHandler( |
238 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | 228 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); |
239 } | 229 } |
240 | 230 |
241 | 231 |
242 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | 232 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
243 CodeStubInterfaceDescriptor* descriptor) { | 233 CodeStubInterfaceDescriptor* descriptor) { |
244 Register registers[] = { cp, a2, a1, a0 }; | 234 Register registers[] = { cp, a2, a1, a0 }; |
245 descriptor->Initialize(ARRAY_SIZE(registers), registers, | 235 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
246 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); | 236 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); |
247 } | 237 } |
248 | 238 |
249 | 239 |
250 void StringAddStub::InitializeInterfaceDescriptor( | 240 void StringAddStub::InitializeInterfaceDescriptor( |
251 CodeStubInterfaceDescriptor* descriptor) { | 241 CodeStubInterfaceDescriptor* descriptor) { |
252 Register registers[] = { cp, a1, a0 }; | 242 Register registers[] = { cp, a1, a0 }; |
253 descriptor->Initialize( | 243 descriptor->Initialize(MajorKey(), ARRAY_SIZE(registers), registers, |
254 ARRAY_SIZE(registers), registers, | 244 Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
255 Runtime::FunctionForId(Runtime::kStringAdd)->entry); | |
256 } | 245 } |
257 | 246 |
258 | 247 |
259 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { | 248 void CallDescriptors::InitializeForIsolate(Isolate* isolate) { |
260 { | 249 { |
261 CallInterfaceDescriptor* descriptor = | 250 CallInterfaceDescriptor* descriptor = |
262 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); | 251 isolate->call_descriptor(Isolate::ArgumentAdaptorCall); |
263 Register registers[] = { cp, // context | 252 Register registers[] = { cp, // context |
264 a1, // JSFunction | 253 a1, // JSFunction |
265 a0, // actual number of arguments | 254 a0, // actual number of arguments |
(...skipping 5053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5319 MemOperand(fp, 6 * kPointerSize), | 5308 MemOperand(fp, 6 * kPointerSize), |
5320 NULL); | 5309 NULL); |
5321 } | 5310 } |
5322 | 5311 |
5323 | 5312 |
5324 #undef __ | 5313 #undef __ |
5325 | 5314 |
5326 } } // namespace v8::internal | 5315 } } // namespace v8::internal |
5327 | 5316 |
5328 #endif // V8_TARGET_ARCH_MIPS64 | 5317 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |