Tiny cleanup of LCodeGen::DoBranch.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8759 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e48ec1c4
...@@ -1392,10 +1392,9 @@ void LCodeGen::DoBranch(LBranch* instr) { ...@@ -1392,10 +1392,9 @@ void LCodeGen::DoBranch(LBranch* instr) {
EmitBranch(true_block, false_block, not_equal); EmitBranch(true_block, false_block, not_equal);
} else { } else {
ASSERT(r.IsTagged()); ASSERT(r.IsTagged());
Factory* factory = this->factory();
Register reg = ToRegister(instr->InputAt(0)); Register reg = ToRegister(instr->InputAt(0));
if (instr->hydrogen()->value()->type().IsBoolean()) { if (instr->hydrogen()->value()->type().IsBoolean()) {
__ cmp(reg, factory->true_value()); __ cmp(reg, factory()->true_value());
EmitBranch(true_block, false_block, equal); EmitBranch(true_block, false_block, equal);
} else { } else {
Label* true_label = chunk_->GetAssemblyLabel(true_block); Label* true_label = chunk_->GetAssemblyLabel(true_block);
...@@ -1407,41 +1406,41 @@ void LCodeGen::DoBranch(LBranch* instr) { ...@@ -1407,41 +1406,41 @@ void LCodeGen::DoBranch(LBranch* instr) {
if (expected.Contains(ToBooleanStub::UNDEFINED)) { if (expected.Contains(ToBooleanStub::UNDEFINED)) {
// undefined -> false. // undefined -> false.
__ cmp(reg, factory->undefined_value()); __ cmp(reg, factory()->undefined_value());
__ j(equal, false_label); __ j(equal, false_label);
} else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) { } else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) {
// We've seen undefined for the first time -> deopt. // We've seen undefined for the first time -> deopt.
__ cmp(reg, factory->undefined_value()); __ cmp(reg, factory()->undefined_value());
DeoptimizeIf(equal, instr->environment()); DeoptimizeIf(equal, instr->environment());
} }
if (expected.Contains(ToBooleanStub::BOOLEAN)) { if (expected.Contains(ToBooleanStub::BOOLEAN)) {
// true -> true. // true -> true.
__ cmp(reg, factory->true_value()); __ cmp(reg, factory()->true_value());
__ j(equal, true_label); __ j(equal, true_label);
} else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) { } else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) {
// We've seen a string for the first time -> deopt. // We've seen a boolean for the first time -> deopt.
__ cmp(reg, factory->true_value()); __ cmp(reg, factory()->true_value());
DeoptimizeIf(equal, instr->environment()); DeoptimizeIf(equal, instr->environment());
} }
if (expected.Contains(ToBooleanStub::BOOLEAN)) { if (expected.Contains(ToBooleanStub::BOOLEAN)) {
// false -> false. // false -> false.
__ cmp(reg, factory->false_value()); __ cmp(reg, factory()->false_value());
__ j(equal, false_label); __ j(equal, false_label);
} else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) { } else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) {
// We've seen a string for the first time -> deopt. // We've seen a boolean for the first time -> deopt.
__ cmp(reg, factory->false_value()); __ cmp(reg, factory()->false_value());
DeoptimizeIf(equal, instr->environment()); DeoptimizeIf(equal, instr->environment());
} }
if (expected.Contains(ToBooleanStub::NULL_TYPE)) { if (expected.Contains(ToBooleanStub::NULL_TYPE)) {
// 'null' -> false. // 'null' -> false.
__ cmp(reg, factory->null_value()); __ cmp(reg, factory()->null_value());
__ j(equal, false_label); __ j(equal, false_label);
} else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) { } else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) {
// We've seen null for the first time -> deopt. // We've seen null for the first time -> deopt.
__ cmp(reg, factory->null_value()); __ cmp(reg, factory()->null_value());
DeoptimizeIf(equal, instr->environment()); DeoptimizeIf(equal, instr->environment());
} }
...@@ -1497,7 +1496,7 @@ void LCodeGen::DoBranch(LBranch* instr) { ...@@ -1497,7 +1496,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
// heap number -> false iff +0, -0, or NaN. // heap number -> false iff +0, -0, or NaN.
Label not_heap_number; Label not_heap_number;
__ cmp(FieldOperand(reg, HeapObject::kMapOffset), __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
factory->heap_number_map()); factory()->heap_number_map());
__ j(not_equal, &not_heap_number, Label::kNear); __ j(not_equal, &not_heap_number, Label::kNear);
__ fldz(); __ fldz();
__ fld_d(FieldOperand(reg, HeapNumber::kValueOffset)); __ fld_d(FieldOperand(reg, HeapNumber::kValueOffset));
...@@ -1508,7 +1507,7 @@ void LCodeGen::DoBranch(LBranch* instr) { ...@@ -1508,7 +1507,7 @@ void LCodeGen::DoBranch(LBranch* instr) {
} else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) { } else if (expected.Contains(ToBooleanStub::INTERNAL_OBJECT)) {
// We've seen a heap number for the first time -> deopt. // We've seen a heap number for the first time -> deopt.
__ cmp(FieldOperand(reg, HeapObject::kMapOffset), __ cmp(FieldOperand(reg, HeapObject::kMapOffset),
factory->heap_number_map()); factory()->heap_number_map());
DeoptimizeIf(equal, instr->environment()); DeoptimizeIf(equal, instr->environment());
} }
......
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