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/ic/handler-compiler.h" | 12 #include "src/ic/handler-compiler.h" |
13 #include "src/isolate.h" | 13 #include "src/isolate.h" |
14 #include "src/jsregexp.h" | 14 #include "src/jsregexp.h" |
15 #include "src/regexp-macro-assembler.h" | 15 #include "src/regexp-macro-assembler.h" |
16 #include "src/runtime.h" | 16 #include "src/runtime.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace internal { |
20 | 20 |
21 | 21 |
22 void FastNewClosureStub::InitializeInterfaceDescriptor( | |
23 CodeStubInterfaceDescriptor* descriptor) { | |
24 Register registers[] = { cp, a2 }; | |
25 descriptor->Initialize( | |
26 MajorKey(), arraysize(registers), registers, | |
27 Runtime::FunctionForId(Runtime::kNewClosureFromStubFailure)->entry); | |
28 } | |
29 | |
30 | |
31 void FastNewContextStub::InitializeInterfaceDescriptor( | |
32 CodeStubInterfaceDescriptor* descriptor) { | |
33 Register registers[] = { cp, a1 }; | |
34 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
35 } | |
36 | |
37 | |
38 void ToNumberStub::InitializeInterfaceDescriptor( | |
39 CodeStubInterfaceDescriptor* descriptor) { | |
40 Register registers[] = { cp, a0 }; | |
41 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
42 } | |
43 | |
44 | |
45 void NumberToStringStub::InitializeInterfaceDescriptor( | |
46 CodeStubInterfaceDescriptor* descriptor) { | |
47 Register registers[] = { cp, a0 }; | |
48 descriptor->Initialize( | |
49 MajorKey(), arraysize(registers), registers, | |
50 Runtime::FunctionForId(Runtime::kNumberToStringRT)->entry); | |
51 } | |
52 | |
53 | |
54 void FastCloneShallowArrayStub::InitializeInterfaceDescriptor( | |
55 CodeStubInterfaceDescriptor* descriptor) { | |
56 Register registers[] = { cp, a3, a2, a1 }; | |
57 Representation representations[] = { | |
58 Representation::Tagged(), | |
59 Representation::Tagged(), | |
60 Representation::Smi(), | |
61 Representation::Tagged() }; | |
62 descriptor->Initialize( | |
63 MajorKey(), arraysize(registers), registers, | |
64 Runtime::FunctionForId(Runtime::kCreateArrayLiteralStubBailout)->entry, | |
65 representations); | |
66 } | |
67 | |
68 | |
69 void FastCloneShallowObjectStub::InitializeInterfaceDescriptor( | |
70 CodeStubInterfaceDescriptor* descriptor) { | |
71 Register registers[] = { cp, a3, a2, a1, a0 }; | |
72 descriptor->Initialize( | |
73 MajorKey(), arraysize(registers), registers, | |
74 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); | |
75 } | |
76 | |
77 | |
78 void CallFunctionStub::InitializeInterfaceDescriptor( | |
79 CodeStubInterfaceDescriptor* descriptor) { | |
80 UNIMPLEMENTED(); | |
81 } | |
82 | |
83 | |
84 void CallConstructStub::InitializeInterfaceDescriptor( | |
85 CodeStubInterfaceDescriptor* descriptor) { | |
86 UNIMPLEMENTED(); | |
87 } | |
88 | |
89 | |
90 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | |
91 CodeStubInterfaceDescriptor* descriptor) { | |
92 Register registers[] = { cp, a2, a3 }; | |
93 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
94 } | |
95 | |
96 | |
97 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | |
98 CodeStubInterfaceDescriptor* descriptor) { | |
99 Register registers[] = { cp, a2, a1, a0 }; | |
100 descriptor->Initialize( | |
101 MajorKey(), arraysize(registers), registers, | |
102 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | |
103 } | |
104 | |
105 | |
106 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | |
107 CodeStubInterfaceDescriptor* descriptor) { | |
108 Register registers[] = { cp, a0, a1 }; | |
109 Address entry = | |
110 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | |
111 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
112 FUNCTION_ADDR(entry)); | |
113 } | |
114 | |
115 | |
116 void CompareNilICStub::InitializeInterfaceDescriptor( | |
117 CodeStubInterfaceDescriptor* descriptor) { | |
118 Register registers[] = { cp, a0 }; | |
119 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
120 FUNCTION_ADDR(CompareNilIC_Miss)); | |
121 descriptor->SetMissHandler( | |
122 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | |
123 } | |
124 | |
125 | |
126 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
127 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 23 Isolate* isolate, CodeStub::Major major, |
| 24 CodeStubInterfaceDescriptor* descriptor, |
128 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
129 // register state | |
130 // cp -- context | |
131 // a0 -- number of arguments | |
132 // a1 -- function | |
133 // a2 -- allocation site with elements kind | |
134 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
135 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
136 | 28 |
137 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
138 Register registers[] = { cp, a1, a2 }; | 30 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
139 descriptor->Initialize(major, arraysize(registers), registers, | 31 CallDescriptorKey::ArrayConstructorConstantArgCountCall); |
140 deopt_handler, NULL, constant_stack_parameter_count, | 32 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 33 constant_stack_parameter_count, |
141 JS_FUNCTION_STUB_MODE); | 34 JS_FUNCTION_STUB_MODE); |
142 } else { | 35 } else { |
143 // stack param count needs (constructor pointer, and single argument) | 36 CallInterfaceDescriptor* call_descriptor = |
144 Register registers[] = { cp, a1, a2, a0 }; | 37 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); |
145 Representation representations[] = { | 38 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, |
146 Representation::Tagged(), | |
147 Representation::Tagged(), | |
148 Representation::Tagged(), | |
149 Representation::Integer32() }; | |
150 descriptor->Initialize(major, arraysize(registers), registers, a0, | |
151 deopt_handler, representations, | |
152 constant_stack_parameter_count, | 39 constant_stack_parameter_count, |
153 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 40 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
154 } | 41 } |
155 } | 42 } |
156 | 43 |
157 | 44 |
158 static void InitializeInternalArrayConstructorDescriptor( | 45 static void InitializeInternalArrayConstructorDescriptor( |
159 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 46 Isolate* isolate, CodeStub::Major major, |
| 47 CodeStubInterfaceDescriptor* descriptor, |
160 int constant_stack_parameter_count) { | 48 int constant_stack_parameter_count) { |
161 // register state | |
162 // cp -- context | |
163 // a0 -- number of arguments | |
164 // a1 -- constructor function | |
165 Address deopt_handler = Runtime::FunctionForId( | 49 Address deopt_handler = Runtime::FunctionForId( |
166 Runtime::kInternalArrayConstructor)->entry; | 50 Runtime::kInternalArrayConstructor)->entry; |
167 | 51 |
168 if (constant_stack_parameter_count == 0) { | 52 if (constant_stack_parameter_count == 0) { |
169 Register registers[] = { cp, a1 }; | 53 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
170 descriptor->Initialize(major, arraysize(registers), registers, | 54 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); |
171 deopt_handler, NULL, constant_stack_parameter_count, | 55 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 56 constant_stack_parameter_count, |
172 JS_FUNCTION_STUB_MODE); | 57 JS_FUNCTION_STUB_MODE); |
173 } else { | 58 } else { |
174 // stack param count needs (constructor pointer, and single argument) | 59 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
175 Register registers[] = { cp, a1, a0 }; | 60 CallDescriptorKey::InternalArrayConstructorCall); |
176 Representation representations[] = { | 61 descriptor->Initialize(major, call_descriptor, a0, deopt_handler, |
177 Representation::Tagged(), | |
178 Representation::Tagged(), | |
179 Representation::Integer32() }; | |
180 descriptor->Initialize(major, arraysize(registers), registers, a0, | |
181 deopt_handler, representations, | |
182 constant_stack_parameter_count, | 62 constant_stack_parameter_count, |
183 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 63 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
184 } | 64 } |
185 } | 65 } |
186 | 66 |
187 | 67 |
188 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 68 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
189 CodeStubInterfaceDescriptor* descriptor) { | 69 CodeStubInterfaceDescriptor* descriptor) { |
190 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 70 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); |
191 } | 71 } |
192 | 72 |
193 | 73 |
194 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 74 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
195 CodeStubInterfaceDescriptor* descriptor) { | 75 CodeStubInterfaceDescriptor* descriptor) { |
196 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 76 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); |
197 } | 77 } |
198 | 78 |
199 | 79 |
200 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 80 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
201 CodeStubInterfaceDescriptor* descriptor) { | 81 CodeStubInterfaceDescriptor* descriptor) { |
202 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 82 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); |
203 } | |
204 | |
205 | |
206 void ToBooleanStub::InitializeInterfaceDescriptor( | |
207 CodeStubInterfaceDescriptor* descriptor) { | |
208 Register registers[] = { cp, a0 }; | |
209 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
210 FUNCTION_ADDR(ToBooleanIC_Miss)); | |
211 descriptor->SetMissHandler( | |
212 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | |
213 } | 83 } |
214 | 84 |
215 | 85 |
216 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 86 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
217 CodeStubInterfaceDescriptor* descriptor) { | 87 CodeStubInterfaceDescriptor* descriptor) { |
218 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 88 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 89 descriptor, 0); |
219 } | 90 } |
220 | 91 |
221 | 92 |
222 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 93 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
223 CodeStubInterfaceDescriptor* descriptor) { | 94 CodeStubInterfaceDescriptor* descriptor) { |
224 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 95 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 96 descriptor, 1); |
225 } | 97 } |
226 | 98 |
227 | 99 |
228 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 100 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
229 CodeStubInterfaceDescriptor* descriptor) { | 101 CodeStubInterfaceDescriptor* descriptor) { |
230 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 102 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 103 descriptor, -1); |
231 } | 104 } |
232 | 105 |
233 | 106 |
234 void BinaryOpICStub::InitializeInterfaceDescriptor( | |
235 CodeStubInterfaceDescriptor* descriptor) { | |
236 Register registers[] = { cp, a1, a0 }; | |
237 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
238 FUNCTION_ADDR(BinaryOpIC_Miss)); | |
239 descriptor->SetMissHandler( | |
240 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | |
241 } | |
242 | |
243 | |
244 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | |
245 CodeStubInterfaceDescriptor* descriptor) { | |
246 Register registers[] = { cp, a2, a1, a0 }; | |
247 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
248 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); | |
249 } | |
250 | |
251 | |
252 void StringAddStub::InitializeInterfaceDescriptor( | |
253 CodeStubInterfaceDescriptor* descriptor) { | |
254 Register registers[] = { cp, a1, a0 }; | |
255 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
256 Runtime::FunctionForId(Runtime::kStringAdd)->entry); | |
257 } | |
258 | |
259 | |
260 #define __ ACCESS_MASM(masm) | 107 #define __ ACCESS_MASM(masm) |
261 | 108 |
262 | 109 |
263 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 110 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
264 Label* slow, | 111 Label* slow, |
265 Condition cc); | 112 Condition cc); |
266 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 113 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
267 Register lhs, | 114 Register lhs, |
268 Register rhs, | 115 Register rhs, |
269 Label* rhs_not_nan, | 116 Label* rhs_not_nan, |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 Label miss; | 1724 Label miss; |
1878 Register receiver = LoadConvention::ReceiverRegister(); | 1725 Register receiver = LoadConvention::ReceiverRegister(); |
1879 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, | 1726 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, a3, |
1880 a4, &miss); | 1727 a4, &miss); |
1881 __ bind(&miss); | 1728 __ bind(&miss); |
1882 PropertyAccessCompiler::TailCallBuiltin( | 1729 PropertyAccessCompiler::TailCallBuiltin( |
1883 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 1730 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
1884 } | 1731 } |
1885 | 1732 |
1886 | 1733 |
1887 Register InstanceofStub::left() { return a0; } | |
1888 | |
1889 | |
1890 Register InstanceofStub::right() { return a1; } | |
1891 | |
1892 | |
1893 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1734 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
1894 // The displacement is the offset of the last parameter (if any) | 1735 // The displacement is the offset of the last parameter (if any) |
1895 // relative to the frame pointer. | 1736 // relative to the frame pointer. |
1896 const int kDisplacement = | 1737 const int kDisplacement = |
1897 StandardFrameConstants::kCallerSPOffset - kPointerSize; | 1738 StandardFrameConstants::kCallerSPOffset - kPointerSize; |
1898 | 1739 |
1899 // Check that the key is a smiGenerateReadElement. | 1740 // Check that the key is a smiGenerateReadElement. |
1900 Label slow; | 1741 Label slow; |
1901 __ JumpIfNotSmi(a1, &slow); | 1742 __ JumpIfNotSmi(a1, &slow); |
1902 | 1743 |
(...skipping 3357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5260 MemOperand(fp, 6 * kPointerSize), | 5101 MemOperand(fp, 6 * kPointerSize), |
5261 NULL); | 5102 NULL); |
5262 } | 5103 } |
5263 | 5104 |
5264 | 5105 |
5265 #undef __ | 5106 #undef __ |
5266 | 5107 |
5267 } } // namespace v8::internal | 5108 } } // namespace v8::internal |
5268 | 5109 |
5269 #endif // V8_TARGET_ARCH_MIPS64 | 5110 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |