OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 static Register registers[] = { r0 }; | 186 static Register registers[] = { r0 }; |
187 descriptor->register_param_count_ = 1; | 187 descriptor->register_param_count_ = 1; |
188 descriptor->register_params_ = registers; | 188 descriptor->register_params_ = registers; |
189 descriptor->deoptimization_handler_ = | 189 descriptor->deoptimization_handler_ = |
190 FUNCTION_ADDR(CompareNilIC_Miss); | 190 FUNCTION_ADDR(CompareNilIC_Miss); |
191 descriptor->SetMissHandler( | 191 descriptor->SetMissHandler( |
192 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate)); | 192 ExternalReference(IC_Utility(IC::kCompareNilIC_Miss), isolate)); |
193 } | 193 } |
194 | 194 |
195 | 195 |
196 void BinaryOpICStub::InitializeInterfaceDescriptor( | |
197 Isolate* isolate, | |
198 CodeStubInterfaceDescriptor* descriptor) { | |
199 static Register registers[] = { r1, r0 }; | |
200 descriptor->register_param_count_ = 2; | |
201 descriptor->register_params_ = registers; | |
202 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); | |
203 descriptor->SetMissHandler( | |
204 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); | |
205 } | |
206 | |
207 | |
208 static void InitializeArrayConstructorDescriptor( | 196 static void InitializeArrayConstructorDescriptor( |
209 Isolate* isolate, | 197 Isolate* isolate, |
210 CodeStubInterfaceDescriptor* descriptor, | 198 CodeStubInterfaceDescriptor* descriptor, |
211 int constant_stack_parameter_count) { | 199 int constant_stack_parameter_count) { |
212 // register state | 200 // register state |
213 // r0 -- number of arguments | 201 // r0 -- number of arguments |
214 // r1 -- function | 202 // r1 -- function |
215 // r2 -- type info cell with elements kind | 203 // r2 -- type info cell with elements kind |
216 static Register registers_variable_args[] = { r1, r2, r0 }; | 204 static Register registers_variable_args[] = { r1, r2, r0 }; |
217 static Register registers_no_args[] = { r1, r2 }; | 205 static Register registers_no_args[] = { r1, r2 }; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 Isolate* isolate, | 320 Isolate* isolate, |
333 CodeStubInterfaceDescriptor* descriptor) { | 321 CodeStubInterfaceDescriptor* descriptor) { |
334 static Register registers[] = { r0, r3, r1, r2 }; | 322 static Register registers[] = { r0, r3, r1, r2 }; |
335 descriptor->register_param_count_ = 4; | 323 descriptor->register_param_count_ = 4; |
336 descriptor->register_params_ = registers; | 324 descriptor->register_params_ = registers; |
337 descriptor->deoptimization_handler_ = | 325 descriptor->deoptimization_handler_ = |
338 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); | 326 FUNCTION_ADDR(ElementsTransitionAndStoreIC_Miss); |
339 } | 327 } |
340 | 328 |
341 | 329 |
| 330 void BinaryOpICStub::InitializeInterfaceDescriptor( |
| 331 Isolate* isolate, |
| 332 CodeStubInterfaceDescriptor* descriptor) { |
| 333 static Register registers[] = { r1, r0 }; |
| 334 descriptor->register_param_count_ = 2; |
| 335 descriptor->register_params_ = registers; |
| 336 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
| 337 descriptor->SetMissHandler( |
| 338 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
| 339 } |
| 340 |
| 341 |
| 342 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
| 343 Isolate* isolate, |
| 344 CodeStubInterfaceDescriptor* descriptor) { |
| 345 static Register registers[] = { r2, r1, r0 }; |
| 346 descriptor->register_param_count_ = 3; |
| 347 descriptor->register_params_ = registers; |
| 348 descriptor->deoptimization_handler_ = |
| 349 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); |
| 350 } |
| 351 |
| 352 |
342 void NewStringAddStub::InitializeInterfaceDescriptor( | 353 void NewStringAddStub::InitializeInterfaceDescriptor( |
343 Isolate* isolate, | 354 Isolate* isolate, |
344 CodeStubInterfaceDescriptor* descriptor) { | 355 CodeStubInterfaceDescriptor* descriptor) { |
345 static Register registers[] = { r1, r0 }; | 356 static Register registers[] = { r1, r0 }; |
346 descriptor->register_param_count_ = 2; | 357 descriptor->register_param_count_ = 2; |
347 descriptor->register_params_ = registers; | 358 descriptor->register_params_ = registers; |
348 descriptor->deoptimization_handler_ = | 359 descriptor->deoptimization_handler_ = |
349 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 360 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
350 } | 361 } |
351 | 362 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 | 1446 |
1436 | 1447 |
1437 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 1448 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
1438 CEntryStub::GenerateAheadOfTime(isolate); | 1449 CEntryStub::GenerateAheadOfTime(isolate); |
1439 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1450 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1440 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1451 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1441 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 1452 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
1442 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1453 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
1443 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 1454 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
1444 BinaryOpICStub::GenerateAheadOfTime(isolate); | 1455 BinaryOpICStub::GenerateAheadOfTime(isolate); |
| 1456 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
1445 } | 1457 } |
1446 | 1458 |
1447 | 1459 |
1448 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 1460 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
1449 SaveFPRegsMode mode = kSaveFPRegs; | 1461 SaveFPRegsMode mode = kSaveFPRegs; |
1450 CEntryStub save_doubles(1, mode); | 1462 CEntryStub save_doubles(1, mode); |
1451 StoreBufferOverflowStub stub(mode); | 1463 StoreBufferOverflowStub stub(mode); |
1452 // These stubs might already be in the snapshot, detect that and don't | 1464 // These stubs might already be in the snapshot, detect that and don't |
1453 // regenerate, which would lead to code stub initialization state being messed | 1465 // regenerate, which would lead to code stub initialization state being messed |
1454 // up. | 1466 // up. |
(...skipping 2700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4155 __ add(sp, sp, Operand(2 * kPointerSize)); | 4167 __ add(sp, sp, Operand(2 * kPointerSize)); |
4156 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); | 4168 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); |
4157 | 4169 |
4158 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4170 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
4159 // tagged as a small integer. | 4171 // tagged as a small integer. |
4160 __ bind(&runtime); | 4172 __ bind(&runtime); |
4161 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4173 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4162 } | 4174 } |
4163 | 4175 |
4164 | 4176 |
| 4177 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
| 4178 // ----------- S t a t e ------------- |
| 4179 // -- r1 : left |
| 4180 // -- r0 : right |
| 4181 // -- lr : return address |
| 4182 // ----------------------------------- |
| 4183 Isolate* isolate = masm->isolate(); |
| 4184 |
| 4185 // Load r2 with the allocation site. We stick an undefined dummy value here |
| 4186 // and replace it with the real allocation site later when we instantiate this |
| 4187 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). |
| 4188 __ Move(r2, handle(isolate->heap()->undefined_value())); |
| 4189 |
| 4190 // Make sure that we actually patched the allocation site. |
| 4191 if (FLAG_debug_code) { |
| 4192 __ tst(r2, Operand(kSmiTagMask)); |
| 4193 __ Assert(ne, kExpectedAllocationSite); |
| 4194 __ push(r2); |
| 4195 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 4196 __ LoadRoot(ip, Heap::kAllocationSiteMapRootIndex); |
| 4197 __ cmp(r2, ip); |
| 4198 __ pop(r2); |
| 4199 __ Assert(eq, kExpectedAllocationSite); |
| 4200 } |
| 4201 |
| 4202 // Tail call into the stub that handles binary operations with allocation |
| 4203 // sites. |
| 4204 BinaryOpWithAllocationSiteStub stub(state_); |
| 4205 __ TailCallStub(&stub); |
| 4206 } |
| 4207 |
| 4208 |
4165 void StringAddStub::Generate(MacroAssembler* masm) { | 4209 void StringAddStub::Generate(MacroAssembler* masm) { |
4166 Label call_runtime, call_builtin; | 4210 Label call_runtime, call_builtin; |
4167 Builtins::JavaScript builtin_id = Builtins::ADD; | 4211 Builtins::JavaScript builtin_id = Builtins::ADD; |
4168 | 4212 |
4169 Counters* counters = masm->isolate()->counters(); | 4213 Counters* counters = masm->isolate()->counters(); |
4170 | 4214 |
4171 // Stack on entry: | 4215 // Stack on entry: |
4172 // sp[0]: second argument (right). | 4216 // sp[0]: second argument (right). |
4173 // sp[4]: first argument (left). | 4217 // sp[4]: first argument (left). |
4174 | 4218 |
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5794 __ bind(&fast_elements_case); | 5838 __ bind(&fast_elements_case); |
5795 GenerateCase(masm, FAST_ELEMENTS); | 5839 GenerateCase(masm, FAST_ELEMENTS); |
5796 } | 5840 } |
5797 | 5841 |
5798 | 5842 |
5799 #undef __ | 5843 #undef __ |
5800 | 5844 |
5801 } } // namespace v8::internal | 5845 } } // namespace v8::internal |
5802 | 5846 |
5803 #endif // V8_TARGET_ARCH_ARM | 5847 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |