Index: src/x64/codegen-x64.cc |
=================================================================== |
--- src/x64/codegen-x64.cc (revision 4288) |
+++ src/x64/codegen-x64.cc (working copy) |
@@ -3281,13 +3281,7 @@ |
} |
-void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) { |
- // TODO(X64): This code was copied verbatim from codegen-ia32. |
- // Either find a reason to change it or move it to a shared location. |
- |
- Comment cmnt(masm_, "[ BinaryOperation"); |
- Token::Value op = node->op(); |
- |
+void CodeGenerator::GenerateLogicalBooleanOperation(BinaryOperation* node) { |
// According to ECMA-262 section 11.11, page 58, the binary logical |
// operators must yield the result of one of the two expressions |
// before any ToBoolean() conversions. This means that the value |
@@ -3297,7 +3291,7 @@ |
// control flow), we force the right hand side to do the same. This |
// is necessary because we assume that if we get control flow on the |
// last path out of an expression we got it on all paths. |
- if (op == Token::AND) { |
+ if (node->op() == Token::AND) { |
JumpTarget is_true; |
ControlDestination dest(&is_true, destination()->false_target(), true); |
LoadCondition(node->left(), &dest, false); |
@@ -3360,7 +3354,8 @@ |
exit.Bind(); |
} |
- } else if (op == Token::OR) { |
+ } else { |
+ ASSERT(node->op() == Token::OR); |
JumpTarget is_false; |
ControlDestination dest(destination()->true_target(), &is_false, false); |
LoadCondition(node->left(), &dest, false); |
@@ -3421,7 +3416,14 @@ |
// Exit (always with a materialized value). |
exit.Bind(); |
} |
+ } |
+} |
+void CodeGenerator::VisitBinaryOperation(BinaryOperation* node) { |
+ Comment cmnt(masm_, "[ BinaryOperation"); |
+ |
+ if (node->op() == Token::AND || node->op() == Token::OR) { |
+ GenerateLogicalBooleanOperation(node); |
} else { |
// NOTE: The code below assumes that the slow cases (calls to runtime) |
// never return a constant/immutable object. |