Commit 68f56646 authored by ager@chromium.org's avatar ager@chromium.org

Address review comments.

Only jump over 'else' part of a conditional if it is actually
generated.  Update a comment to more correctly reflect what is going
on.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2402 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 05b7b265
...@@ -2421,25 +2421,21 @@ void CodeGenerator::VisitConditional(Conditional* node) { ...@@ -2421,25 +2421,21 @@ void CodeGenerator::VisitConditional(Conditional* node) {
Comment cmnt(masm_, "[ Conditional"); Comment cmnt(masm_, "[ Conditional");
JumpTarget then; JumpTarget then;
JumpTarget else_; JumpTarget else_;
JumpTarget exit;
LoadConditionAndSpill(node->condition(), NOT_INSIDE_TYPEOF, LoadConditionAndSpill(node->condition(), NOT_INSIDE_TYPEOF,
&then, &else_, true); &then, &else_, true);
if (frame_ != NULL) { if (has_valid_frame()) {
Branch(false, &else_); Branch(false, &else_);
} }
if (frame_ != NULL || then.is_linked()) { if (has_valid_frame() || then.is_linked()) {
then.Bind(); then.Bind();
LoadAndSpill(node->then_expression(), typeof_state()); LoadAndSpill(node->then_expression(), typeof_state());
} }
if (frame_ != NULL) {
exit.Jump();
}
if (else_.is_linked()) { if (else_.is_linked()) {
JumpTarget exit;
if (has_valid_frame()) exit.Jump();
else_.Bind(); else_.Bind();
LoadAndSpill(node->else_expression(), typeof_state()); LoadAndSpill(node->else_expression(), typeof_state());
} if (exit.is_linked()) exit.Bind();
if (exit.is_linked()) {
exit.Bind();
} }
ASSERT(frame_->height() == original_height + 1); ASSERT(frame_->height() == original_height + 1);
} }
...@@ -3615,9 +3611,8 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) { ...@@ -3615,9 +3611,8 @@ void CodeGenerator::VisitUnaryOperation(UnaryOperation* node) {
false_target(), false_target(),
true_target(), true_target(),
true); true);
// LoadConditionAndSpill might emit only unconditional jumps to // LoadCondition may (and usually does) leave a test and branch to
// the targets in which case cc_reg_ is not set. When that // be emitted by the caller. In that case, negate the condition.
// happens, don't attempt to negate the condition.
if (has_cc()) cc_reg_ = NegateCondition(cc_reg_); if (has_cc()) cc_reg_ = NegateCondition(cc_reg_);
} else if (op == Token::DELETE) { } else if (op == Token::DELETE) {
......
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