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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
335 CodeStubInterfaceDescriptor* descriptor) { | 335 CodeStubInterfaceDescriptor* descriptor) { |
336 static Register registers[] = { edx, eax }; | 336 static Register registers[] = { edx, eax }; |
337 descriptor->register_param_count_ = 2; | 337 descriptor->register_param_count_ = 2; |
338 descriptor->register_params_ = registers; | 338 descriptor->register_params_ = registers; |
339 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); | 339 descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
340 descriptor->SetMissHandler( | 340 descriptor->SetMissHandler( |
341 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); | 341 ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
342 } | 342 } |
343 | 343 |
344 | 344 |
345 void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( | |
346 Isolate* isolate, | |
347 CodeStubInterfaceDescriptor* descriptor) { | |
348 static Register registers[] = { ecx, edx, eax }; | |
349 descriptor->register_param_count_ = 3; | |
350 descriptor->register_params_ = registers; | |
351 descriptor->deoptimization_handler_ = | |
352 FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); | |
353 } | |
354 | |
355 | |
345 void NewStringAddStub::InitializeInterfaceDescriptor( | 356 void NewStringAddStub::InitializeInterfaceDescriptor( |
346 Isolate* isolate, | 357 Isolate* isolate, |
347 CodeStubInterfaceDescriptor* descriptor) { | 358 CodeStubInterfaceDescriptor* descriptor) { |
348 static Register registers[] = { edx, eax }; | 359 static Register registers[] = { edx, eax }; |
349 descriptor->register_param_count_ = 2; | 360 descriptor->register_param_count_ = 2; |
350 descriptor->register_params_ = registers; | 361 descriptor->register_params_ = registers; |
351 descriptor->deoptimization_handler_ = | 362 descriptor->deoptimization_handler_ = |
352 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 363 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
353 } | 364 } |
354 | 365 |
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2867 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2878 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
2868 CEntryStub::GenerateAheadOfTime(isolate); | 2879 CEntryStub::GenerateAheadOfTime(isolate); |
2869 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 2880 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
2870 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 2881 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
2871 // It is important that the store buffer overflow stubs are generated first. | 2882 // It is important that the store buffer overflow stubs are generated first. |
2872 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 2883 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
2873 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 2884 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
2874 if (Serializer::enabled()) { | 2885 if (Serializer::enabled()) { |
2875 PlatformFeatureScope sse2(SSE2); | 2886 PlatformFeatureScope sse2(SSE2); |
2876 BinaryOpICStub::GenerateAheadOfTime(isolate); | 2887 BinaryOpICStub::GenerateAheadOfTime(isolate); |
2888 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
2877 } else { | 2889 } else { |
2878 BinaryOpICStub::GenerateAheadOfTime(isolate); | 2890 BinaryOpICStub::GenerateAheadOfTime(isolate); |
2891 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
2879 } | 2892 } |
2880 } | 2893 } |
2881 | 2894 |
2882 | 2895 |
2883 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 2896 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
2884 if (CpuFeatures::IsSupported(SSE2)) { | 2897 if (CpuFeatures::IsSupported(SSE2)) { |
2885 CEntryStub save_doubles(1, kSaveFPRegs); | 2898 CEntryStub save_doubles(1, kSaveFPRegs); |
2886 // Stubs might already be in the snapshot, detect that and don't regenerate, | 2899 // Stubs might already be in the snapshot, detect that and don't regenerate, |
2887 // which would lead to code stub initialization state being messed up. | 2900 // which would lead to code stub initialization state being messed up. |
2888 Code* save_doubles_code; | 2901 Code* save_doubles_code; |
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4600 __ push(ecx); | 4613 __ push(ecx); |
4601 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); | 4614 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); |
4602 | 4615 |
4603 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4616 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
4604 // tagged as a small integer. | 4617 // tagged as a small integer. |
4605 __ bind(&runtime); | 4618 __ bind(&runtime); |
4606 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4619 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
4607 } | 4620 } |
4608 | 4621 |
4609 | 4622 |
4623 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | |
4624 // ----------- S t a t e ------------- | |
4625 // -- edx : left | |
4626 // -- eax : right | |
4627 // -- esp[0] : return address | |
4628 // ----------------------------------- | |
4629 Isolate* isolate = masm->isolate(); | |
4630 | |
4631 // Load ecx with the allocation site. We stick an undefined dummy value here | |
4632 // and replace it with the real allocation site later when we instantiate this | |
4633 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | |
4634 __ mov(ecx, handle(isolate->heap()->undefined_value())); | |
4635 | |
4636 // Make sure that we actually patched the allocation site. | |
4637 if (FLAG_debug_code) { | |
mvstanton
2013/12/11 08:15:29
Thx for this debug code block, it's a good idea.
| |
4638 __ test(ecx, Immediate(kSmiTagMask)); | |
4639 __ Assert(not_equal, kExpectedAllocationSite); | |
4640 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), | |
4641 isolate->factory()->allocation_site_map()); | |
4642 __ Assert(equal, kExpectedAllocationSite); | |
4643 } | |
4644 | |
4645 // Tail call into the stub that handles binary operations with allocation | |
4646 // sites. | |
4647 BinaryOpWithAllocationSiteStub stub(state_); | |
4648 __ TailCallStub(&stub); | |
4649 } | |
4650 | |
4651 | |
4610 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 4652 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
4611 ASSERT(state_ == CompareIC::SMI); | 4653 ASSERT(state_ == CompareIC::SMI); |
4612 Label miss; | 4654 Label miss; |
4613 __ mov(ecx, edx); | 4655 __ mov(ecx, edx); |
4614 __ or_(ecx, eax); | 4656 __ or_(ecx, eax); |
4615 __ JumpIfNotSmi(ecx, &miss, Label::kNear); | 4657 __ JumpIfNotSmi(ecx, &miss, Label::kNear); |
4616 | 4658 |
4617 if (GetCondition() == equal) { | 4659 if (GetCondition() == equal) { |
4618 // For equality we do not care about the sign of the result. | 4660 // For equality we do not care about the sign of the result. |
4619 __ sub(eax, edx); | 4661 __ sub(eax, edx); |
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5893 __ bind(&fast_elements_case); | 5935 __ bind(&fast_elements_case); |
5894 GenerateCase(masm, FAST_ELEMENTS); | 5936 GenerateCase(masm, FAST_ELEMENTS); |
5895 } | 5937 } |
5896 | 5938 |
5897 | 5939 |
5898 #undef __ | 5940 #undef __ |
5899 | 5941 |
5900 } } // namespace v8::internal | 5942 } } // namespace v8::internal |
5901 | 5943 |
5902 #endif // V8_TARGET_ARCH_IA32 | 5944 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |