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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 | 1656 |
1646 | 1657 |
1647 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 1658 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
1648 CEntryStub::GenerateAheadOfTime(isolate); | 1659 CEntryStub::GenerateAheadOfTime(isolate); |
1649 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1660 WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1650 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 1661 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
1651 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 1662 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
1652 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 1663 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
1653 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 1664 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
1654 BinaryOpICStub::GenerateAheadOfTime(isolate); | 1665 BinaryOpICStub::GenerateAheadOfTime(isolate); |
| 1666 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
1655 } | 1667 } |
1656 | 1668 |
1657 | 1669 |
1658 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 1670 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
1659 SaveFPRegsMode mode = kSaveFPRegs; | 1671 SaveFPRegsMode mode = kSaveFPRegs; |
1660 CEntryStub save_doubles(1, mode); | 1672 CEntryStub save_doubles(1, mode); |
1661 StoreBufferOverflowStub stub(mode); | 1673 StoreBufferOverflowStub stub(mode); |
1662 // These stubs might already be in the snapshot, detect that and don't | 1674 // These stubs might already be in the snapshot, detect that and don't |
1663 // regenerate, which would lead to code stub initialization state being messed | 1675 // regenerate, which would lead to code stub initialization state being messed |
1664 // up. | 1676 // up. |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4360 __ add(sp, sp, Operand(2 * kPointerSize)); | 4372 __ add(sp, sp, Operand(2 * kPointerSize)); |
4361 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); | 4373 GenerateCompareFlatAsciiStrings(masm, r1, r0, r2, r3, r4, r5); |
4362 | 4374 |
4363 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4375 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
4364 // tagged as a small integer. | 4376 // tagged as a small integer. |
4365 __ bind(&runtime); | 4377 __ bind(&runtime); |
4366 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4378 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4367 } | 4379 } |
4368 | 4380 |
4369 | 4381 |
| 4382 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
| 4383 // ----------- S t a t e ------------- |
| 4384 // -- r1 : left |
| 4385 // -- r0 : right |
| 4386 // -- lr : return address |
| 4387 // ----------------------------------- |
| 4388 Isolate* isolate = masm->isolate(); |
| 4389 |
| 4390 // Load r2 with the allocation site. We stick an undefined dummy value here |
| 4391 // and replace it with the real allocation site later when we instantiate this |
| 4392 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). |
| 4393 __ Move(r2, handle(isolate->heap()->undefined_value())); |
| 4394 |
| 4395 // Make sure that we actually patched the allocation site. |
| 4396 if (FLAG_debug_code) { |
| 4397 __ tst(r2, Operand(kSmiTagMask)); |
| 4398 __ Assert(ne, kExpectedAllocationSite); |
| 4399 __ push(r2); |
| 4400 __ ldr(r2, FieldMemOperand(r2, HeapObject::kMapOffset)); |
| 4401 __ LoadRoot(ip, Heap::kAllocationSiteMapRootIndex); |
| 4402 __ cmp(r2, ip); |
| 4403 __ pop(r2); |
| 4404 __ Assert(eq, kExpectedAllocationSite); |
| 4405 } |
| 4406 |
| 4407 // Tail call into the stub that handles binary operations with allocation |
| 4408 // sites. |
| 4409 BinaryOpWithAllocationSiteStub stub(state_); |
| 4410 __ TailCallStub(&stub); |
| 4411 } |
| 4412 |
| 4413 |
4370 void StringAddStub::Generate(MacroAssembler* masm) { | 4414 void StringAddStub::Generate(MacroAssembler* masm) { |
4371 Label call_runtime, call_builtin; | 4415 Label call_runtime, call_builtin; |
4372 Builtins::JavaScript builtin_id = Builtins::ADD; | 4416 Builtins::JavaScript builtin_id = Builtins::ADD; |
4373 | 4417 |
4374 Counters* counters = masm->isolate()->counters(); | 4418 Counters* counters = masm->isolate()->counters(); |
4375 | 4419 |
4376 // Stack on entry: | 4420 // Stack on entry: |
4377 // sp[0]: second argument (right). | 4421 // sp[0]: second argument (right). |
4378 // sp[4]: first argument (left). | 4422 // sp[4]: first argument (left). |
4379 | 4423 |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6015 __ bind(&fast_elements_case); | 6059 __ bind(&fast_elements_case); |
6016 GenerateCase(masm, FAST_ELEMENTS); | 6060 GenerateCase(masm, FAST_ELEMENTS); |
6017 } | 6061 } |
6018 | 6062 |
6019 | 6063 |
6020 #undef __ | 6064 #undef __ |
6021 | 6065 |
6022 } } // namespace v8::internal | 6066 } } // namespace v8::internal |
6023 | 6067 |
6024 #endif // V8_TARGET_ARCH_ARM | 6068 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |