Sometimes avoid checking whether the receiver is an object in generated code.

In unoptimized code, use the version of the CallFunctionStub that does not
check whether its receiver is an object in all the cases where we statically
know that it is an object.

R=ager@chromium.org,sgjesse@chromium.org

Review URL: http://codereview.chromium.org/6880268

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b7ab8684
......@@ -2160,7 +2160,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
}
void FullCodeGenerator::EmitCallWithStub(Call* expr) {
void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
// Code common for calls using the call stub.
ZoneList<Expression*>* args = expr->arguments();
int arg_count = args->length();
......@@ -2172,7 +2172,7 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr) {
// Record source position for debugger.
SetSourcePosition(expr->position());
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE);
CallFunctionStub stub(arg_count, in_loop, flags);
__ CallStub(&stub);
RecordJSReturnSite(expr);
// Restore context register.
......@@ -2318,7 +2318,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ bind(&call);
}
EmitCallWithStub(expr);
// The receiver is either the global receiver or a JSObject found by
// LoadContextSlot.
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else if (fun->AsProperty() != NULL) {
// Call to an object property.
Property* prop = fun->AsProperty();
......@@ -2354,7 +2356,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ ldr(r1, GlobalObjectOperand());
__ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
__ Push(r0, r1); // Function, receiver.
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else {
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(prop->obj());
......@@ -2371,7 +2373,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ ldr(r1, FieldMemOperand(r1, GlobalObject::kGlobalReceiverOffset));
__ push(r1);
// Emit function call.
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
}
#ifdef DEBUG
......
......@@ -395,7 +395,7 @@ class FullCodeGenerator: public AstVisitor {
void EmitReturnSequence();
// Platform-specific code sequences for calls
void EmitCallWithStub(Call* expr);
void EmitCallWithStub(Call* expr, CallFunctionFlags flags);
void EmitCallWithIC(Call* expr, Handle<Object> name, RelocInfo::Mode mode);
void EmitKeyedCallWithIC(Call* expr, Expression* key, RelocInfo::Mode mode);
......
......@@ -2076,7 +2076,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
}
void FullCodeGenerator::EmitCallWithStub(Call* expr) {
void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
// Code common for calls using the call stub.
ZoneList<Expression*>* args = expr->arguments();
int arg_count = args->length();
......@@ -2088,7 +2088,7 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr) {
// Record source position for debugger.
SetSourcePosition(expr->position());
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE);
CallFunctionStub stub(arg_count, in_loop, flags);
__ CallStub(&stub);
RecordJSReturnSite(expr);
// Restore context register.
......@@ -2227,7 +2227,9 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ bind(&call);
}
EmitCallWithStub(expr);
// The receiver is either the global receiver or a JSObject found by
// LoadContextSlot.
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else if (fun->AsProperty() != NULL) {
// Call to an object property.
Property* prop = fun->AsProperty();
......@@ -2265,7 +2267,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
// Push Global receiver.
__ mov(ecx, GlobalObjectOperand());
__ push(FieldOperand(ecx, GlobalObject::kGlobalReceiverOffset));
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else {
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(prop->obj());
......@@ -2281,7 +2283,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ mov(ebx, GlobalObjectOperand());
__ push(FieldOperand(ebx, GlobalObject::kGlobalReceiverOffset));
// Emit function call.
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
}
#ifdef DEBUG
......
......@@ -2056,7 +2056,7 @@ void FullCodeGenerator::EmitKeyedCallWithIC(Call* expr,
}
void FullCodeGenerator::EmitCallWithStub(Call* expr) {
void FullCodeGenerator::EmitCallWithStub(Call* expr, CallFunctionFlags flags) {
// Code common for calls using the call stub.
ZoneList<Expression*>* args = expr->arguments();
int arg_count = args->length();
......@@ -2068,7 +2068,7 @@ void FullCodeGenerator::EmitCallWithStub(Call* expr) {
// Record source position for debugger.
SetSourcePosition(expr->position());
InLoopFlag in_loop = (loop_depth() > 0) ? IN_LOOP : NOT_IN_LOOP;
CallFunctionStub stub(arg_count, in_loop, RECEIVER_MIGHT_BE_VALUE);
CallFunctionStub stub(arg_count, in_loop, flags);
__ CallStub(&stub);
RecordJSReturnSite(expr);
// Restore context register.
......@@ -2203,12 +2203,14 @@ void FullCodeGenerator::VisitCall(Call* expr) {
// Push function.
__ push(rax);
// Push global receiver.
__ movq(rbx, GlobalObjectOperand());
__ push(FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));
__ bind(&call);
__ movq(rbx, GlobalObjectOperand());
__ push(FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));
__ bind(&call);
}
EmitCallWithStub(expr);
// The receiver is either the global receiver or a JSObject found by
// LoadContextSlot.
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else if (fun->AsProperty() != NULL) {
// Call to an object property.
Property* prop = fun->AsProperty();
......@@ -2246,7 +2248,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
// Push Global receiver.
__ movq(rcx, GlobalObjectOperand());
__ push(FieldOperand(rcx, GlobalObject::kGlobalReceiverOffset));
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
} else {
{ PreservePositionScope scope(masm()->positions_recorder());
VisitForStackValue(prop->obj());
......@@ -2262,7 +2264,7 @@ void FullCodeGenerator::VisitCall(Call* expr) {
__ movq(rbx, GlobalObjectOperand());
__ push(FieldOperand(rbx, GlobalObject::kGlobalReceiverOffset));
// Emit function call.
EmitCallWithStub(expr);
EmitCallWithStub(expr, NO_CALL_FUNCTION_FLAGS);
}
#ifdef DEBUG
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment