Index: src/ia32/code-stubs-ia32.cc |
diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc |
index 208bd91a0db7cc6a74fc879e681a8bece0e930e6..305a6d854c34a3e370610ac4f719f139bc271e87 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) { |
@@ -2652,8 +2663,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); |
} |
} |
@@ -4385,6 +4398,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) { |
+ __ 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; |