Index: src/code-stubs-hydrogen.cc |
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc |
index c8dd9bf0f198af82064d9487852e24ba8733d596..775916adc52b7c28250c2c2eae085b134d6dc3a3 100644 |
--- a/src/code-stubs-hydrogen.cc |
+++ b/src/code-stubs-hydrogen.cc |
@@ -1065,14 +1065,31 @@ Handle<Code> StringAddStub::GenerateCode() { |
template <> |
HValue* CodeStubGraphBuilder<ToBooleanStub>::BuildCodeInitializedStub() { |
ToBooleanStub* stub = casted_stub(); |
+ HValue* true_value = NULL; |
+ HValue* false_value = NULL; |
+ |
+ switch (stub->GetMode()) { |
+ case ToBooleanStub::RESULT_AS_SMI: |
+ true_value = graph()->GetConstant1(); |
+ false_value = graph()->GetConstant0(); |
+ break; |
+ case ToBooleanStub::RESULT_AS_ODDBALL: |
+ true_value = graph()->GetConstantTrue(); |
+ false_value = graph()->GetConstantFalse(); |
+ break; |
+ case ToBooleanStub::RESULT_AS_INVERSE_ODDBALL: |
+ true_value = graph()->GetConstantFalse(); |
+ false_value = graph()->GetConstantTrue(); |
+ break; |
+ } |
IfBuilder if_true(this); |
if_true.If<HBranch>(GetParameter(0), stub->GetTypes()); |
if_true.Then(); |
- if_true.Return(graph()->GetConstant1()); |
+ if_true.Return(true_value); |
if_true.Else(); |
if_true.End(); |
- return graph()->GetConstant0(); |
+ return false_value; |
} |