Chromium Code Reviews| Index: src/ia32/code-stubs-ia32.cc |
| diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
| index 4633400688d3f3864d1324967522f28e8888dad1..932020ad8cc7ddbf0bec07f599bb14752ef0ab19 100644 |
| --- a/src/ia32/code-stubs-ia32.cc |
| +++ b/src/ia32/code-stubs-ia32.cc |
| @@ -342,6 +342,17 @@ void BinaryOpICStub::InitializeInterfaceDescriptor( |
| } |
| +void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
| + Isolate* isolate, |
| + CodeStubInterfaceDescriptor* descriptor) { |
| + static Register registers[] = { ecx, edx, eax }; |
| + descriptor->register_param_count_ = 3; |
| + descriptor->register_params_ = registers; |
| + descriptor->deoptimization_handler_ = |
| + FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); |
| +} |
| + |
| + |
| void NewStringAddStub::InitializeInterfaceDescriptor( |
| Isolate* isolate, |
| CodeStubInterfaceDescriptor* descriptor) { |
| @@ -2874,8 +2885,10 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
| if (Serializer::enabled()) { |
| PlatformFeatureScope sse2(SSE2); |
| BinaryOpICStub::GenerateAheadOfTime(isolate); |
| + BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
| } else { |
| BinaryOpICStub::GenerateAheadOfTime(isolate); |
| + BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
| } |
| } |
| @@ -4607,6 +4620,35 @@ void StringCompareStub::Generate(MacroAssembler* masm) { |
| } |
| +void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
| + // ----------- S t a t e ------------- |
| + // -- edx : left |
| + // -- eax : right |
| + // -- esp[0] : return address |
| + // ----------------------------------- |
| + Isolate* isolate = masm->isolate(); |
| + |
| + // Load ecx with the allocation site. We stick an undefined dummy value here |
| + // and replace it with the real allocation site later when we instantiate this |
| + // stub in BinaryOpICWithAllocationSiteStub::GetCodeCopyFromTemplate(). |
| + __ mov(ecx, handle(isolate->heap()->undefined_value())); |
| + |
| + // Make sure that we actually patched the allocation site. |
| + if (FLAG_debug_code) { |
|
mvstanton
2013/12/11 08:15:29
Thx for this debug code block, it's a good idea.
|
| + __ test(ecx, Immediate(kSmiTagMask)); |
| + __ Assert(not_equal, kExpectedAllocationSite); |
| + __ cmp(FieldOperand(ecx, HeapObject::kMapOffset), |
| + isolate->factory()->allocation_site_map()); |
| + __ Assert(equal, kExpectedAllocationSite); |
| + } |
| + |
| + // Tail call into the stub that handles binary operations with allocation |
| + // sites. |
| + BinaryOpWithAllocationSiteStub stub(state_); |
| + __ TailCallStub(&stub); |
| +} |
| + |
| + |
| void ICCompareStub::GenerateSmis(MacroAssembler* masm) { |
| ASSERT(state_ == CompareIC::SMI); |
| Label miss; |