Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: src/ia32/code-stubs-ia32.cc

Issue 106453003: Allocation site support for monomorphic StringAdds in BinaryOps. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 2290 matching lines...) Expand 10 before | Expand all | Expand 10 after
2645 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { 2656 void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) {
2646 CEntryStub::GenerateAheadOfTime(isolate); 2657 CEntryStub::GenerateAheadOfTime(isolate);
2647 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate); 2658 StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(isolate);
2648 StubFailureTrampolineStub::GenerateAheadOfTime(isolate); 2659 StubFailureTrampolineStub::GenerateAheadOfTime(isolate);
2649 // It is important that the store buffer overflow stubs are generated first. 2660 // It is important that the store buffer overflow stubs are generated first.
2650 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); 2661 ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate);
2651 CreateAllocationSiteStub::GenerateAheadOfTime(isolate); 2662 CreateAllocationSiteStub::GenerateAheadOfTime(isolate);
2652 if (Serializer::enabled()) { 2663 if (Serializer::enabled()) {
2653 PlatformFeatureScope sse2(SSE2); 2664 PlatformFeatureScope sse2(SSE2);
2654 BinaryOpICStub::GenerateAheadOfTime(isolate); 2665 BinaryOpICStub::GenerateAheadOfTime(isolate);
2666 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
2655 } else { 2667 } else {
2656 BinaryOpICStub::GenerateAheadOfTime(isolate); 2668 BinaryOpICStub::GenerateAheadOfTime(isolate);
2669 BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate);
2657 } 2670 }
2658 } 2671 }
2659 2672
2660 2673
2661 void CodeStub::GenerateFPStubs(Isolate* isolate) { 2674 void CodeStub::GenerateFPStubs(Isolate* isolate) {
2662 if (CpuFeatures::IsSupported(SSE2)) { 2675 if (CpuFeatures::IsSupported(SSE2)) {
2663 CEntryStub save_doubles(1, kSaveFPRegs); 2676 CEntryStub save_doubles(1, kSaveFPRegs);
2664 // Stubs might already be in the snapshot, detect that and don't regenerate, 2677 // Stubs might already be in the snapshot, detect that and don't regenerate,
2665 // which would lead to code stub initialization state being messed up. 2678 // which would lead to code stub initialization state being messed up.
2666 Code* save_doubles_code; 2679 Code* save_doubles_code;
(...skipping 1711 matching lines...) Expand 10 before | Expand all | Expand 10 after
4378 __ push(ecx); 4391 __ push(ecx);
4379 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi); 4392 GenerateCompareFlatAsciiStrings(masm, edx, eax, ecx, ebx, edi);
4380 4393
4381 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) 4394 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater)
4382 // tagged as a small integer. 4395 // tagged as a small integer.
4383 __ bind(&runtime); 4396 __ bind(&runtime);
4384 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); 4397 __ TailCallRuntime(Runtime::kStringCompare, 2, 1);
4385 } 4398 }
4386 4399
4387 4400
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
4388 void ICCompareStub::GenerateSmis(MacroAssembler* masm) { 4430 void ICCompareStub::GenerateSmis(MacroAssembler* masm) {
4389 ASSERT(state_ == CompareIC::SMI); 4431 ASSERT(state_ == CompareIC::SMI);
4390 Label miss; 4432 Label miss;
4391 __ mov(ecx, edx); 4433 __ mov(ecx, edx);
4392 __ or_(ecx, eax); 4434 __ or_(ecx, eax);
4393 __ JumpIfNotSmi(ecx, &miss, Label::kNear); 4435 __ JumpIfNotSmi(ecx, &miss, Label::kNear);
4394 4436
4395 if (GetCondition() == equal) { 4437 if (GetCondition() == equal) {
4396 // For equality we do not care about the sign of the result. 4438 // For equality we do not care about the sign of the result.
4397 __ sub(eax, edx); 4439 __ sub(eax, edx);
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 __ bind(&fast_elements_case); 5713 __ bind(&fast_elements_case);
5672 GenerateCase(masm, FAST_ELEMENTS); 5714 GenerateCase(masm, FAST_ELEMENTS);
5673 } 5715 }
5674 5716
5675 5717
5676 #undef __ 5718 #undef __
5677 5719
5678 } } // namespace v8::internal 5720 } } // namespace v8::internal
5679 5721
5680 #endif // V8_TARGET_ARCH_IA32 5722 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698