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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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, r2 }; | |
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, r1 }; | |
34 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
35 } | |
36 | |
37 | |
38 void ToNumberStub::InitializeInterfaceDescriptor( | |
39 CodeStubInterfaceDescriptor* descriptor) { | |
40 Register registers[] = { cp, r0 }; | |
41 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
42 } | |
43 | |
44 | |
45 void NumberToStringStub::InitializeInterfaceDescriptor( | |
46 CodeStubInterfaceDescriptor* descriptor) { | |
47 Register registers[] = { cp, r0 }; | |
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, r3, r2, r1 }; | |
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, r3, r2, r1, r0 }; | |
72 descriptor->Initialize( | |
73 MajorKey(), arraysize(registers), registers, | |
74 Runtime::FunctionForId(Runtime::kCreateObjectLiteral)->entry); | |
75 } | |
76 | |
77 | |
78 void CreateAllocationSiteStub::InitializeInterfaceDescriptor( | |
79 CodeStubInterfaceDescriptor* descriptor) { | |
80 Register registers[] = { cp, r2, r3 }; | |
81 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
82 } | |
83 | |
84 | |
85 void CallFunctionStub::InitializeInterfaceDescriptor( | |
86 CodeStubInterfaceDescriptor* descriptor) { | |
87 // r1 function the function to call | |
88 Register registers[] = {cp, r1}; | |
89 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
90 } | |
91 | |
92 | |
93 void CallConstructStub::InitializeInterfaceDescriptor( | |
94 CodeStubInterfaceDescriptor* descriptor) { | |
95 // r0 : number of arguments | |
96 // r1 : the function to call | |
97 // r2 : feedback vector | |
98 // r3 : (only if r2 is not the megamorphic symbol) slot in feedback | |
99 // vector (Smi) | |
100 // TODO(turbofan): So far we don't gather type feedback and hence skip the | |
101 // slot parameter, but ArrayConstructStub needs the vector to be undefined. | |
102 Register registers[] = {cp, r0, r1, r2}; | |
103 descriptor->Initialize(MajorKey(), arraysize(registers), registers); | |
104 } | |
105 | |
106 | |
107 void RegExpConstructResultStub::InitializeInterfaceDescriptor( | |
108 CodeStubInterfaceDescriptor* descriptor) { | |
109 Register registers[] = { cp, r2, r1, r0 }; | |
110 descriptor->Initialize( | |
111 MajorKey(), arraysize(registers), registers, | |
112 Runtime::FunctionForId(Runtime::kRegExpConstructResult)->entry); | |
113 } | |
114 | |
115 | |
116 void TransitionElementsKindStub::InitializeInterfaceDescriptor( | |
117 CodeStubInterfaceDescriptor* descriptor) { | |
118 Register registers[] = { cp, r0, r1 }; | |
119 Address entry = | |
120 Runtime::FunctionForId(Runtime::kTransitionElementsKind)->entry; | |
121 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
122 FUNCTION_ADDR(entry)); | |
123 } | |
124 | |
125 | |
126 void CompareNilICStub::InitializeInterfaceDescriptor( | |
127 CodeStubInterfaceDescriptor* descriptor) { | |
128 Register registers[] = { cp, r0 }; | |
129 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
130 FUNCTION_ADDR(CompareNilIC_Miss)); | |
131 descriptor->SetMissHandler( | |
132 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate())); | |
133 } | |
134 | |
135 | |
136 static void InitializeArrayConstructorDescriptor( | 22 static void InitializeArrayConstructorDescriptor( |
137 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 23 Isolate* isolate, CodeStub::Major major, |
| 24 CodeStubInterfaceDescriptor* descriptor, |
138 int constant_stack_parameter_count) { | 25 int constant_stack_parameter_count) { |
139 // register state | |
140 // cp -- context | |
141 // r0 -- number of arguments | |
142 // r1 -- function | |
143 // r2 -- allocation site with elements kind | |
144 Address deopt_handler = Runtime::FunctionForId( | 26 Address deopt_handler = Runtime::FunctionForId( |
145 Runtime::kArrayConstructor)->entry; | 27 Runtime::kArrayConstructor)->entry; |
146 | 28 |
147 if (constant_stack_parameter_count == 0) { | 29 if (constant_stack_parameter_count == 0) { |
148 Register registers[] = { cp, r1, r2 }; | 30 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
149 descriptor->Initialize(major, arraysize(registers), registers, | 31 CallDescriptorKey::ArrayConstructorConstantArgCountCall); |
150 deopt_handler, NULL, constant_stack_parameter_count, | 32 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 33 constant_stack_parameter_count, |
151 JS_FUNCTION_STUB_MODE); | 34 JS_FUNCTION_STUB_MODE); |
152 } else { | 35 } else { |
153 // stack param count needs (constructor pointer, and single argument) | 36 CallInterfaceDescriptor* call_descriptor = |
154 Register registers[] = { cp, r1, r2, r0 }; | 37 isolate->call_descriptor(CallDescriptorKey::ArrayConstructorCall); |
155 Representation representations[] = { | 38 descriptor->Initialize(major, call_descriptor, r0, deopt_handler, |
156 Representation::Tagged(), | |
157 Representation::Tagged(), | |
158 Representation::Tagged(), | |
159 Representation::Integer32() }; | |
160 descriptor->Initialize(major, arraysize(registers), registers, r0, | |
161 deopt_handler, representations, | |
162 constant_stack_parameter_count, | 39 constant_stack_parameter_count, |
163 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 40 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
164 } | 41 } |
165 } | 42 } |
166 | 43 |
167 | 44 |
168 static void InitializeInternalArrayConstructorDescriptor( | 45 static void InitializeInternalArrayConstructorDescriptor( |
169 CodeStub::Major major, CodeStubInterfaceDescriptor* descriptor, | 46 Isolate* isolate, CodeStub::Major major, |
| 47 CodeStubInterfaceDescriptor* descriptor, |
170 int constant_stack_parameter_count) { | 48 int constant_stack_parameter_count) { |
171 // register state | |
172 // cp -- context | |
173 // r0 -- number of arguments | |
174 // r1 -- constructor function | |
175 Address deopt_handler = Runtime::FunctionForId( | 49 Address deopt_handler = Runtime::FunctionForId( |
176 Runtime::kInternalArrayConstructor)->entry; | 50 Runtime::kInternalArrayConstructor)->entry; |
177 | 51 |
178 if (constant_stack_parameter_count == 0) { | 52 if (constant_stack_parameter_count == 0) { |
179 Register registers[] = { cp, r1 }; | 53 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
180 descriptor->Initialize(major, arraysize(registers), registers, | 54 CallDescriptorKey::InternalArrayConstructorConstantArgCountCall); |
181 deopt_handler, NULL, constant_stack_parameter_count, | 55 descriptor->Initialize(major, call_descriptor, deopt_handler, |
| 56 constant_stack_parameter_count, |
182 JS_FUNCTION_STUB_MODE); | 57 JS_FUNCTION_STUB_MODE); |
183 } else { | 58 } else { |
184 // stack param count needs (constructor pointer, and single argument) | 59 CallInterfaceDescriptor* call_descriptor = isolate->call_descriptor( |
185 Register registers[] = { cp, r1, r0 }; | 60 CallDescriptorKey::InternalArrayConstructorCall); |
186 Representation representations[] = { | 61 descriptor->Initialize(major, call_descriptor, r0, deopt_handler, |
187 Representation::Tagged(), | |
188 Representation::Tagged(), | |
189 Representation::Integer32() }; | |
190 descriptor->Initialize(major, arraysize(registers), registers, r0, | |
191 deopt_handler, representations, | |
192 constant_stack_parameter_count, | 62 constant_stack_parameter_count, |
193 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); | 63 JS_FUNCTION_STUB_MODE, PASS_ARGUMENTS); |
194 } | 64 } |
195 } | 65 } |
196 | 66 |
197 | 67 |
198 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 68 void ArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
199 CodeStubInterfaceDescriptor* descriptor) { | 69 CodeStubInterfaceDescriptor* descriptor) { |
200 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 70 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 0); |
201 } | 71 } |
202 | 72 |
203 | 73 |
204 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 74 void ArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
205 CodeStubInterfaceDescriptor* descriptor) { | 75 CodeStubInterfaceDescriptor* descriptor) { |
206 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 76 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, 1); |
207 } | 77 } |
208 | 78 |
209 | 79 |
210 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 80 void ArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
211 CodeStubInterfaceDescriptor* descriptor) { | 81 CodeStubInterfaceDescriptor* descriptor) { |
212 InitializeArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 82 InitializeArrayConstructorDescriptor(isolate(), MajorKey(), descriptor, -1); |
213 } | |
214 | |
215 | |
216 void ToBooleanStub::InitializeInterfaceDescriptor( | |
217 CodeStubInterfaceDescriptor* descriptor) { | |
218 Register registers[] = { cp, r0 }; | |
219 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
220 FUNCTION_ADDR(ToBooleanIC_Miss)); | |
221 descriptor->SetMissHandler( | |
222 ExternalReference(IC_Utility(IC::kToBooleanIC_Miss), isolate())); | |
223 } | 83 } |
224 | 84 |
225 | 85 |
226 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( | 86 void InternalArrayNoArgumentConstructorStub::InitializeInterfaceDescriptor( |
227 CodeStubInterfaceDescriptor* descriptor) { | 87 CodeStubInterfaceDescriptor* descriptor) { |
228 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 0); | 88 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 89 descriptor, 0); |
229 } | 90 } |
230 | 91 |
231 | 92 |
232 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( | 93 void InternalArraySingleArgumentConstructorStub::InitializeInterfaceDescriptor( |
233 CodeStubInterfaceDescriptor* descriptor) { | 94 CodeStubInterfaceDescriptor* descriptor) { |
234 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, 1); | 95 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 96 descriptor, 1); |
235 } | 97 } |
236 | 98 |
237 | 99 |
238 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( | 100 void InternalArrayNArgumentsConstructorStub::InitializeInterfaceDescriptor( |
239 CodeStubInterfaceDescriptor* descriptor) { | 101 CodeStubInterfaceDescriptor* descriptor) { |
240 InitializeInternalArrayConstructorDescriptor(MajorKey(), descriptor, -1); | 102 InitializeInternalArrayConstructorDescriptor(isolate(), MajorKey(), |
| 103 descriptor, -1); |
241 } | 104 } |
242 | 105 |
243 | 106 |
244 void BinaryOpICStub::InitializeInterfaceDescriptor( | |
245 CodeStubInterfaceDescriptor* descriptor) { | |
246 Register registers[] = { cp, r1, r0 }; | |
247 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
248 FUNCTION_ADDR(BinaryOpIC_Miss)); | |
249 descriptor->SetMissHandler( | |
250 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate())); | |
251 } | |
252 | |
253 | |
254 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | |
255 CodeStubInterfaceDescriptor* descriptor) { | |
256 Register registers[] = { cp, r2, r1, r0 }; | |
257 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
258 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite)); | |
259 } | |
260 | |
261 | |
262 void StringAddStub::InitializeInterfaceDescriptor( | |
263 CodeStubInterfaceDescriptor* descriptor) { | |
264 Register registers[] = { cp, r1, r0 }; | |
265 descriptor->Initialize(MajorKey(), arraysize(registers), registers, | |
266 Runtime::FunctionForId(Runtime::kStringAdd)->entry); | |
267 } | |
268 | |
269 | |
270 #define __ ACCESS_MASM(masm) | 107 #define __ ACCESS_MASM(masm) |
271 | 108 |
272 | 109 |
273 static void EmitIdenticalObjectComparison(MacroAssembler* masm, | 110 static void EmitIdenticalObjectComparison(MacroAssembler* masm, |
274 Label* slow, | 111 Label* slow, |
275 Condition cond); | 112 Condition cond); |
276 static void EmitSmiNonsmiComparison(MacroAssembler* masm, | 113 static void EmitSmiNonsmiComparison(MacroAssembler* masm, |
277 Register lhs, | 114 Register lhs, |
278 Register rhs, | 115 Register rhs, |
279 Label* lhs_not_nan, | 116 Label* lhs_not_nan, |
(...skipping 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1790 Register receiver = LoadConvention::ReceiverRegister(); | 1627 Register receiver = LoadConvention::ReceiverRegister(); |
1791 | 1628 |
1792 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r3, | 1629 NamedLoadHandlerCompiler::GenerateLoadFunctionPrototype(masm, receiver, r3, |
1793 r4, &miss); | 1630 r4, &miss); |
1794 __ bind(&miss); | 1631 __ bind(&miss); |
1795 PropertyAccessCompiler::TailCallBuiltin( | 1632 PropertyAccessCompiler::TailCallBuiltin( |
1796 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); | 1633 masm, PropertyAccessCompiler::MissBuiltin(Code::LOAD_IC)); |
1797 } | 1634 } |
1798 | 1635 |
1799 | 1636 |
1800 Register InstanceofStub::left() { return r0; } | |
1801 | |
1802 | |
1803 Register InstanceofStub::right() { return r1; } | |
1804 | |
1805 | |
1806 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { | 1637 void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { |
1807 // The displacement is the offset of the last parameter (if any) | 1638 // The displacement is the offset of the last parameter (if any) |
1808 // relative to the frame pointer. | 1639 // relative to the frame pointer. |
1809 const int kDisplacement = | 1640 const int kDisplacement = |
1810 StandardFrameConstants::kCallerSPOffset - kPointerSize; | 1641 StandardFrameConstants::kCallerSPOffset - kPointerSize; |
1811 | 1642 |
1812 // Check that the key is a smi. | 1643 // Check that the key is a smi. |
1813 Label slow; | 1644 Label slow; |
1814 __ JumpIfNotSmi(r1, &slow); | 1645 __ JumpIfNotSmi(r1, &slow); |
1815 | 1646 |
(...skipping 3206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5022 MemOperand(fp, 6 * kPointerSize), | 4853 MemOperand(fp, 6 * kPointerSize), |
5023 NULL); | 4854 NULL); |
5024 } | 4855 } |
5025 | 4856 |
5026 | 4857 |
5027 #undef __ | 4858 #undef __ |
5028 | 4859 |
5029 } } // namespace v8::internal | 4860 } } // namespace v8::internal |
5030 | 4861 |
5031 #endif // V8_TARGET_ARCH_ARM | 4862 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |