Index: src/x64/code-stubs-x64.cc |
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc |
index 5b5212c7e07c9cc2b2e8522897b11c600030a739..920843dfe3f77560dd7ac3fa5cab6a03f4877e97 100644 |
--- a/src/x64/code-stubs-x64.cc |
+++ b/src/x64/code-stubs-x64.cc |
@@ -180,18 +180,6 @@ void TransitionElementsKindStub::InitializeInterfaceDescriptor( |
} |
-void BinaryOpICStub::InitializeInterfaceDescriptor( |
- Isolate* isolate, |
- CodeStubInterfaceDescriptor* descriptor) { |
- static Register registers[] = { rdx, rax }; |
- descriptor->register_param_count_ = 2; |
- descriptor->register_params_ = registers; |
- descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
- descriptor->SetMissHandler( |
- ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
-} |
- |
- |
static void InitializeArrayConstructorDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor, |
@@ -339,6 +327,29 @@ void ElementsTransitionAndStoreStub::InitializeInterfaceDescriptor( |
} |
+void BinaryOpICStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ static Register registers[] = { rdx, rax }; |
+ descriptor->register_param_count_ = 2; |
+ descriptor->register_params_ = registers; |
+ descriptor->deoptimization_handler_ = FUNCTION_ADDR(BinaryOpIC_Miss); |
+ descriptor->SetMissHandler( |
+ ExternalReference(IC_Utility(IC::kBinaryOpIC_Miss), isolate)); |
+} |
+ |
+ |
+void BinaryOpWithAllocationSiteStub::InitializeInterfaceDescriptor( |
+ Isolate* isolate, |
+ CodeStubInterfaceDescriptor* descriptor) { |
+ static Register registers[] = { rcx, rdx, rax }; |
+ descriptor->register_param_count_ = 3; |
+ descriptor->register_params_ = registers; |
+ descriptor->deoptimization_handler_ = |
+ FUNCTION_ADDR(BinaryOpIC_MissWithAllocationSite); |
+} |
+ |
+ |
void NewStringAddStub::InitializeInterfaceDescriptor( |
Isolate* isolate, |
CodeStubInterfaceDescriptor* descriptor) { |
@@ -2483,6 +2494,7 @@ void CodeStub::GenerateStubsAheadOfTime(Isolate* isolate) { |
ArrayConstructorStubBase::GenerateStubsAheadOfTime(isolate); |
CreateAllocationSiteStub::GenerateAheadOfTime(isolate); |
BinaryOpICStub::GenerateAheadOfTime(isolate); |
+ BinaryOpICWithAllocationSiteStub::GenerateAheadOfTime(isolate); |
} |
@@ -4229,6 +4241,35 @@ void StringCompareStub::Generate(MacroAssembler* masm) { |
} |
+void BinaryOpICWithAllocationSiteStub::Generate(MacroAssembler* masm) { |
+ // ----------- S t a t e ------------- |
+ // -- rdx : left |
+ // -- rax : right |
+ // -- rsp[0] : return address |
+ // ----------------------------------- |
+ Isolate* isolate = masm->isolate(); |
+ |
+ // Load rcx 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(). |
+ __ Move(rcx, handle(isolate->heap()->undefined_value())); |
+ |
+ // Make sure that we actually patched the allocation site. |
+ if (FLAG_debug_code) { |
+ __ testb(rcx, Immediate(kSmiTagMask)); |
+ __ Assert(zero, kExpectedAllocationSite); |
+ __ Cmp(FieldOperand(rcx, 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; |