OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 | 2762 |
2763 void TestContext::BuildBranch(HValue* value) { | 2763 void TestContext::BuildBranch(HValue* value) { |
2764 // We expect the graph to be in edge-split form: there is no edge that | 2764 // We expect the graph to be in edge-split form: there is no edge that |
2765 // connects a branch node to a join node. We conservatively ensure that | 2765 // connects a branch node to a join node. We conservatively ensure that |
2766 // property by always adding an empty block on the outgoing edges of this | 2766 // property by always adding an empty block on the outgoing edges of this |
2767 // branch. | 2767 // branch. |
2768 HOptimizedGraphBuilder* builder = owner(); | 2768 HOptimizedGraphBuilder* builder = owner(); |
2769 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { | 2769 if (value != NULL && value->CheckFlag(HValue::kIsArguments)) { |
2770 builder->Bailout(kArgumentsObjectValueInATestContext); | 2770 builder->Bailout(kArgumentsObjectValueInATestContext); |
2771 } | 2771 } |
2772 if (value->IsConstant()) { | |
2773 HConstant* constant_value = HConstant::cast(value); | |
2774 if (constant_value->BooleanValue()) { | |
2775 builder->current_block()->Goto(if_true(), builder->function_state()); | |
2776 } else { | |
2777 builder->current_block()->Goto(if_false(), builder->function_state()); | |
2778 } | |
2779 builder->set_current_block(NULL); | |
2780 return; | |
2781 } | |
2782 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); | 2772 HBasicBlock* empty_true = builder->graph()->CreateBasicBlock(); |
2783 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); | 2773 HBasicBlock* empty_false = builder->graph()->CreateBasicBlock(); |
2784 ToBooleanStub::Types expected(condition()->to_boolean_types()); | 2774 ToBooleanStub::Types expected(condition()->to_boolean_types()); |
2785 HBranch* test = new(zone()) HBranch(value, expected, empty_true, empty_false); | 2775 HBranch* test = new(zone()) HBranch(value, expected, empty_true, empty_false); |
2786 builder->current_block()->Finish(test); | 2776 builder->current_block()->Finish(test); |
2787 | 2777 |
2788 empty_true->Goto(if_true(), builder->function_state()); | 2778 empty_true->Goto(if_true(), builder->function_state()); |
2789 empty_false->Goto(if_false(), builder->function_state()); | 2779 empty_false->Goto(if_false(), builder->function_state()); |
2790 builder->set_current_block(NULL); | 2780 builder->set_current_block(NULL); |
2791 } | 2781 } |
(...skipping 7092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9884 if (ShouldProduceTraceOutput()) { | 9874 if (ShouldProduceTraceOutput()) { |
9885 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 9875 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
9886 } | 9876 } |
9887 | 9877 |
9888 #ifdef DEBUG | 9878 #ifdef DEBUG |
9889 graph_->Verify(false); // No full verify. | 9879 graph_->Verify(false); // No full verify. |
9890 #endif | 9880 #endif |
9891 } | 9881 } |
9892 | 9882 |
9893 } } // namespace v8::internal | 9883 } } // namespace v8::internal |
OLD | NEW |