Index: src/arm64/full-codegen-arm64.cc |
diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc |
index f04bd7ad5dba4ec70b75571d9f14bea24f240035..7711ace6a62a508f21eecc6a9e5deee1970d84fb 100644 |
--- a/src/arm64/full-codegen-arm64.cc |
+++ b/src/arm64/full-codegen-arm64.cc |
@@ -2331,16 +2331,15 @@ void FullCodeGenerator::CallIC(Handle<Code> code, |
// Code common for calls using the IC. |
-void FullCodeGenerator::EmitCallWithIC(Call* expr) { |
- ASM_LOCATION("EmitCallWithIC"); |
- |
+void FullCodeGenerator::EmitCallWithLoadIC(Call* expr) { |
Expression* callee = expr->expression(); |
- ZoneList<Expression*>* args = expr->arguments(); |
- int arg_count = args->length(); |
- CallFunctionFlags flags; |
+ CallIC::CallType call_type = callee->IsVariableProxy() |
+ ? CallIC::FUNCTION |
+ : CallIC::METHOD; |
+ |
// Get the target function. |
- if (callee->IsVariableProxy()) { |
+ if (call_type == CallIC::FUNCTION) { |
{ StackValueContext context(this); |
EmitVariableLoad(callee->AsVariableProxy()); |
PrepareForBailout(callee, NO_REGISTERS); |
@@ -2348,7 +2347,6 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr) { |
// Push undefined as receiver. This is patched in the method prologue if it |
// is a sloppy mode method. |
__ Push(isolate()->factory()->undefined_value()); |
- flags = NO_CALL_FUNCTION_FLAGS; |
} else { |
// Load the function from the receiver. |
ASSERT(callee->IsProperty()); |
@@ -2358,40 +2356,19 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr) { |
// Push the target function under the receiver. |
__ Pop(x10); |
__ Push(x0, x10); |
- flags = CALL_AS_METHOD; |
- } |
- |
- // Load the arguments. |
- { PreservePositionScope scope(masm()->positions_recorder()); |
- for (int i = 0; i < arg_count; i++) { |
- VisitForStackValue(args->at(i)); |
- } |
} |
- // Record source position for debugger. |
- SetSourcePosition(expr->position()); |
- CallFunctionStub stub(arg_count, flags); |
- __ Peek(x1, (arg_count + 1) * kPointerSize); |
- __ CallStub(&stub); |
- |
- RecordJSReturnSite(expr); |
- |
- // Restore context register. |
- __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
- |
- context()->DropAndPlug(1, x0); |
+ EmitCall(expr, call_type); |
} |
// Code common for calls using the IC. |
-void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
- Expression* key) { |
+void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, |
+ Expression* key) { |
// Load the key. |
VisitForAccumulatorValue(key); |
Expression* callee = expr->expression(); |
- ZoneList<Expression*>* args = expr->arguments(); |
- int arg_count = args->length(); |
// Load the function from the receiver. |
ASSERT(callee->IsProperty()); |
@@ -2403,28 +2380,12 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr, |
__ Pop(x10); |
__ Push(x0, x10); |
- { PreservePositionScope scope(masm()->positions_recorder()); |
- for (int i = 0; i < arg_count; i++) { |
- VisitForStackValue(args->at(i)); |
- } |
- } |
- |
- // Record source position for debugger. |
- SetSourcePosition(expr->position()); |
- CallFunctionStub stub(arg_count, CALL_AS_METHOD); |
- __ Peek(x1, (arg_count + 1) * kPointerSize); |
- __ CallStub(&stub); |
- |
- RecordJSReturnSite(expr); |
- // Restore context register. |
- __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
- |
- context()->DropAndPlug(1, x0); |
+ EmitCall(expr, CallIC::METHOD); |
} |
-void FullCodeGenerator::EmitCallWithStub(Call* expr) { |
- // Code common for calls using the call stub. |
+void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { |
+ // Load the arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
{ PreservePositionScope scope(masm()->positions_recorder()); |
@@ -2432,16 +2393,17 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr) { |
VisitForStackValue(args->at(i)); |
} |
} |
- // Record source position for debugger. |
+ // Record source position of the IC call. |
SetSourcePosition(expr->position()); |
- __ LoadObject(x2, FeedbackVector()); |
+ Handle<Code> ic = CallIC::initialize_stub( |
+ isolate(), arg_count, call_type); |
__ Mov(x3, Smi::FromInt(expr->CallFeedbackSlot())); |
- |
- // Record call targets in unoptimized code. |
- CallFunctionStub stub(arg_count, RECORD_CALL_TARGET); |
__ Peek(x1, (arg_count + 1) * kXRegSize); |
- __ CallStub(&stub); |
+ // Don't assign a type feedback id to the IC, since type feedback is provided |
+ // by the vector above. |
+ CallIC(ic); |
+ |
RecordJSReturnSite(expr); |
// Restore context register. |
__ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
@@ -2533,7 +2495,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
context()->DropAndPlug(1, x0); |
} else if (call_type == Call::GLOBAL_CALL) { |
- EmitCallWithIC(expr); |
+ EmitCallWithLoadIC(expr); |
} else if (call_type == Call::LOOKUP_SLOT_CALL) { |
// Call to a lookup slot (dynamically introduced variable). |
@@ -2573,16 +2535,16 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
// The receiver is either the global receiver or an object found |
// by LoadContextSlot. |
- EmitCallWithStub(expr); |
+ EmitCall(expr); |
} else if (call_type == Call::PROPERTY_CALL) { |
Property* property = callee->AsProperty(); |
{ PreservePositionScope scope(masm()->positions_recorder()); |
VisitForStackValue(property->obj()); |
} |
if (property->key()->IsPropertyName()) { |
- EmitCallWithIC(expr); |
+ EmitCallWithLoadIC(expr); |
} else { |
- EmitKeyedCallWithIC(expr, property->key()); |
+ EmitKeyedCallWithLoadIC(expr, property->key()); |
} |
} else { |
@@ -2594,7 +2556,7 @@ void FullCodeGenerator::VisitCall(Call* expr) { |
__ LoadRoot(x1, Heap::kUndefinedValueRootIndex); |
__ Push(x1); |
// Emit function call. |
- EmitCallWithStub(expr); |
+ EmitCall(expr); |
} |
#ifdef DEBUG |
@@ -2640,7 +2602,7 @@ void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
__ LoadObject(x2, FeedbackVector()); |
__ Mov(x3, Smi::FromInt(expr->CallNewFeedbackSlot())); |
- CallConstructStub stub(RECORD_CALL_TARGET); |
+ CallConstructStub stub(RECORD_CONSTRUCTOR_TARGET); |
__ Call(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL); |
PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
context()->Plug(x0); |