| 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 | |
| 356 void NewStringAddStub::InitializeInterfaceDescriptor( | 345 void NewStringAddStub::InitializeInterfaceDescriptor( |
| 357 Isolate* isolate, | 346 Isolate* isolate, |
| 358 CodeStubInterfaceDescriptor* descriptor) { | 347 CodeStubInterfaceDescriptor* descriptor) { |
| 359 static Register registers[] = { edx, eax }; | 348 static Register registers[] = { edx, eax }; |
| 360 descriptor->register_param_count_ = 2; | 349 descriptor->register_param_count_ = 2; |
| 361 descriptor->register_params_ = registers; | 350 descriptor->register_params_ = registers; |
| 362 descriptor->deoptimization_handler_ = | 351 descriptor->deoptimization_handler_ = |
| 363 Runtime::FunctionForId(Runtime::kStringAdd)->entry; | 352 Runtime::FunctionForId(Runtime::kStringAdd)->entry; |
| 364 } | 353 } |
| 365 | 354 |
| (...skipping 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2656 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { | 2645 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
| 2657 CEntryStub::GenerateAheadOfTime(isolate); | 2646 CEntryStub::GenerateAheadOfTime(isolate); |
| 2658 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); | 2647 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); |
| 2659 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); | 2648 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); |
| 2660 // It is important that the store buffer overflow stubs are generated first. | 2649 // It is important that the store buffer overflow stubs are generated first. |
| 2661 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); | 2650 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
| 2662 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); | 2651 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
| 2663 if (Serializer::enabled()) { | 2652 if (Serializer::enabled()) { |
| 2664 PlatformFeatureScope sse2(SSE2); | 2653 PlatformFeatureScope sse2(SSE2); |
| 2665 BinaryOpICStub::GenerateAheadOfTime(isolate); | 2654 BinaryOpICStub::GenerateAheadOfTime(isolate); |
| 2666 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
| 2667 } else { | 2655 } else { |
| 2668 BinaryOpICStub::GenerateAheadOfTime(isolate); | 2656 BinaryOpICStub::GenerateAheadOfTime(isolate); |
| 2669 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); | |
| 2670 } | 2657 } |
| 2671 } | 2658 } |
| 2672 | 2659 |
| 2673 | 2660 |
| 2674 void CodeStub::GenerateFPStubs(Isolate* isolate) { | 2661 void CodeStub::GenerateFPStubs(Isolate* isolate) { |
| 2675 if (CpuFeatures::IsSupported(SSE2)) { | 2662 if (CpuFeatures::IsSupported(SSE2)) { |
| 2676 CEntryStub save_doubles(1, kSaveFPRegs); | 2663 CEntryStub save_doubles(1, kSaveFPRegs); |
| 2677 // Stubs might already be in the snapshot, detect that and don't regenerate, | 2664 // Stubs might already be in the snapshot, detect that and don't regenerate, |
| 2678 // which would lead to code stub initialization state being messed up. | 2665 // which would lead to code stub initialization state being messed up. |
| 2679 Code* save_doubles_code; | 2666 Code* save_doubles_code; |
| (...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4391 __ push(ecx); | 4378 __ push(ecx); |
| 4392 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); | 4379 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); |
| 4393 | 4380 |
| 4394 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 4381 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 4395 // tagged as a small integer. | 4382 // tagged as a small integer. |
| 4396 __ bind(&runtime); | 4383 __ bind(&runtime); |
| 4397 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 4384 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 4398 } | 4385 } |
| 4399 | 4386 |
| 4400 | 4387 |
| 4401 void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { | |
| 4402 // ----------- S t a t e ------------- | |
| 4403 // -- edx : left | |
| 4404 // -- eax : right | |
| 4405 // -- esp[0] : return address | |
| 4406 // ----------------------------------- | |
| 4407 Isolate* isolate = masm->isolate(); | |
| 4408 | |
| 4409 // Load ecx with the allocation site. We stick an undefined dummy value here | |
| 4410 // and replace it with the real allocation site later when we instantiate this | |
| 4411 // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). | |
| 4412 __ mov(ecx, handle(isolate->heap()->undefined_value())); | |
| 4413 | |
| 4414 // Make sure that we actually patched the allocation site. | |
| 4415 if (FLAG_debug_code) { | |
| 4416 __ test(ecx, Immediate(kSmiTagMask)); | |
| 4417 __ Assert(not_equal, kExpectedAllocationSite); | |
| 4418 __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), | |
| 4419 isolate->factory()->allocation_site_map()); | |
| 4420 __ Assert(equal, kExpectedAllocationSite); | |
| 4421 } | |
| 4422 | |
| 4423 // Tail call into the stub that handles binary operations with allocation | |
| 4424 // sites. | |
| 4425 BinaryOpWithAllocationSiteStub stub(state_); | |
| 4426 __ TailCallStub(&stub); | |
| 4427 } | |
| 4428 | |
| 4429 | |
| 4430 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { | 4388 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
| 4431 ASSERT(state_ == CompareIC::SMI); | 4389 ASSERT(state_ == CompareIC::SMI); |
| 4432 Label miss; | 4390 Label miss; |
| 4433 __ mov(ecx, edx); | 4391 __ mov(ecx, edx); |
| 4434 __ or_(ecx, eax); | 4392 __ or_(ecx, eax); |
| 4435 __ JumpIfNotSmi(ecx, &miss, Label::kNear); | 4393 __ JumpIfNotSmi(ecx, &miss, Label::kNear); |
| 4436 | 4394 |
| 4437 if (GetCondition() == equal) { | 4395 if (GetCondition() == equal) { |
| 4438 // For equality we do not care about the sign of the result. | 4396 // For equality we do not care about the sign of the result. |
| 4439 __ sub(eax, edx); | 4397 __ sub(eax, edx); |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5713 __ bind(&fast_elements_case); | 5671 __ bind(&fast_elements_case); |
| 5714 GenerateCase(masm, FAST_ELEMENTS); | 5672 GenerateCase(masm, FAST_ELEMENTS); |
| 5715 } | 5673 } |
| 5716 | 5674 |
| 5717 | 5675 |
| 5718 #undef __ | 5676 #undef __ |
| 5719 | 5677 |
| 5720 } } // namespace v8::internal | 5678 } } // namespace v8::internal |
| 5721 | 5679 |
| 5722 #endif // V8_TARGET_ARCH_IA32 | 5680 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |