Change calling convention of BinaryOperation code generation functions on x64 platform to match ia32 platform.
Review URL: http://codereview.chromium.org/1844002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4568 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
1790c3534a
commit
130d6adf78
@ -1258,8 +1258,6 @@ void CodeGenerator::GenericBinaryOperation(BinaryOperation* expr,
|
|||||||
Result answer;
|
Result answer;
|
||||||
if (left_is_string) {
|
if (left_is_string) {
|
||||||
if (right_is_string) {
|
if (right_is_string) {
|
||||||
// TODO(lrn): if both are constant strings
|
|
||||||
// -- do a compile time cons, if allocation during codegen is allowed.
|
|
||||||
StringAddStub stub(NO_STRING_CHECK_IN_STUB);
|
StringAddStub stub(NO_STRING_CHECK_IN_STUB);
|
||||||
answer = frame_->CallStub(&stub, 2);
|
answer = frame_->CallStub(&stub, 2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2684,8 +2684,9 @@ void CodeGenerator::VisitAssignment(Assignment* node) {
|
|||||||
target.GetValue();
|
target.GetValue();
|
||||||
}
|
}
|
||||||
Load(node->value());
|
Load(node->value());
|
||||||
GenericBinaryOperation(node->binary_op(),
|
BinaryOperation expr(node, node->binary_op(), node->target(),
|
||||||
node->type(),
|
node->value());
|
||||||
|
GenericBinaryOperation(&expr,
|
||||||
overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
|
overwrite_value ? OVERWRITE_RIGHT : NO_OVERWRITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3542,7 +3543,7 @@ void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) {
|
|||||||
Load(node->left());
|
Load(node->left());
|
||||||
Load(node->right());
|
Load(node->right());
|
||||||
}
|
}
|
||||||
GenericBinaryOperation(node->op(), node->type(), overwrite_mode);
|
GenericBinaryOperation(node, overwrite_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6086,10 +6087,10 @@ static TypeInfo CalculateTypeInfo(TypeInfo operands_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CodeGenerator::GenericBinaryOperation(Token::Value op,
|
void CodeGenerator::GenericBinaryOperation(BinaryOperation* expr,
|
||||||
StaticType* type,
|
|
||||||
OverwriteMode overwrite_mode) {
|
OverwriteMode overwrite_mode) {
|
||||||
Comment cmnt(masm_, "[ BinaryOperation");
|
Comment cmnt(masm_, "[ BinaryOperation");
|
||||||
|
Token::Value op = expr->op();
|
||||||
Comment cmnt_token(masm_, Token::String(op));
|
Comment cmnt_token(masm_, Token::String(op));
|
||||||
|
|
||||||
if (op == Token::COMMA) {
|
if (op == Token::COMMA) {
|
||||||
@ -6115,8 +6116,6 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op,
|
|||||||
Result answer;
|
Result answer;
|
||||||
if (left_is_string) {
|
if (left_is_string) {
|
||||||
if (right_is_string) {
|
if (right_is_string) {
|
||||||
// TODO(lrn): if both are constant strings
|
|
||||||
// -- do a compile time cons, if allocation during codegen is allowed.
|
|
||||||
StringAddStub stub(NO_STRING_CHECK_IN_STUB);
|
StringAddStub stub(NO_STRING_CHECK_IN_STUB);
|
||||||
answer = frame_->CallStub(&stub, 2);
|
answer = frame_->CallStub(&stub, 2);
|
||||||
} else {
|
} else {
|
||||||
@ -6155,25 +6154,29 @@ void CodeGenerator::GenericBinaryOperation(Token::Value op,
|
|||||||
|
|
||||||
Result answer;
|
Result answer;
|
||||||
if (left_is_non_smi_constant || right_is_non_smi_constant) {
|
if (left_is_non_smi_constant || right_is_non_smi_constant) {
|
||||||
|
// Go straight to the slow case, with no smi code.
|
||||||
GenericBinaryOpStub stub(op,
|
GenericBinaryOpStub stub(op,
|
||||||
overwrite_mode,
|
overwrite_mode,
|
||||||
NO_SMI_CODE_IN_STUB,
|
NO_SMI_CODE_IN_STUB,
|
||||||
operands_type);
|
operands_type);
|
||||||
answer = stub.GenerateCall(masm_, frame_, &left, &right);
|
answer = stub.GenerateCall(masm_, frame_, &left, &right);
|
||||||
} else if (right_is_smi_constant) {
|
} else if (right_is_smi_constant) {
|
||||||
answer = ConstantSmiBinaryOperation(op, &left, right.handle(),
|
answer = ConstantSmiBinaryOperation(expr, &left, right.handle(),
|
||||||
type, false, overwrite_mode);
|
false, overwrite_mode);
|
||||||
} else if (left_is_smi_constant) {
|
} else if (left_is_smi_constant) {
|
||||||
answer = ConstantSmiBinaryOperation(op, &right, left.handle(),
|
answer = ConstantSmiBinaryOperation(expr, &right, left.handle(),
|
||||||
type, true, overwrite_mode);
|
true, overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
// Set the flags based on the operation, type and loop nesting level.
|
// Set the flags based on the operation, type and loop nesting level.
|
||||||
// Bit operations always assume they likely operate on Smis. Still only
|
// Bit operations always assume they likely operate on Smis. Still only
|
||||||
// generate the inline Smi check code if this operation is part of a loop.
|
// generate the inline Smi check code if this operation is part of a loop.
|
||||||
// For all other operations only inline the Smi check code for likely smis
|
// For all other operations only inline the Smi check code for likely smis
|
||||||
// if the operation is part of a loop.
|
// if the operation is part of a loop.
|
||||||
if (loop_nesting() > 0 && (Token::IsBitOp(op) || type->IsLikelySmi())) {
|
if (loop_nesting() > 0 &&
|
||||||
answer = LikelySmiBinaryOperation(op, &left, &right, overwrite_mode);
|
(Token::IsBitOp(op) ||
|
||||||
|
operands_type.IsInteger32() ||
|
||||||
|
expr->type()->IsLikelySmi())) {
|
||||||
|
answer = LikelySmiBinaryOperation(expr, &left, &right, overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
GenericBinaryOpStub stub(op,
|
GenericBinaryOpStub stub(op,
|
||||||
overwrite_mode,
|
overwrite_mode,
|
||||||
@ -6265,26 +6268,22 @@ void DeferredInlineSmiOperation::Generate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
Result CodeGenerator::ConstantSmiBinaryOperation(BinaryOperation* expr,
|
||||||
Result* operand,
|
Result* operand,
|
||||||
Handle<Object> value,
|
Handle<Object> value,
|
||||||
StaticType* type,
|
|
||||||
bool reversed,
|
bool reversed,
|
||||||
OverwriteMode overwrite_mode) {
|
OverwriteMode overwrite_mode) {
|
||||||
// NOTE: This is an attempt to inline (a bit) more of the code for
|
// NOTE: This is an attempt to inline (a bit) more of the code for
|
||||||
// some possible smi operations (like + and -) when (at least) one
|
// some possible smi operations (like + and -) when (at least) one
|
||||||
// of the operands is a constant smi.
|
// of the operands is a constant smi.
|
||||||
// Consumes the argument "operand".
|
// Consumes the argument "operand".
|
||||||
|
|
||||||
// TODO(199): Optimize some special cases of operations involving a
|
|
||||||
// smi literal (multiply by 2, shift by 0, etc.).
|
|
||||||
if (IsUnsafeSmi(value)) {
|
if (IsUnsafeSmi(value)) {
|
||||||
Result unsafe_operand(value);
|
Result unsafe_operand(value);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
return LikelySmiBinaryOperation(op, &unsafe_operand, operand,
|
return LikelySmiBinaryOperation(expr, &unsafe_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
return LikelySmiBinaryOperation(op, operand, &unsafe_operand,
|
return LikelySmiBinaryOperation(expr, operand, &unsafe_operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6293,6 +6292,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
Smi* smi_value = Smi::cast(*value);
|
Smi* smi_value = Smi::cast(*value);
|
||||||
int int_value = smi_value->value();
|
int int_value = smi_value->value();
|
||||||
|
|
||||||
|
Token::Value op = expr->op();
|
||||||
Result answer;
|
Result answer;
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case Token::ADD: {
|
case Token::ADD: {
|
||||||
@ -6321,7 +6321,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
case Token::SUB: {
|
case Token::SUB: {
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
Result constant_operand(value);
|
Result constant_operand(value);
|
||||||
answer = LikelySmiBinaryOperation(op, &constant_operand, operand,
|
answer = LikelySmiBinaryOperation(expr, &constant_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
operand->ToRegister();
|
operand->ToRegister();
|
||||||
@ -6344,7 +6344,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
case Token::SAR:
|
case Token::SAR:
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
Result constant_operand(value);
|
Result constant_operand(value);
|
||||||
answer = LikelySmiBinaryOperation(op, &constant_operand, operand,
|
answer = LikelySmiBinaryOperation(expr, &constant_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
// Only the least significant 5 bits of the shift value are used.
|
// Only the least significant 5 bits of the shift value are used.
|
||||||
@ -6370,7 +6370,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
case Token::SHR:
|
case Token::SHR:
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
Result constant_operand(value);
|
Result constant_operand(value);
|
||||||
answer = LikelySmiBinaryOperation(op, &constant_operand, operand,
|
answer = LikelySmiBinaryOperation(expr, &constant_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
// Only the least significant 5 bits of the shift value are used.
|
// Only the least significant 5 bits of the shift value are used.
|
||||||
@ -6398,7 +6398,7 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
case Token::SHL:
|
case Token::SHL:
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
Result constant_operand(value);
|
Result constant_operand(value);
|
||||||
answer = LikelySmiBinaryOperation(op, &constant_operand, operand,
|
answer = LikelySmiBinaryOperation(expr, &constant_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
// Only the least significant 5 bits of the shift value are used.
|
// Only the least significant 5 bits of the shift value are used.
|
||||||
@ -6505,10 +6505,10 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
default: {
|
default: {
|
||||||
Result constant_operand(value);
|
Result constant_operand(value);
|
||||||
if (reversed) {
|
if (reversed) {
|
||||||
answer = LikelySmiBinaryOperation(op, &constant_operand, operand,
|
answer = LikelySmiBinaryOperation(expr, &constant_operand, operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
} else {
|
} else {
|
||||||
answer = LikelySmiBinaryOperation(op, operand, &constant_operand,
|
answer = LikelySmiBinaryOperation(expr, operand, &constant_operand,
|
||||||
overwrite_mode);
|
overwrite_mode);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -6518,10 +6518,11 @@ Result CodeGenerator::ConstantSmiBinaryOperation(Token::Value op,
|
|||||||
return answer;
|
return answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
Result CodeGenerator::LikelySmiBinaryOperation(Token::Value op,
|
Result CodeGenerator::LikelySmiBinaryOperation(BinaryOperation* expr,
|
||||||
Result* left,
|
Result* left,
|
||||||
Result* right,
|
Result* right,
|
||||||
OverwriteMode overwrite_mode) {
|
OverwriteMode overwrite_mode) {
|
||||||
|
Token::Value op = expr->op();
|
||||||
Result answer;
|
Result answer;
|
||||||
// Special handling of div and mod because they use fixed registers.
|
// Special handling of div and mod because they use fixed registers.
|
||||||
if (op == Token::DIV || op == Token::MOD) {
|
if (op == Token::DIV || op == Token::MOD) {
|
||||||
|
@ -457,10 +457,8 @@ class CodeGenerator: public AstVisitor {
|
|||||||
// Generate code that computes a shortcutting logical operation.
|
// Generate code that computes a shortcutting logical operation.
|
||||||
void GenerateLogicalBooleanOperation(BinaryOperation* node);
|
void GenerateLogicalBooleanOperation(BinaryOperation* node);
|
||||||
|
|
||||||
void GenericBinaryOperation(
|
void GenericBinaryOperation(BinaryOperation* expr,
|
||||||
Token::Value op,
|
OverwriteMode overwrite_mode);
|
||||||
StaticType* type,
|
|
||||||
OverwriteMode overwrite_mode);
|
|
||||||
|
|
||||||
// If possible, combine two constant smi values using op to produce
|
// If possible, combine two constant smi values using op to produce
|
||||||
// a smi result, and push it on the virtual frame, all at compile time.
|
// a smi result, and push it on the virtual frame, all at compile time.
|
||||||
@ -469,17 +467,16 @@ class CodeGenerator: public AstVisitor {
|
|||||||
|
|
||||||
// Emit code to perform a binary operation on a constant
|
// Emit code to perform a binary operation on a constant
|
||||||
// smi and a likely smi. Consumes the Result *operand.
|
// smi and a likely smi. Consumes the Result *operand.
|
||||||
Result ConstantSmiBinaryOperation(Token::Value op,
|
Result ConstantSmiBinaryOperation(BinaryOperation* expr,
|
||||||
Result* operand,
|
Result* operand,
|
||||||
Handle<Object> constant_operand,
|
Handle<Object> constant_operand,
|
||||||
StaticType* type,
|
|
||||||
bool reversed,
|
bool reversed,
|
||||||
OverwriteMode overwrite_mode);
|
OverwriteMode overwrite_mode);
|
||||||
|
|
||||||
// Emit code to perform a binary operation on two likely smis.
|
// Emit code to perform a binary operation on two likely smis.
|
||||||
// The code to handle smi arguments is produced inline.
|
// The code to handle smi arguments is produced inline.
|
||||||
// Consumes the Results *left and *right.
|
// Consumes the Results *left and *right.
|
||||||
Result LikelySmiBinaryOperation(Token::Value op,
|
Result LikelySmiBinaryOperation(BinaryOperation* expr,
|
||||||
Result* left,
|
Result* left,
|
||||||
Result* right,
|
Result* right,
|
||||||
OverwriteMode overwrite_mode);
|
OverwriteMode overwrite_mode);
|
||||||
|
Loading…
Reference in New Issue
Block a user